From 52d09157d56d4751646b85a851d4bf6ade2e81b5 Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Fri, 2 Sep 2005 01:09:42 +0000 Subject: 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 --- gcc/c-decl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/c-decl.c') 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); -- cgit v1.1