OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / c-decl.c
index 3cb29c0..4825c7e 100644 (file)
@@ -50,7 +50,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-family/c-pragma.h"
 #include "c-lang.h"
 #include "langhooks.h"
-#include "tree-mudflap.h"
 #include "tree-iterator.h"
 #include "diagnostic-core.h"
 #include "tree-dump.h"
@@ -719,7 +718,7 @@ c_finish_incomplete_decl (tree decl)
 
          complete_array_type (&TREE_TYPE (decl), NULL_TREE, true);
 
-         layout_decl (decl, 0);
+         relayout_decl (decl);
        }
     }
 }
@@ -1196,7 +1195,7 @@ pop_scope (void)
              DECL_CHAIN (p) = BLOCK_VARS (block);
              BLOCK_VARS (block) = p;
            }
-         else if (VAR_OR_FUNCTION_DECL_P (p))
+         else if (VAR_OR_FUNCTION_DECL_P (p) && scope != file_scope)
            {
              /* For block local externs add a special
                 DECL_EXTERNAL decl for debug info generation.  */
@@ -1786,7 +1785,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
   /* Redeclaration of a type is a constraint violation (6.7.2.3p1),
      but silently ignore the redeclaration if either is in a system
      header.  (Conflicting redeclarations were handled above.)  This
-     is allowed for C1X if the types are the same, not just
+     is allowed for C11 if the types are the same, not just
      compatible.  */
   if (TREE_CODE (newdecl) == TYPE_DECL)
     {
@@ -1815,7 +1814,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
                 newdecl);
          locate_old_decl (olddecl);
        }
-      else if (pedantic && !flag_isoc1x)
+      else if (pedantic && !flag_isoc11)
        {
          pedwarn (input_location, OPT_pedantic,
                   "redefinition of typedef %q+D", newdecl);
@@ -2534,7 +2533,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;
 
@@ -4308,7 +4310,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
       if (DECL_INITIAL (decl))
        TREE_TYPE (DECL_INITIAL (decl)) = type;
 
-      layout_decl (decl, 0);
+      relayout_decl (decl);
     }
 
   if (TREE_CODE (decl) == VAR_DECL)
@@ -6074,7 +6076,7 @@ grokdeclarator (const struct c_declarator *declarator,
              DECL_DECLARED_INLINE_P (decl) = 1;
            if (declspecs->noreturn_p)
              {
-               if (!flag_isoc1x)
+               if (!flag_isoc11)
                  {
                    if (flag_isoc99)
                      pedwarn (loc, OPT_pedantic,
@@ -6758,7 +6760,7 @@ grokfield (location_t loc,
 
         If this is something of the form "foo;" and foo is a TYPE_DECL, then
           If foo names a structure or union without a tag, then this
-            is an anonymous struct (this is permitted by C1X).
+            is an anonymous struct (this is permitted by C11).
           If MS or Plan 9 extensions are enabled and foo names a
             structure, then again this is an anonymous struct.
           Otherwise this is an error.
@@ -6789,7 +6791,7 @@ grokfield (location_t loc,
          pedwarn (loc, 0, "declaration does not declare anything");
          return NULL_TREE;
        }
-      if (!flag_isoc1x)
+      if (!flag_isoc11)
        {
          if (flag_isoc99)
            pedwarn (loc, OPT_pedantic,
@@ -7069,7 +7071,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
        {
          if (DECL_NAME (x) != 0)
            break;
-         if (flag_isoc1x
+         if (flag_isoc11
              && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
                  || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
            break;
@@ -9929,6 +9931,9 @@ collect_source_ref_cb (tree decl)
     collect_source_ref (LOCATION_FILE (decl_sloc (decl, false)));
 }
 
+/* Preserve the external declarations scope across a garbage collect.  */
+static GTY(()) tree ext_block;
+
 /* Collect all references relevant to SOURCE_FILE.  */
 
 static void
@@ -9939,6 +9944,8 @@ collect_all_refs (const char *source_file)
 
   FOR_EACH_VEC_ELT (tree, all_translation_units, i, t)
     collect_ada_nodes (BLOCK_VARS (DECL_INITIAL (t)), source_file);
+
+  collect_ada_nodes (BLOCK_VARS (ext_block), source_file);
 }
 
 /* Iterate over all global declarations and call CALLBACK.  */
@@ -9957,10 +9964,10 @@ for_each_global_decl (void (*callback) (tree decl))
       for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
        callback (decl);
     }
-}
 
-/* Preserve the external declarations scope across a garbage collect.  */
-static GTY(()) tree ext_block;
+  for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
+    callback (decl);
+}
 
 void
 c_write_global_declarations (void)