summaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r--gcc/c/c-decl.c68
1 files changed, 22 insertions, 46 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 8a0be2857a6..77d1de9adbb 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -7837,10 +7837,18 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
}
/* If this structure or union completes the type of any previous
- variable declaration, lay it out and output its rtl. */
- for (x = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t));
- x;
- x = TREE_CHAIN (x))
+ variable declaration, lay it out and output its rtl.
+
+ Note: C_TYPE_INCOMPLETE_VARS overloads TYPE_VFIELD which is used
+ in dwarf2out via rest_of_decl_compilation below and means
+ something totally different. Since we will be clearing
+ C_TYPE_INCOMPLETE_VARS shortly after we iterate through them,
+ clear it ahead of time and avoid problems in dwarf2out. Ideally,
+ C_TYPE_INCOMPLETE_VARS should use some language specific
+ node. */
+ tree incomplete_vars = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t));
+ C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0;
+ for (x = incomplete_vars; x; x = TREE_CHAIN (x))
{
tree decl = TREE_VALUE (x);
if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
@@ -7853,7 +7861,6 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
rest_of_decl_compilation (decl, toplevel, 0);
}
}
- C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0;
/* Update type location to the one of the definition, instead of e.g.
a forward declaration. */
@@ -10679,9 +10686,8 @@ finish_declspecs (struct c_declspecs *specs)
return specs;
}
-/* A subroutine of c_write_global_declarations. Perform final processing
- on one file scope's declarations (or the external scope's declarations),
- GLOBALS. */
+/* Perform final processing on one file scope's declarations (or the
+ external scope's declarations), GLOBALS. */
static void
c_write_global_declarations_1 (tree globals)
@@ -10694,7 +10700,7 @@ c_write_global_declarations_1 (tree globals)
{
/* Check for used but undefined static functions using the C
standard's definition of "used", and set TREE_NO_WARNING so
- that check_global_declarations doesn't repeat the check. */
+ that check_global_declaration doesn't repeat the check. */
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_INITIAL (decl) == 0
&& DECL_EXTERNAL (decl)
@@ -10715,21 +10721,6 @@ c_write_global_declarations_1 (tree globals)
reconsider |= wrapup_global_declaration_2 (decl);
}
while (reconsider);
-
- for (decl = globals; decl; decl = DECL_CHAIN (decl))
- check_global_declaration_1 (decl);
-}
-
-/* A subroutine of c_write_global_declarations Emit debug information for each
- of the declarations in GLOBALS. */
-
-static void
-c_write_global_declarations_2 (tree globals)
-{
- tree decl;
-
- for (decl = globals; decl ; decl = DECL_CHAIN (decl))
- debug_hooks->global_decl (decl);
}
/* Callback to collect a source_ref from a DECL. */
@@ -10779,8 +10770,11 @@ for_each_global_decl (void (*callback) (tree decl))
callback (decl);
}
+/* Perform any final parser cleanups and generate initial debugging
+ information. */
+
void
-c_write_global_declarations (void)
+c_parse_final_cleanups (void)
{
tree t;
unsigned i;
@@ -10789,6 +10783,7 @@ c_write_global_declarations (void)
if (pch_file)
return;
+ timevar_stop (TV_PHASE_PARSING);
timevar_start (TV_PHASE_DEFERRED);
/* Do the Objective-C stuff. This is where all the Objective-C
@@ -10827,34 +10822,15 @@ c_write_global_declarations (void)
}
/* Process all file scopes in this compilation, and the external_scope,
- through wrapup_global_declarations and check_global_declarations. */
+ through wrapup_global_declarations. */
FOR_EACH_VEC_ELT (*all_translation_units, i, t)
c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t)));
c_write_global_declarations_1 (BLOCK_VARS (ext_block));
timevar_stop (TV_PHASE_DEFERRED);
- timevar_start (TV_PHASE_OPT_GEN);
-
- /* We're done parsing; proceed to optimize and emit assembly.
- FIXME: shouldn't be the front end's responsibility to call this. */
- symtab->finalize_compilation_unit ();
-
- timevar_stop (TV_PHASE_OPT_GEN);
- timevar_start (TV_PHASE_DBGINFO);
-
- /* After cgraph has had a chance to emit everything that's going to
- be emitted, output debug information for globals. */
- if (!seen_error ())
- {
- timevar_push (TV_SYMOUT);
- FOR_EACH_VEC_ELT (*all_translation_units, i, t)
- c_write_global_declarations_2 (BLOCK_VARS (DECL_INITIAL (t)));
- c_write_global_declarations_2 (BLOCK_VARS (ext_block));
- timevar_pop (TV_SYMOUT);
- }
+ timevar_start (TV_PHASE_PARSING);
ext_block = NULL;
- timevar_stop (TV_PHASE_DBGINFO);
}
/* Register reserved keyword WORD as qualifier for address space AS. */