* c-decl.c (pop_scope): Don't warn about an unused variable
if it is marked with TREE_NO_WARNING.
(duplicate_decls): Set TREE_NO_WARNING if olddecl and newdecl
somenow mismatch and olddecl is to be replaced.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105621
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-10-19 Steven Bosscher <stevenb@suse.de>
+
+ PR c/23228
+ * c-decl.c (pop_scope): Don't warn about an unused variable
+ if it is marked with TREE_NO_WARNING.
+ (duplicate_decls): Set TREE_NO_WARNING if olddecl and newdecl
+ somenow mismatch and olddecl is to be replaced.
+
2005-10-19 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/23199
case VAR_DECL:
/* Warnings for unused variables. */
if (!TREE_USED (p)
+ && !TREE_NO_WARNING (p)
&& !DECL_IN_SYSTEM_HEADER (p)
&& DECL_NAME (p)
&& !DECL_ARTIFICIAL (p)
tree newtype = NULL, oldtype = NULL;
if (!diagnose_mismatched_decls (newdecl, olddecl, &newtype, &oldtype))
- return false;
+ {
+ /* Avoid `unused variable' and other warnings warnings for OLDDECL. */
+ TREE_NO_WARNING (olddecl) = 1;
+ return false;
+ }
merge_decls (newdecl, olddecl, newtype, oldtype);
return true;