aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@gcc.gnu.org>2005-09-02 01:09:42 +0000
committerCraig Rodrigues <rodrigc@gcc.gnu.org>2005-09-02 01:09:42 +0000
commit52d09157d56d4751646b85a851d4bf6ade2e81b5 (patch)
treec84a6f664537d5724ee01c7b00478db85dd708a2 /gcc/c-decl.c
parent277fc67edfc28c961c9f7c1011aed3d7f51ffad8 (diff)
downloadgcc-52d09157d56d4751646b85a851d4bf6ade2e81b5.zip
gcc-52d09157d56d4751646b85a851d4bf6ade2e81b5.tar.gz
gcc-52d09157d56d4751646b85a851d4bf6ade2e81b5.tar.bz2
c-decl.c (diagnose_mismatched_decls): With -Wredundant-decls...
* c-decl.c (diagnose_mismatched_decls): With -Wredundant-decls, do not issue warning for a variable definition following a declaration. From-SVN: r103758
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 6d60fd0..f3b8d64 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1555,7 +1555,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 (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
newdecl);