From d192828ab610545ea373b5791fecbe6ba083c31d Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Tue, 10 Jun 2003 18:32:57 +0000 Subject: [multiple changes] 2003-06-10 Andrew Pinski * decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY. (start_cleanup_cnt): New. 2003-06-10 Geoffrey Keating * g++.dg/pch/static-1.C: New file. * g++.dg/pch/static-1.Hs: New file. From-SVN: r67719 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pch/static-1.C | 10 ++++++++++ gcc/testsuite/g++.dg/pch/static-1.Hs | 13 +++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pch/static-1.C create mode 100644 gcc/testsuite/g++.dg/pch/static-1.Hs (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0de9c7b..155a2f1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-06-10 Andrew Pinski + + * decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY. + (start_cleanup_cnt): New. + 2003-06-10 Mark Mitchell PR c++/11131 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1807d05..1340640 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8347,10 +8347,11 @@ get_dso_handle_node (void) /* Begin a new function with internal linkage whose job will be simply to destroy some particular variable. */ +static GTY(()) int start_cleanup_cnt; + static tree start_cleanup_fn (void) { - static int counter = 0; int old_interface_only = interface_only; int old_interface_unknown = interface_unknown; char name[32]; @@ -8377,7 +8378,7 @@ start_cleanup_fn (void) /* Build the function type itself. */ fntype = build_function_type (void_type_node, parmtypes); /* Build the name of the function. */ - sprintf (name, "__tcf_%d", counter++); + sprintf (name, "__tcf_%d", start_cleanup_cnt++); /* Build the function declaration. */ fndecl = build_lang_decl (FUNCTION_DECL, get_identifier (name), fntype); /* It's a function with internal linkage, generated by the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f39da11..f9e8c6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-06-10 Geoffrey Keating + + * g++.dg/pch/static-1.C: New file. + * g++.dg/pch/static-1.Hs: New file. + 2003-06-10 Richard Henderson * gcc.dg/asm-7.c: Adjust expected warning text. diff --git a/gcc/testsuite/g++.dg/pch/static-1.C b/gcc/testsuite/g++.dg/pch/static-1.C new file mode 100644 index 0000000..21e7789 --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/static-1.C @@ -0,0 +1,10 @@ +#include "static-1.H" +int LocalStaticTest() +{ + static A sa; +} + +int main(int argc, char **argv) +{ + A::StaticTest(); +} diff --git a/gcc/testsuite/g++.dg/pch/static-1.Hs b/gcc/testsuite/g++.dg/pch/static-1.Hs new file mode 100644 index 0000000..d277b78 --- /dev/null +++ b/gcc/testsuite/g++.dg/pch/static-1.Hs @@ -0,0 +1,13 @@ +class A +{ +public: + int val; + + ~A() { + int i = 2; + } + + static void StaticTest() { + static A a; + } +}; -- cgit v1.1