From 5a728aca655359f0f9b9d9ac81b79ad40f8efd2c Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 27 Jul 2000 04:49:17 +0000 Subject: [PATCH] decl.c (start_cleanup_fn): Mark the function as `inline'. * decl.c (start_cleanup_fn): Mark the function as `inline'. * decl2.c (get_guard): Call cp_finish_decl, not rest_of_decl_compilation, for local guards. * lex.c (do_identifier): Remove unused variable. From-SVN: r35285 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 5 +++++ gcc/cp/decl2.c | 2 +- gcc/cp/lex.c | 1 - .../g++.old-deja/g++.other/static13.C | 19 +++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/static13.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 47f3f7feb03..1ebe193a86a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2000-07-26 Mark Mitchell + + * decl.c (start_cleanup_fn): Mark the function as `inline'. + * decl2.c (get_guard): Call cp_finish_decl, not + rest_of_decl_compilation, for local guards. + * lex.c (do_identifier): Remove unused variable. + Wed Jul 26 15:05:51 CEST 2000 Marc Espie * parse.y: Add missing ';'. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index bfcc47e62c9..2f2d17b8fbe 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8362,6 +8362,11 @@ start_cleanup_fn () compiler. */ TREE_PUBLIC (fndecl) = 0; DECL_ARTIFICIAL (fndecl) = 1; + /* Make the function `inline' so that it is only emitted if it is + actually needed. It is unlikely that it will be inlined, since + it is only called via a function pointer, but we avoid unncessary + emissions this way. */ + DECL_INLINE (fndecl) = 1; /* Build the parameter. */ if (flag_use_cxa_atexit) { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 360805172ab..1211957391e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2866,7 +2866,7 @@ get_guard (decl) if (!flag_new_abi && !DECL_NAMESPACE_SCOPE_P (decl)) { guard = get_temp_name (integer_type_node); - rest_of_decl_compilation (guard, NULL_PTR, 0, 0); + cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0); return guard; } diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index b29f6d2861e..fd9276b60a9 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -3071,7 +3071,6 @@ do_identifier (token, parsing, args) { register tree id; int lexing = (parsing == 1); - int in_call = (parsing == 2); if (! lexing || IDENTIFIER_OPNAME_P (token)) id = lookup_name (token, 0); diff --git a/gcc/testsuite/g++.old-deja/g++.other/static13.C b/gcc/testsuite/g++.old-deja/g++.other/static13.C new file mode 100644 index 00000000000..4ebffa6369c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/static13.C @@ -0,0 +1,19 @@ +// Build don't run: +// Origin: scott snyder + +struct Cleaner +{ + ~Cleaner() {} +}; + +template +void bar () +{ + static Cleaner cleanup; +} + + +inline +void foo() { bar(); } + +int main () {}