From 6213608449b6268ae63a5a37c06ed32509b17c3a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 15 Nov 2000 18:34:29 +0000 Subject: [PATCH] toplev.c (wrapup_global_declarations): Don't write out artificial static variables that aren't needed. * toplev.c (wrapup_global_declarations): Don't write out artificial static variables that aren't needed. * decl.c (wrapup_globals_for_namespace): Don't mark things TREE_ASM_WRITTEN when they're not. From-SVN: r37485 --- gcc/ChangeLog | 5 +++++ gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 14 +------------- gcc/toplev.c | 4 +++- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9d8ff6a430..dfed0a725ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-11-15 Mark Mitchell + + * toplev.c (wrapup_global_declarations): Don't write out + artificial static variables that aren't needed. + 2000-11-15 Bernd Schmidt * ia64.c (struct group): New structure. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c5a369ccf4d..5294676ff7a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-11-15 Mark Mitchell + + * decl.c (wrapup_globals_for_namespace): Don't mark things + TREE_ASM_WRITTEN when they're not. + 2000-11-15 Jason Merrill * typeck2.c (friendly_abort): Uncount the error before handing diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0d677febb11..192a7cd857e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1926,20 +1926,8 @@ wrapup_globals_for_namespace (namespace, data) /* Process the decls in reverse order--earliest first. Put them into VEC from back to front, then take out from front. */ - for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl)) - { - /* Pretend we've output an unused static variable. This ensures - that the toplevel __FUNCTION__ etc won't be emitted, unless - needed. */ - if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl) - && !TREE_PUBLIC (decl) && !TREE_USED (decl)) - { - TREE_ASM_WRITTEN (decl) = 1; - DECL_IGNORED_P (decl) = 1; - } - vec[len - i - 1] = decl; - } + vec[len - i - 1] = decl; if (last_time) { diff --git a/gcc/toplev.c b/gcc/toplev.c index 95955fb6ca3..d25085a715c 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1950,7 +1950,9 @@ wrapup_global_declarations (vec, len) if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl) && (! TREE_READONLY (decl) || TREE_PUBLIC (decl) - || (!optimize && flag_keep_static_consts) + || (!optimize + && flag_keep_static_consts + && !DECL_ARTIFICIAL (decl)) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))) { reconsider = 1; -- 2.30.2