------- Comment #4 from steven at gcc dot gnu dot org  2005-10-12 19:37 -------
What about this....

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.687
diff -u -3 -p -r1.687 c-decl.c
--- c-decl.c    4 Oct 2005 13:58:41 -0000       1.687
+++ c-decl.c    12 Oct 2005 19:33:17 -0000
@@ -803,6 +803,7 @@ pop_scope (void)
        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)
@@ -1876,7 +1877,11 @@ duplicate_decls (tree newdecl, tree oldd
   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;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23228

Reply via email to