From 7be9e5d02f0b17eb34780f750cf9aea762674eee Mon Sep 17 00:00:00 2001 From: obrien Date: Wed, 7 Sep 2005 09:23:39 +0000 Subject: [PATCH] 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 --- contrib/gcc/c-decl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c index bbfe6177c332..26431d0e4836 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;