aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-01-23 19:52:08 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2002-01-23 19:52:08 +0100
commit0a01c261ff1b467cb5c706858bd444c34000fb1a (patch)
treec6469789b3d8aaa2118368d0a251ac21514b6795
parent1398974cb30a775ca0d8fccd9b86a2cdb77fb654 (diff)
downloadgcc-0a01c261ff1b467cb5c706858bd444c34000fb1a.zip
gcc-0a01c261ff1b467cb5c706858bd444c34000fb1a.tar.gz
gcc-0a01c261ff1b467cb5c706858bd444c34000fb1a.tar.bz2
spew.c (pending_inlines, [...]): Make static.
* spew.c (pending_inlines, pending_inlines_tail, processing_these_inlines): Make static. (mark_pending_inlines): Remove static. (begin_parsing_inclass_inline): If in function, save pi for GC to cp_function_chain->unparsed_inlines instead. (process_next_inline): Likewise. * cp-tree.h (struct cp_language_function): Add unparsed_inlines. (mark_pending_inlines): Add prototype. * decl.c (spew_debug): Remove unused extern. (mark_lang_function): Call mark_pending_inlines. * g++.dg/other/gc1.C: New test. From-SVN: r49147
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/spew.c21
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/gc1.C49
6 files changed, 84 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9c6fce3..f2c1791 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,16 @@
+2002-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ * spew.c (pending_inlines, pending_inlines_tail,
+ processing_these_inlines): Make static.
+ (mark_pending_inlines): Remove static.
+ (begin_parsing_inclass_inline): If in function, save pi
+ for GC to cp_function_chain->unparsed_inlines instead.
+ (process_next_inline): Likewise.
+ * cp-tree.h (struct cp_language_function): Add unparsed_inlines.
+ (mark_pending_inlines): Add prototype.
+ * decl.c (spew_debug): Remove unused extern.
+ (mark_lang_function): Call mark_pending_inlines.
+
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 99f7bf7..8c075c5 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -801,6 +801,8 @@ struct saved_scope
extern struct saved_scope *scope_chain;
+struct unparsed_text;
+
/* Global state pertinent to the current function. */
struct cp_language_function
@@ -828,6 +830,7 @@ struct cp_language_function
varray_type x_local_names;
const char *cannot_inline;
+ struct unparsed_text *unparsed_inlines;
};
/* The current C++-specific per-function global variables. */
@@ -1781,8 +1784,6 @@ struct lang_decl_flags
} u2;
};
-struct unparsed_text;
-
struct lang_decl
{
struct lang_decl_flags decl_flags;
@@ -4193,6 +4194,7 @@ extern tree finish_global_stmt_expr PARAMS ((tree));
/* in spew.c */
extern void init_spew PARAMS ((void));
+extern void mark_pending_inlines PARAMS ((PTR));
extern int peekyylex PARAMS ((void));
extern tree arbitrate_lookup PARAMS ((tree, tree, tree));
extern tree frob_opname PARAMS ((tree));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 3747cab..3521113 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -288,10 +288,6 @@ extern int flag_conserve_space;
/* C and C++ flags are in decl2.c. */
-/* Flag used when debugging spew.c */
-
-extern int spew_debug;
-
/* A expression of value 0 with the same precision as a sizetype
node, but signed. */
tree signed_size_zero_node;
@@ -14607,6 +14603,7 @@ mark_lang_function (p)
mark_named_label_lists (&p->x_named_labels, &p->x_named_label_uses);
mark_binding_level (&p->bindings);
+ mark_pending_inlines (&p->unparsed_inlines);
}
/* Mark the language-specific data in F for GC. */
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index 74f89a0..e610aec 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -119,15 +119,14 @@ static int frob_id PARAMS ((int, int, tree *));
/* The list of inline functions being held off until we reach the end of
the current class declaration. */
-struct unparsed_text *pending_inlines;
-struct unparsed_text *pending_inlines_tail;
+static struct unparsed_text *pending_inlines;
+static struct unparsed_text *pending_inlines_tail;
/* The list of previously-deferred inline functions currently being parsed.
This exists solely to be a GC root. */
-struct unparsed_text *processing_these_inlines;
+static struct unparsed_text *processing_these_inlines;
static void begin_parsing_inclass_inline PARAMS ((struct unparsed_text *));
-static void mark_pending_inlines PARAMS ((PTR));
#ifdef SPEW_DEBUG
int spew_debug = 0;
@@ -416,7 +415,7 @@ end_input ()
}
/* GC callback to mark memory pointed to by the pending inline queue. */
-static void
+void
mark_pending_inlines (pi)
PTR pi;
{
@@ -950,8 +949,11 @@ begin_parsing_inclass_inline (pi)
tree context;
/* Record that we are processing the chain of inlines starting at
- PI in a special GC root. */
- processing_these_inlines = pi;
+ PI for GC. */
+ if (cfun)
+ cp_function_chain->unparsed_inlines = pi;
+ else
+ processing_these_inlines = pi;
ggc_collect ();
@@ -1025,7 +1027,10 @@ process_next_inline (i)
begin_parsing_inclass_inline (i);
else
{
- processing_these_inlines = 0;
+ if (cfun)
+ cp_function_chain->unparsed_inlines = 0;
+ else
+ processing_these_inlines = 0;
extract_interface_info ();
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 414c694..22bc8a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/other/gc1.C: New test.
+
2002-01-23 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/c99-intconst-1.c: Mark XFAIL.
diff --git a/gcc/testsuite/g++.dg/other/gc1.C b/gcc/testsuite/g++.dg/other/gc1.C
new file mode 100644
index 0000000..3c7a169
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/gc1.C
@@ -0,0 +1,49 @@
+// This test failed with GGC_ALWAYS_COLLECT because not all unparsed
+// inline methods were registered with GC.
+// { dg-do compile }
+
+const char *foo ()
+{
+ struct A
+ {
+ const char *a1 ()
+ {
+ return "a1";
+ }
+ const char *a2 ()
+ {
+ struct B
+ {
+ const char *b1 ()
+ {
+ return "b1";
+ }
+ const char *b2 ()
+ {
+ struct C
+ {
+ const char *c1 ()
+ {
+ return "c1";
+ }
+ const char *c2 ()
+ {
+ return "c2";
+ }
+ };
+ return "b2";
+ }
+ const char *b3 ()
+ {
+ return "b3";
+ }
+ };
+ return "a2";
+ }
+ const char *a3 ()
+ {
+ return "a3";
+ }
+ };
+ return "foo";
+}