+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,
extern struct saved_scope *scope_chain;
+struct unparsed_text;
+
/* Global state pertinent to the current function. */
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. */
} u2;
};
-struct unparsed_text;
-
struct lang_decl
{
struct lang_decl_flags decl_flags;
/* 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));
\f
/* 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;
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. */
/* 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;
}
/* GC callback to mark memory pointed to by the pending inline queue. */
-static void
+void
mark_pending_inlines (pi)
PTR 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 ();
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 ();
}
}
+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.
--- /dev/null
+// 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";
+}