diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ed727a9ea84..b90484fa6b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2000-02-26 Mark Mitchell + + * cp-tree.h (DECL_NEEDED_P): Tweak to correct usage before EOF. + (import_export_class): Remove declaration. + * decl2.c (import_export_class): Make it static. + * dump.c (dequeue_and_dump): Handle PREDECREMENT_EXPR, + PREINCREMENT_EXPR, POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, + EXPR_WITH_FILE_LOCATION. + * lex.c (check_newline): Tweak filename/lineno setting. + * semantics.c (begin_while_stmt): Fix typo in comment. + Sat Feb 26 19:50:23 2000 Richard Kenner * lang-options.h (-fmessage-length=): Add missing option. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 2342fd661f6..f3209186153 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2870,7 +2870,7 @@ extern int flag_new_for_scope; /* An integer indicating how many bytes should be subtracted from the vtable for the `this' pointer to find the vcall offset. (The vptr - is always located at offset zero from the `this' pointer.) If + is always located at offset zero from the f `this' pointer.) If zero, then there is no vcall offset. */ #define THUNK_VCALL_OFFSET(DECL) (DECL_FIELD_SIZE (DECL)) @@ -2878,9 +2878,11 @@ extern int flag_new_for_scope; definition. This is true when the back-end tells us that the symbol has been referenced in the generated code. If, however, we are not generating code, then it is also true when a symbol has - just been used somewhere, even if it's not really needed. */ + just been used somewhere, even if it's not really needed. We need + anything that isn't comdat, but we don't know for sure whether or + not something is comdat until end-of-file. */ #define DECL_NEEDED_P(DECL) \ - (! DECL_COMDAT (DECL) \ + ((at_eof && !DECL_COMDAT (DECL)) \ || (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL)))) \ || (flag_syntax_only && TREE_USED ((DECL)))) @@ -3831,7 +3833,6 @@ extern void finish_builtin_type PARAMS ((tree, const char *, extern tree coerce_new_type PARAMS ((tree)); extern tree coerce_delete_type PARAMS ((tree)); extern void comdat_linkage PARAMS ((tree)); -extern void import_export_class PARAMS ((tree)); extern void import_export_vtable PARAMS ((tree, tree, int)); extern void import_export_decl PARAMS ((tree)); extern tree build_cleanup PARAMS ((tree)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7e5a8835479..2f9c574249e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -91,6 +91,7 @@ static int generate_ctor_and_dtor_functions_for_priority PARAMS ((splay_tree_node, void *)); static tree prune_vars_needing_no_initialization PARAMS ((tree)); static void write_out_vars PARAMS ((tree)); +static void import_export_class PARAMS ((tree)); extern int current_class_depth; @@ -2440,13 +2441,20 @@ import_export_vtable (decl, type, final) /* Determine whether or not we want to specifically import or export CTYPE, using various heuristics. */ -void +static void import_export_class (ctype) tree ctype; { /* -1 for imported, 1 for exported. */ int import_export = 0; + /* It only makes sense to call this function at EOF. The reason is + that this function looks at whether or not the first non-inline + non-abstract virtual member function has been defined in this + translation unit. But, we can't possibly know that until we've + seen the entire translation unit. */ + my_friendly_assert (at_eof, 20000226); + if (CLASSTYPE_INTERFACE_KNOWN (ctype)) return; diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 7d7fed33a8e..dc8f7540120 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -804,6 +804,10 @@ dequeue_and_dump (di) case COMPONENT_REF: case COMPOUND_EXPR: case ARRAY_REF: + case PREDECREMENT_EXPR: + case PREINCREMENT_EXPR: + case POSTDECREMENT_EXPR: + case POSTINCREMENT_EXPR: /* These nodes are binary, but do not have code class `2'. */ dump_child ("op 0", TREE_OPERAND (t, 0)); dump_child ("op 1", TREE_OPERAND (t, 1)); @@ -858,6 +862,10 @@ dequeue_and_dump (di) dump_child ("args", TREE_OPERAND (t, 1)); dump_child ("decl", TREE_OPERAND (t, 2)); break; + + case EXPR_WITH_FILE_LOCATION: + dump_child ("expr", EXPR_WFL_NODE (t)); + break; default: /* There are no additional fields to print. */ diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index d0a2db74ecc..f522031a110 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -2630,13 +2630,15 @@ linenum: pop_srcloc (); input_file_stack->name = new_file; - lineno = l; debug_end_source_file (input_file_stack->line); } else error ("#-lines for entering and leaving files don't match"); } + input_filename = new_file; + lineno = l; + extract_interface_info (); /* skip the rest of this line. */ diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b1e6239f8ca..52ab681ea59 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -281,7 +281,7 @@ begin_while_stmt () return r; } -/* Process the COND of an if-statement, which may be given by +/* Process the COND of a while-statement, which may be given by WHILE_STMT. */ void diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline7.C b/gcc/testsuite/g++.old-deja/g++.other/inline7.C new file mode 100644 index 00000000000..c3f54398f13 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/inline7.C @@ -0,0 +1,16 @@ +// Origin: Mark Mitchell + +#include + +list li; + +void f () +{ + li.size (); +} + +int main () +{ + li.push_back (0); + f (); +}