From owner-freebsd-bugs@FreeBSD.ORG Fri May 13 22:30:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3F971065677 for ; Fri, 13 May 2011 22:30:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C16118FC12 for ; Fri, 13 May 2011 22:30:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DMU84W011022 for ; Fri, 13 May 2011 22:30:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p4DMU8a1011021; Fri, 13 May 2011 22:30:08 GMT (envelope-from gnats) Resent-Date: Fri, 13 May 2011 22:30:08 GMT Resent-Message-Id: <201105132230.p4DMU8a1011021@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Pedro Giffuni Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5FAE1065670 for ; Fri, 13 May 2011 22:21:30 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7B9058FC15 for ; Fri, 13 May 2011 22:21:30 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DMLUJ7092001 for ; Fri, 13 May 2011 22:21:30 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p4DMLUab092000; Fri, 13 May 2011 22:21:30 GMT (envelope-from nobody) Message-Id: <201105132221.p4DMLUab092000@red.freebsd.org> Date: Fri, 13 May 2011 22:21:30 GMT From: Pedro Giffuni To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: gnu/157019: gcc: Add some warnings from OpenBSD gcc and fix a typo. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 22:30:09 -0000 >Number: 157019 >Category: gnu >Synopsis: gcc: Add some warnings from OpenBSD gcc and fix a typo. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri May 13 22:30:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Pedro Giffuni >Release: 8.2-Release >Organization: >Environment: FreeBSD mogwai.giffuni.net 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Mar 18 15:35:09 UTC 2011 root@mogwai.giffuni.net:/usr/src/sys/amd64/compile/GENERIC amd64 >Description: While looking for some unrelated fixes, I found these simple patches for gcc-4.2.1 from OpenBSD's tree. - Implement -Wvariable-decl. - port -Wtrampolines support from gcc3. (I took out -ftrampolines since it seems excessive for FreeBSD). - Fix typo in check_for_nested_with_variably_modified present for 4 years that hampered the inliner without anyone noticing. >How-To-Repeat: >Fix: Patch attached. Patch attached with submission follows: --- gcc/c-decl.c 2009/10/15 18:11:28 1.1 +++ gcc/c-decl.c 2010/04/29 19:37:37 1.2 @@ -4256,6 +4256,8 @@ grokdeclarator (const struct c_declarator *declarator, pedwarn ("ISO C90 forbids variable-size array %qs", name); } + if (warn_variable_decl) + warning (0, "variable-sized array %qs", name); } if (integer_zerop (size)) --- gcc/c.opt 2010/05/09 14:09:18 1.2 +++ gcc/c.opt 2010/05/12 14:35:56 1.3 @@ -407,6 +407,10 @@ Wtraditional C ObjC Var(warn_traditional) Warn about features not present in traditional C +Wtrampolines +Common Var(warn_trampolines) +Warn when trampolines are emitted + Wtrigraphs C ObjC C++ ObjC++ Warn if trigraphs are encountered that might affect the meaning of the program --- gcc/common.opt 2010/04/28 07:27:02 1.4 +++ gcc/common.opt 2010/04/29 19:37:37 1.5 @@ -193,6 +193,10 @@ Wunused-variable Common Var(warn_unused_variable) Warn when a variable is unused +Wvariable-decl +Common Var(warn_variable_decl) +Warn about variable-sized declarations. + Wvolatile-register-var Common Var(warn_register_var) Warn when a register variable is declared volatile --- gcc/tree-nested.c 2009/10/15 18:11:28 1.1.1.1 +++ gcc/tree-nested.c 2010/05/12 14:35:56 1.3 @@ -750,7 +750,7 @@ check_for_nested_with_variably_modified (tree fndecl, for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested) { for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = TREE_CHAIN (arg)) - if (variably_modified_type_p (TREE_TYPE (arg), 0), orig_fndecl) + if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl)) return true; if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl)) @@ -1622,6 +1622,15 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, if (DECL_NO_STATIC_CHAIN (decl)) break; + if (warn_trampolines) + { + warning(0, "local function address taken needing trampoline generation"); + } /* Lookup the immediate parent of the callee, as that's where we need to insert the trampoline. */ for (i = info; i->context != target_context; i = i->outer) >Release-Note: >Audit-Trail: >Unformatted: