summaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2007-02-11 18:58:05 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2007-02-11 18:58:05 +0000
commit56fd65c7d9a3fd9ab80a627eb6caf24483801ff5 (patch)
tree37425a6a59c6e2da923d37b739cbb1c65f2cfbd9 /gcc/tree.h
parentf57d17f1fc2f31047644ed6f18f1087f65f8f88b (diff)
downloadgcc-56fd65c7d9a3fd9ab80a627eb6caf24483801ff5.tar.gz
re PR target/29487 (Shared libstdc++ fails to link)
PR target/29487 * tree.h (DECL_REPLACEABLE_P): New macro. * except.c (set_nothrow_function_flags): Likewise. PR target/29487 * decl.c (finish_function): Use DECL_REPLACEABLE. * tree.c (cp_cannot_inline_tree_fn): Likewise. PR c++/29487 * g++.dg/eh/weak1-C: New test. * g++.dg/eh/weak1-a.cc: Likewise. * g++.dg/eh/comdat1.C: Likewise. From-SVN: r121819
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 26e0676d0c2..c672d94d0c0 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2901,6 +2901,26 @@ extern void decl_restrict_base_insert (tree, tree);
something which is DECL_COMDAT. */
#define DECL_COMDAT(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_flag)
+/* A replaceable function is one which may be replaced at link-time
+ with an entirely different definition, provided that the
+ replacement has the same type. For example, functions declared
+ with __attribute__((weak)) on most systems are replaceable.
+
+ COMDAT functions are not replaceable, since all definitions of the
+ function must be equivalent. It is important that COMDAT functions
+ not be treated as replaceable so that use of C++ template
+ instantiations is not penalized.
+
+ For example, DECL_REPLACEABLE is used to determine whether or not a
+ function (including a template instantiation) which is not
+ explicitly declared "inline" can be inlined. If the function is
+ DECL_REPLACEABLE then it is not safe to do the inlining, since the
+ implementation chosen at link-time may be different. However, a
+ function that is not DECL_REPLACEABLE can be inlined, since all
+ versions of the function will be functionally identical. */
+#define DECL_REPLACEABLE_P(NODE) \
+ (!DECL_COMDAT (NODE) && !targetm.binds_local_p (NODE))
+
/* The name of the object as the assembler will see it (but before any
translations made by ASM_OUTPUT_LABELREF). Often this is the same
as DECL_NAME. It is an IDENTIFIER_NODE. */