c-decl.c (warn_if_shadowing): Don't warn if shadowed identifier is from system header.
authorAlan Modra <amodra@gmail.com>
Thu, 24 Nov 2011 02:45:21 +0000 (13:15 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Thu, 24 Nov 2011 02:45:21 +0000 (13:15 +1030)
* c-decl.c (warn_if_shadowing): Don't warn if shadowed
identifier is from system header.

From-SVN: r181684

gcc/ChangeLog
gcc/c-decl.c

index e678a7ad8ee809ff070430fa0b5b8fbf284e71d7..6787a7c141d899d6f0fffb71de78815fc32faf09 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-24  Alan Modra  <amodra@gmail.com>
+
+       * c-decl.c (warn_if_shadowing): Don't warn if shadowed
+       identifier is from system header.
+
 2011-11-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/51261
 
        PR c++/51264
        * tree.c (iterative_hash_expr): Remove break after return.
-       
+
 2011-11-22  Iain Sandoe  <iains@gcc.gnu.org>
 
        * target.def (tm_clone_table_section): New hook.
index 3cb29c0b3a2a3e40c8fd592b5be4a2c990249054..44358a8c15e960e669b90b61e4328c22e14b4f1a 100644 (file)
@@ -2534,7 +2534,10 @@ warn_if_shadowing (tree new_decl)
 
   /* Is anything being shadowed?  Invisible decls do not count.  */
   for (b = I_SYMBOL_BINDING (DECL_NAME (new_decl)); b; b = b->shadowed)
-    if (b->decl && b->decl != new_decl && !b->invisible)
+    if (b->decl && b->decl != new_decl && !b->invisible
+       && (b->decl == error_mark_node
+           || diagnostic_report_warnings_p (global_dc,
+                                            DECL_SOURCE_LOCATION (b->decl))))
       {
        tree old_decl = b->decl;