gnu/157019: gcc: Add some warnings from OpenBSD gcc and fix a typo.
Pedro Giffuni
giffunip at tutopia.com
Fri May 13 22:30:09 UTC 2011
>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 at 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:
More information about the freebsd-bugs
mailing list