From 56fd65c7d9a3fd9ab80a627eb6caf24483801ff5 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 11 Feb 2007 18:58:05 +0000 Subject: 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 --- gcc/tree.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gcc/tree.h') 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. */ -- cgit v1.2.1