]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: c-decl.c (diagnose_mismatched_decls): With -Wredundant-decls...
authorCraig Rodrigues <rodrigc@gcc.gnu.org>
Fri, 9 Sep 2005 00:21:01 +0000 (00:21 +0000)
committerCraig Rodrigues <rodrigc@gcc.gnu.org>
Fri, 9 Sep 2005 00:21:01 +0000 (00:21 +0000)
Backport from mainline
2005-09-01  Craig Rodrigues  <rodrigc@gcc.gnu.org>

* c-decl.c (diagnose_mismatched_decls):  With -Wredundant-decls,
do not issue warning for a variable definition following
a declaration.

From-SVN: r104059

gcc/ChangeLog
gcc/c-decl.c

index 187e883d8b4812e5e70f81c32692da0e10b8c575..9511a3eef0c0e9949780dca50316ccd07a368b31 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-08  Craig Rodrigues  <rodrigc@gcc.gnu.org>
+
+       Backport from mainline
+       2005-09-01  Craig Rodrigues  <rodrigc@gcc.gnu.org>
+
+       * c-decl.c (diagnose_mismatched_decls):  With -Wredundant-decls,
+       do not issue warning for a variable definition following
+       a declaration.
+
 2005-09-02  Richard Sandiford  <richard@codesourcery.com>
 
        PR c/22061
index b4d7e357ea6bf5bd7c4bdf4159a4020d5da45a60..66e0fd7d484a13ea1ae5747cc78c9aeeaf2b3efb 100644 (file)
@@ -1271,7 +1271,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;