diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index adb6f13d98e..4c650c19c57 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2002-08-30 Richard Henderson + + * tree.c: Include target.h. + (cp_cannot_inline_tree_fn): Don't auto-inline functions that + don't bind locally. + * Makefile.in (tree.o): Update. + 2002-08-27 Mark Mitchell * class.c (layout_virtual_bases): Warn about bugs in G++ that diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index d174691e54e..3235149ab05 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -280,7 +280,7 @@ cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \ cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H) cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \ - insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h + insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H) cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H) cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6e092850762..b0bd4fea488 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */ #include "insn-config.h" #include "integrate.h" #include "tree-inline.h" +#include "target.h" static tree bot_manip PARAMS ((tree *, int *, void *)); static tree bot_replace PARAMS ((tree *, int *, void *)); @@ -2211,6 +2212,14 @@ cp_cannot_inline_tree_fn (fnp) return 1; } + /* Don't auto-inline anything that might not be bound within + this unit of translation. */ + if (!DECL_DECLARED_INLINE_P (fn) && !(*targetm.binds_local_p) (fn)) + { + DECL_UNINLINABLE (fn) = 1; + return 1; + } + if (varargs_function_p (fn)) { DECL_UNINLINABLE (fn) = 1;