diff options
author | obrien <obrien@FreeBSD.org> | 2005-09-07 09:23:39 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2005-09-07 09:23:39 +0000 |
commit | a477d798c9d45ce12b97ca4ff0933eab79a52b77 (patch) | |
tree | 6055ff69d424d51ace8f317a1e42517c4aecb131 /contrib | |
parent | a339f295af72e31373c8827cb1145ecd1276d43f (diff) | |
download | FreeBSD-src-a477d798c9d45ce12b97ca4ff0933eab79a52b77.zip FreeBSD-src-a477d798c9d45ce12b97ca4ff0933eab79a52b77.tar.gz |
Fix bug where static forward declarations weren't accepted.
This allows us to fix non-ISO-C constructs in our kernel to legal ISO-C.
Submitted by: rodrigc
Obtained from: http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00006.html
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/c-decl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c index bbfe617..26431d0 100644 --- a/contrib/gcc/c-decl.c +++ b/contrib/gcc/c-decl.c @@ -1264,7 +1264,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, && !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl)) /* Don't warn about forward parameter decls. */ && !(TREE_CODE (newdecl) == PARM_DECL - && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl))) + && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl)) + /* Don't warn about a variable definition following a declaration. */ + && !(TREE_CODE (newdecl) == VAR_DECL + && DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))) { warning ("%Jredundant redeclaration of '%D'", newdecl, newdecl); warned = true; |