This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for PCH in start_cleanup_fn


This is the final patch I committed.  Bootstrapped & tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/apinski-pchcleanupfn.patch================
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3407
diff -u -p -u -p -r1.3407 ChangeLog
--- cp/ChangeLog	9 Jun 2003 18:47:39 -0000	1.3407
+++ cp/ChangeLog	10 Jun 2003 18:27:13 -0000
@@ -1,3 +1,8 @@
+2003-06-06  Andrew Pinski  <pinskia@physics.uc.edu>
+
+	* decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY.
+	(start_cleanup_cnt): New.
+
 2003-06-09  Zack Weinberg  <zack@codesourcery.com>
 
 	PR 8861
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1062
diff -u -p -u -p -r1.1062 decl.c
--- cp/decl.c	7 Jun 2003 17:28:00 -0000	1.1062
+++ cp/decl.c	10 Jun 2003 18:27:14 -0000
@@ -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: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.2751
diff -u -p -u -p -r1.2751 ChangeLog
--- testsuite/ChangeLog	9 Jun 2003 23:04:49 -0000	1.2751
+++ testsuite/ChangeLog	10 Jun 2003 18:27:15 -0000
@@ -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-05-21  David Taylor  <dtaylor@emc.com>
 
 	* gcc.dg/Wpadded.c: New file.
Index: testsuite/g++.dg/pch/static-1.C
===================================================================
RCS file: testsuite/g++.dg/pch/static-1.C
diff -N testsuite/g++.dg/pch/static-1.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/pch/static-1.C	10 Jun 2003 18:27:38 -0000
@@ -0,0 +1,10 @@
+#include "static-1.H"
+int LocalStaticTest()
+{
+        static A sa;
+}
+
+int main(int argc, char **argv)
+{
+        A::StaticTest();
+}
Index: testsuite/g++.dg/pch/static-1.Hs
===================================================================
RCS file: testsuite/g++.dg/pch/static-1.Hs
diff -N testsuite/g++.dg/pch/static-1.Hs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/pch/static-1.Hs	10 Jun 2003 18:27:38 -0000
@@ -0,0 +1,13 @@
+class A
+{
+public:
+        int val;
+
+        ~A() {
+                int i = 2;
+        }
+
+        static void StaticTest() {
+                static A a;
+        }
+};
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]