c-decl.c (finish_decl): Set DECL_DEFER_OUTPUT on tentative file-scope definitions.
* c-decl.c (finish_decl): Set DECL_DEFER_OUTPUT on tentative file-scope definitions. * toplev.c (rest_of_decl_compilation): Check DECL_DEFER_OUTPUT to recognize a tentative definition. Lose obsolete code. * toplev.c (wrapup_global_declarations): Don't emit DECL_COMDAT variables unless necessary, either. From-SVN: r40066
This commit is contained in:
parent
e5dd4aad7f
commit
8cf8d8a27b
|
@ -1,3 +1,13 @@
|
||||||
|
2001-02-26 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* c-decl.c (finish_decl): Set DECL_DEFER_OUTPUT on tentative file-scope
|
||||||
|
definitions.
|
||||||
|
* toplev.c (rest_of_decl_compilation): Check DECL_DEFER_OUTPUT to
|
||||||
|
recognize a tentative definition. Lose obsolete code.
|
||||||
|
|
||||||
|
* toplev.c (wrapup_global_declarations): Don't emit DECL_COMDAT
|
||||||
|
variables unless necessary, either.
|
||||||
|
|
||||||
2001-02-25 Richard Henderson <rth@redhat.com>
|
2001-02-25 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* ifcvt.c (struct noce_if_info): Add test_bb.
|
* ifcvt.c (struct noce_if_info): Add test_bb.
|
||||||
|
|
14
gcc/c-decl.c
14
gcc/c-decl.c
|
@ -3612,9 +3612,17 @@ finish_decl (decl, init, asmspec_tree)
|
||||||
maybe_objc_check_decl (decl);
|
maybe_objc_check_decl (decl);
|
||||||
|
|
||||||
if (!DECL_CONTEXT (decl))
|
if (!DECL_CONTEXT (decl))
|
||||||
rest_of_decl_compilation (decl, asmspec,
|
{
|
||||||
(DECL_CONTEXT (decl) == 0
|
if (DECL_INITIAL (decl) == NULL_TREE
|
||||||
|| TREE_ASM_WRITTEN (decl)), 0);
|
|| DECL_INITIAL (decl) == error_mark_node)
|
||||||
|
/* Don't output anything
|
||||||
|
when a tentative file-scope definition is seen.
|
||||||
|
But at end of compilation, do output code for them. */
|
||||||
|
DECL_DEFER_OUTPUT (decl) = 1;
|
||||||
|
rest_of_decl_compilation (decl, asmspec,
|
||||||
|
(DECL_CONTEXT (decl) == 0
|
||||||
|
|| TREE_ASM_WRITTEN (decl)), 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (asmspec)
|
if (asmspec)
|
||||||
|
|
23
gcc/toplev.c
23
gcc/toplev.c
|
@ -1940,8 +1940,8 @@ wrapup_global_declarations (vec, len)
|
||||||
defined in a main file, as opposed to an include file. */
|
defined in a main file, as opposed to an include file. */
|
||||||
|
|
||||||
if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
|
if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
|
||||||
&& (! TREE_READONLY (decl)
|
&& (((! TREE_READONLY (decl) || TREE_PUBLIC (decl))
|
||||||
|| TREE_PUBLIC (decl)
|
&& !DECL_COMDAT (decl))
|
||||||
|| (!optimize
|
|| (!optimize
|
||||||
&& flag_keep_static_consts
|
&& flag_keep_static_consts
|
||||||
&& !DECL_ARTIFICIAL (decl))
|
&& !DECL_ARTIFICIAL (decl))
|
||||||
|
@ -2562,20 +2562,11 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end)
|
||||||
{
|
{
|
||||||
timevar_push (TV_VARCONST);
|
timevar_push (TV_VARCONST);
|
||||||
make_decl_rtl (decl, asmspec);
|
make_decl_rtl (decl, asmspec);
|
||||||
/* Initialized extern variable exists to be replaced
|
/* Don't output anything
|
||||||
with its value, or represents something that will be
|
when a tentative file-scope definition is seen.
|
||||||
output in another file. */
|
But at end of compilation, do output code for them. */
|
||||||
if (! (TREE_CODE (decl) == VAR_DECL
|
if (at_end || !DECL_DEFER_OUTPUT (decl))
|
||||||
&& DECL_EXTERNAL (decl) && TREE_READONLY (decl)
|
assemble_variable (decl, top_level, at_end, 0);
|
||||||
&& DECL_INITIAL (decl) != 0
|
|
||||||
&& DECL_INITIAL (decl) != error_mark_node))
|
|
||||||
/* Don't output anything
|
|
||||||
when a tentative file-scope definition is seen.
|
|
||||||
But at end of compilation, do output code for them. */
|
|
||||||
if (! (! at_end && top_level
|
|
||||||
&& (DECL_INITIAL (decl) == 0
|
|
||||||
|| DECL_INITIAL (decl) == error_mark_node)))
|
|
||||||
assemble_variable (decl, top_level, at_end, 0);
|
|
||||||
if (decl == last_assemble_variable_decl)
|
if (decl == last_assemble_variable_decl)
|
||||||
{
|
{
|
||||||
ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
|
ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
|
||||||
|
|
Loading…
Reference in New Issue