mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-17 08:48:55 +08:00
cp-tree.h (lang_decl_flags): Rename saved_inline to deferred.
* cp-tree.h (lang_decl_flags): Rename saved_inline to deferred. (DECL_SAVED_INLINE): Rename to ... (DECL_DEFERRED_FN): ... this. (in_function_p): Remove declaration. (mark_inline_for_output): Rename to ... (defer_fn): ... this. * decl.c (finish_function): Adjust call to mark_inline_for_output. (in_function_p): Remove definition. * decl2.c (saved_inlines): Rename to ... (deferred_fns): ... this. (saved_inlines_used): Rename to ... (deferred_fns_used): ... this. (mark_inline_for_output): Rename to ... (defer_fn): ... this. (finish_file): Adjust accordingly. (init_decl2): Likewise. * lex.c (cons_up_default_function): Likewise. * pt.c (mark_decl_instantiated): Likewise. (instantiate_decl): Don't set DECL_DEFER_OUTPUT under any circumstances. * rtti.c (get_tinfo_decl): Adjust call to mark_inline_for_output. * semantics.c (expand_body): Defer more functions. From-SVN: r32973
This commit is contained in:
parent
1573b93398
commit
56e770bfd6
@ -1,3 +1,28 @@
|
||||
2000-04-06 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* cp-tree.h (lang_decl_flags): Rename saved_inline to deferred.
|
||||
(DECL_SAVED_INLINE): Rename to ...
|
||||
(DECL_DEFERRED_FN): ... this.
|
||||
(in_function_p): Remove declaration.
|
||||
(mark_inline_for_output): Rename to ...
|
||||
(defer_fn): ... this.
|
||||
* decl.c (finish_function): Adjust call to mark_inline_for_output.
|
||||
(in_function_p): Remove definition.
|
||||
* decl2.c (saved_inlines): Rename to ...
|
||||
(deferred_fns): ... this.
|
||||
(saved_inlines_used): Rename to ...
|
||||
(deferred_fns_used): ... this.
|
||||
(mark_inline_for_output): Rename to ...
|
||||
(defer_fn): ... this.
|
||||
(finish_file): Adjust accordingly.
|
||||
(init_decl2): Likewise.
|
||||
* lex.c (cons_up_default_function): Likewise.
|
||||
* pt.c (mark_decl_instantiated): Likewise.
|
||||
(instantiate_decl): Don't set DECL_DEFER_OUTPUT under any
|
||||
circumstances.
|
||||
* rtti.c (get_tinfo_decl): Adjust call to mark_inline_for_output.
|
||||
* semantics.c (expand_body): Defer more functions.
|
||||
|
||||
2000-04-06 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* rtti.c (dfs_class_hint_mark): New static function.
|
||||
|
@ -1830,7 +1830,7 @@ struct lang_decl_flags
|
||||
unsigned constructor_for_vbase_attr : 1;
|
||||
|
||||
unsigned mutable_flag : 1;
|
||||
unsigned saved_inline : 1;
|
||||
unsigned deferred : 1;
|
||||
unsigned use_template : 2;
|
||||
unsigned nonconverting : 1;
|
||||
unsigned declared_inline : 1;
|
||||
@ -2104,9 +2104,9 @@ struct lang_decl
|
||||
#define DECL_SORTED_FIELDS(NODE) \
|
||||
(DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields)
|
||||
|
||||
/* True if on the saved_inlines (see decl2.c) list. */
|
||||
#define DECL_SAVED_INLINE(DECL) \
|
||||
(DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
|
||||
/* True if on the deferred_fns (see decl2.c) list. */
|
||||
#define DECL_DEFERRED_FN(DECL) \
|
||||
(DECL_LANG_SPECIFIC(DECL)->decl_flags.deferred)
|
||||
|
||||
/* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL:
|
||||
template-specific information. */
|
||||
@ -3837,7 +3837,6 @@ extern tree maybe_build_cleanup_and_delete PARAMS ((tree));
|
||||
extern tree maybe_build_cleanup PARAMS ((tree));
|
||||
extern void cplus_expand_expr_stmt PARAMS ((tree));
|
||||
extern void finish_stmt PARAMS ((void));
|
||||
extern int in_function_p PARAMS ((void));
|
||||
extern void replace_defarg PARAMS ((tree, tree));
|
||||
extern void print_other_binding_stack PARAMS ((struct binding_level *));
|
||||
extern void revert_static_member_fn PARAMS ((tree));
|
||||
@ -3898,7 +3897,7 @@ extern void cplus_decl_attributes PARAMS ((tree, tree, tree));
|
||||
extern tree constructor_name_full PARAMS ((tree));
|
||||
extern tree constructor_name PARAMS ((tree));
|
||||
extern void setup_vtbl_ptr PARAMS ((void));
|
||||
extern void mark_inline_for_output PARAMS ((tree));
|
||||
extern void defer_fn PARAMS ((tree));
|
||||
extern tree get_temp_name PARAMS ((tree, int));
|
||||
extern void finish_anon_union PARAMS ((tree));
|
||||
extern tree finish_table PARAMS ((tree, tree, tree, int));
|
||||
|
@ -14153,7 +14153,7 @@ finish_function (lineno, flags)
|
||||
if (! DECL_EXTERNAL (fndecl))
|
||||
DECL_NOT_REALLY_EXTERN (fndecl) = 1;
|
||||
DECL_EXTERNAL (fndecl) = 1;
|
||||
mark_inline_for_output (fndecl);
|
||||
defer_fn (fndecl);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -14670,13 +14670,6 @@ mark_cp_function_context (f)
|
||||
mark_lang_function (f->language);
|
||||
}
|
||||
|
||||
int
|
||||
in_function_p ()
|
||||
{
|
||||
return function_depth != 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
lang_mark_false_label_stack (l)
|
||||
struct label_node *l;
|
||||
|
@ -108,9 +108,9 @@ static varray_type pending_statics;
|
||||
|
||||
/* A list of functions which were declared inline, but which we
|
||||
may need to emit outline anyway. */
|
||||
static varray_type saved_inlines;
|
||||
#define saved_inlines_used \
|
||||
(saved_inlines ? saved_inlines->elements_used : 0)
|
||||
static varray_type deferred_fns;
|
||||
#define deferred_fns_used \
|
||||
(deferred_fns ? deferred_fns->elements_used : 0)
|
||||
|
||||
/* Same, but not reset. Local temp variables and global temp variables
|
||||
can have the same name. */
|
||||
@ -1976,20 +1976,20 @@ constructor_name (thing)
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Record the existence of an addressable inline function. */
|
||||
/* Defer the compilation of the FN until the end of compilation. */
|
||||
|
||||
void
|
||||
mark_inline_for_output (decl)
|
||||
tree decl;
|
||||
defer_fn (fn)
|
||||
tree fn;
|
||||
{
|
||||
decl = DECL_MAIN_VARIANT (decl);
|
||||
if (DECL_SAVED_INLINE (decl))
|
||||
fn = DECL_MAIN_VARIANT (fn);
|
||||
if (DECL_DEFERRED_FN (fn))
|
||||
return;
|
||||
DECL_SAVED_INLINE (decl) = 1;
|
||||
if (!saved_inlines)
|
||||
VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines");
|
||||
DECL_DEFERRED_FN (fn) = 1;
|
||||
if (!deferred_fns)
|
||||
VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
|
||||
|
||||
VARRAY_PUSH_TREE (saved_inlines, decl);
|
||||
VARRAY_PUSH_TREE (deferred_fns, fn);
|
||||
}
|
||||
|
||||
/* Hand off a unique name which can be used for variable we don't really
|
||||
@ -3537,9 +3537,9 @@ finish_file ()
|
||||
|
||||
/* Go through the various inline functions, and see if any need
|
||||
synthesizing. */
|
||||
for (i = 0; i < saved_inlines_used; ++i)
|
||||
for (i = 0; i < deferred_fns_used; ++i)
|
||||
{
|
||||
tree decl = VARRAY_TREE (saved_inlines, i);
|
||||
tree decl = VARRAY_TREE (deferred_fns, i);
|
||||
import_export_decl (decl);
|
||||
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
|
||||
&& TREE_USED (decl)
|
||||
@ -3569,9 +3569,9 @@ finish_file ()
|
||||
from being put out unncessarily. But, we must stop lying
|
||||
when the functions are referenced, or if they are not comdat
|
||||
since they need to be put out now. */
|
||||
for (i = 0; i < saved_inlines_used; ++i)
|
||||
for (i = 0; i < deferred_fns_used; ++i)
|
||||
{
|
||||
tree decl = VARRAY_TREE (saved_inlines, i);
|
||||
tree decl = VARRAY_TREE (deferred_fns, i);
|
||||
|
||||
if (DECL_NOT_REALLY_EXTERN (decl)
|
||||
&& DECL_INITIAL (decl)
|
||||
@ -3609,9 +3609,9 @@ finish_file ()
|
||||
}
|
||||
}
|
||||
|
||||
if (saved_inlines_used
|
||||
&& wrapup_global_declarations (&VARRAY_TREE (saved_inlines, 0),
|
||||
saved_inlines_used))
|
||||
if (deferred_fns_used
|
||||
&& wrapup_global_declarations (&VARRAY_TREE (deferred_fns, 0),
|
||||
deferred_fns_used))
|
||||
reconsider = 1;
|
||||
if (walk_namespaces (wrapup_globals_for_namespace, /*data=*/0))
|
||||
reconsider = 1;
|
||||
@ -5302,7 +5302,7 @@ void
|
||||
init_decl2 ()
|
||||
{
|
||||
ggc_add_tree_root (&decl_namespace_list, 1);
|
||||
ggc_add_tree_varray_root (&saved_inlines, 1);
|
||||
ggc_add_tree_varray_root (&deferred_fns, 1);
|
||||
ggc_add_tree_varray_root (&pending_statics, 1);
|
||||
ggc_add_tree_varray_root (&ssdf_decls, 1);
|
||||
ggc_add_tree_root (&ssdf_decl, 1);
|
||||
|
@ -2085,7 +2085,7 @@ cons_up_default_function (type, full_name, kind)
|
||||
#endif
|
||||
DECL_NOT_REALLY_EXTERN (fn) = 1;
|
||||
|
||||
mark_inline_for_output (fn);
|
||||
defer_fn (fn);
|
||||
|
||||
#ifdef DEBUG_DEFAULT_FUNCTIONS
|
||||
{ char *fn_type = NULL;
|
||||
|
23
gcc/cp/pt.c
23
gcc/cp/pt.c
@ -8688,7 +8688,7 @@ mark_decl_instantiated (result, extern_p)
|
||||
maybe_make_one_only (result);
|
||||
}
|
||||
else if (TREE_CODE (result) == FUNCTION_DECL)
|
||||
mark_inline_for_output (result);
|
||||
defer_fn (result);
|
||||
}
|
||||
|
||||
/* Given two function templates PAT1 and PAT2, and explicit template
|
||||
@ -9391,11 +9391,9 @@ instantiate_decl (d, defer_ok)
|
||||
tree code_pattern;
|
||||
tree spec;
|
||||
tree gen_tmpl;
|
||||
int nested = in_function_p ();
|
||||
int pattern_defined;
|
||||
int line = lineno;
|
||||
char *file = input_filename;
|
||||
tree old_fn = current_function_decl;
|
||||
|
||||
/* This function should only be used to instantiate templates for
|
||||
functions and static member variables. */
|
||||
@ -9547,25 +9545,6 @@ instantiate_decl (d, defer_ok)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* If this instantiation is COMDAT, we don't know whether or not we
|
||||
will really need to write it out. If we can't be sure, mark it
|
||||
DECL_DEFER_OUTPUT. NOTE: This increases memory consumption,
|
||||
since we keep some instantiations in memory rather than write
|
||||
them out immediately and forget them. A better approach would be
|
||||
to wait until we know we need them to do the instantiation, but
|
||||
that would break templates with static locals, because we
|
||||
generate the functions to destroy statics before we determine
|
||||
which functions are needed. A better solution would be to
|
||||
generate the ctor and dtor functions as we go. */
|
||||
|
||||
if (TREE_CODE (d) == FUNCTION_DECL
|
||||
&& DECL_COMDAT (d)
|
||||
&& ! DECL_NEEDED_P (d)
|
||||
/* If the function that caused us to be instantiated is needed, we
|
||||
will be needed, too. */
|
||||
&& (! nested || (old_fn && ! DECL_NEEDED_P (old_fn))))
|
||||
DECL_DEFER_OUTPUT (d) = 1;
|
||||
|
||||
/* We're now committed to instantiating this template. Mark it as
|
||||
instantiated so that recursive calls to instantiate_decl do not
|
||||
try to instantiate it again. */
|
||||
|
@ -413,7 +413,7 @@ get_tinfo_decl (type)
|
||||
DECL_NOT_REALLY_EXTERN (d) = 1;
|
||||
SET_DECL_TINFO_FN_P (d);
|
||||
TREE_TYPE (name) = type;
|
||||
mark_inline_for_output (d);
|
||||
defer_fn (d);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2727,17 +2727,12 @@ expand_body (fn)
|
||||
/* If possible, avoid generating RTL for this function. Instead,
|
||||
just record it as an inline function, and wait until end-of-file
|
||||
to decide whether to write it out or not. */
|
||||
if (/* We have to generate RTL if we can't inline trees. */
|
||||
flag_inline_trees
|
||||
/* Or if it's not an inline function. */
|
||||
&& DECL_INLINE (fn)
|
||||
if (/* We have to generate RTL if it's not an inline function. */
|
||||
(DECL_INLINE (fn) || DECL_COMDAT (fn))
|
||||
/* Or if we have to keep all inline functions anyhow. */
|
||||
&& !flag_keep_inline_functions
|
||||
/* Or if we actually have a reference to the function. */
|
||||
&& !DECL_NEEDED_P (fn)
|
||||
/* Or if we're at the end-of-file, and this function is not
|
||||
DECL_COMDAT. */
|
||||
&& (!at_eof || DECL_COMDAT (fn))
|
||||
/* Or if this is a nested function. */
|
||||
&& !decl_function_context (fn))
|
||||
{
|
||||
@ -2753,7 +2748,7 @@ expand_body (fn)
|
||||
}
|
||||
/* Remember this function. In finish_file we'll decide if
|
||||
we actually need to write this function out. */
|
||||
mark_inline_for_output (fn);
|
||||
defer_fn (fn);
|
||||
/* Let the back-end know that this funtion exists. */
|
||||
note_deferral_of_defined_inline_function (fn);
|
||||
return;
|
||||
|
@ -25,10 +25,10 @@ struct00 global_function_1 () {
|
||||
struct struct0 {
|
||||
|
||||
int struct0_member_function_0 () {
|
||||
} // ERROR -
|
||||
} // ERROR - XFAIL
|
||||
|
||||
struct0 struct0_member_function_1 () {
|
||||
} // ERROR -
|
||||
} // ERROR - XFAIL
|
||||
};
|
||||
|
||||
struct struct1 {
|
||||
|
@ -3,7 +3,7 @@
|
||||
int status = 1;
|
||||
|
||||
struct foo {
|
||||
foo& operator= (const foo&) { status = 0; }
|
||||
foo& operator= (const foo&) { status = 0; return *this; }
|
||||
};
|
||||
|
||||
struct xx {
|
||||
|
@ -8,7 +8,7 @@ class Y
|
||||
{
|
||||
public:
|
||||
Y(char*) {}
|
||||
Y& operator = (const Y&) {}
|
||||
Y& operator = (const Y&) { return *this; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ int pass = 0;
|
||||
struct A {
|
||||
A(void) {}
|
||||
A(const A& a) { ; }
|
||||
A& operator = (const A& a) { pass = 1; }
|
||||
A& operator = (const A& a) { pass = 1; return *this; }
|
||||
};
|
||||
|
||||
struct B {
|
||||
|
@ -8,5 +8,5 @@
|
||||
// Message-ID: <9304291053.AA00090@mencon>
|
||||
|
||||
struct A {
|
||||
A& operator = (const A& a) {}// ERROR -
|
||||
A& operator = (const A& a) {}// ERROR - XFAIL
|
||||
};
|
||||
|
@ -4,8 +4,8 @@ extern "C" int printf(const char *, ...);
|
||||
|
||||
class A {
|
||||
public:
|
||||
int foo() { printf("ok nv\n"); }
|
||||
virtual int vfoo() { printf("ok v\n"); }
|
||||
int foo() { printf("ok nv\n"); return 0; }
|
||||
virtual int vfoo() { printf("ok v\n"); return 0; }
|
||||
};
|
||||
|
||||
struct S {
|
||||
|
@ -3,7 +3,7 @@
|
||||
class B {
|
||||
public:
|
||||
int Bi;
|
||||
virtual int g() { };
|
||||
virtual int g() { return 0; };
|
||||
};
|
||||
|
||||
class D : private B {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
class C_A {
|
||||
public:
|
||||
virtual int foo(void *) { }
|
||||
virtual int foo(void *) { return 0; }
|
||||
} a;
|
||||
|
||||
class C_B : public C_A {
|
||||
@ -17,22 +17,22 @@ class C_D : public C_A {
|
||||
|
||||
class C_E : public C_C, public C_B {
|
||||
public:
|
||||
virtual int foo(void *) { }
|
||||
virtual int foo(void *) { return 0; }
|
||||
} e;
|
||||
|
||||
class C_F : public C_D, public C_B {
|
||||
public:
|
||||
virtual int foo(void *) { }
|
||||
virtual int foo(void *) { return 0; }
|
||||
} f;
|
||||
|
||||
class C_G : public C_A {
|
||||
public:
|
||||
virtual int foo(void *) { }
|
||||
virtual int foo(void *) { return 0; }
|
||||
} g;
|
||||
|
||||
class C_H : public C_G, public C_E, public C_F {
|
||||
public:
|
||||
virtual int foo(void *) { }
|
||||
virtual int foo(void *) { return 0; }
|
||||
} h;
|
||||
|
||||
int main() {
|
||||
|
Loading…
Reference in New Issue
Block a user