[multiple changes]
authorGeoffrey Keating <geoffk@gcc.gnu.org>
Tue, 10 Jun 2003 18:32:57 +0000 (18:32 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Tue, 10 Jun 2003 18:32:57 +0000 (18:32 +0000)
2003-06-10  Andrew Pinski  <pinskia@physics.uc.edu>

* decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY.
(start_cleanup_cnt): New.

2003-06-10  Geoffrey Keating  <geoffk@apple.com>

* g++.dg/pch/static-1.C: New file.
* g++.dg/pch/static-1.Hs: New file.

From-SVN: r67719

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pch/static-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pch/static-1.Hs [new file with mode: 0644]

index 0de9c7b840d8c8ba63d2c924300345e13ab57285..155a2f1e7c5ccde8ef2c15cc76c57fbd1649ce79 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-10  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       * decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY.
+       (start_cleanup_cnt): New.
+
 2003-06-10  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/11131
index 1807d05f5a0f406d9bcb7f374e26158e96fc68c9..1340640bc22001021da942f4caf5a38295069b99 100644 (file)
@@ -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
index f39da11ac9670b6be308ba2b9083ba9cc89d5da3..f9e8c6eb7e4c17576c9f211aceef484124869159 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-10  Geoffrey Keating  <geoffk@apple.com>
+
+       * g++.dg/pch/static-1.C: New file.
+       * g++.dg/pch/static-1.Hs: New file.
+
 2003-06-10  Richard Henderson  <rth@redhat.com>
 
        * 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 (file)
index 0000000..21e7789
--- /dev/null
@@ -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 (file)
index 0000000..d277b78
--- /dev/null
@@ -0,0 +1,13 @@
+class A
+{
+public:
+        int val;
+
+        ~A() {
+                int i = 2;
+        }
+
+        static void StaticTest() {
+                static A a;
+        }
+};