summaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-01 20:20:17 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-01 20:20:17 +0000
commitc6b4d6c105b46ecde17a3c6d39585400565eca95 (patch)
tree23d695967db0739592b64c0bbf0cab739a8530b7 /gcc/cp/mangle.c
parentb795d0cbbc2aab4453f3f9232f208fadac8f5a0c (diff)
downloadgcc-c6b4d6c105b46ecde17a3c6d39585400565eca95.tar.gz
Warn about mangled name change even if DECL_REALLY_EXTERN.
* mangle.c (mangle_decl): Warn about mangled name change even if DECL_REALLY_EXTERN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238966 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c60
1 files changed, 31 insertions, 29 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 29be7fde498..d1bf3effbd2 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3700,50 +3700,52 @@ mangle_decl (const tree decl)
SET_DECL_ASSEMBLER_NAME (decl, id);
if (id != DECL_NAME (decl)
- && !DECL_REALLY_EXTERN (decl)
/* Don't do this for a fake symbol we aren't going to emit anyway. */
&& TREE_CODE (decl) != TYPE_DECL
&& !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
&& !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
{
- bool set = false;
+ int save_ver = flag_abi_version;
+ tree id2 = NULL_TREE;
- /* Check IDENTIFIER_GLOBAL_VALUE before setting to avoid redundant
- errors from multiple definitions. */
- tree d = IDENTIFIER_GLOBAL_VALUE (id);
- if (!d || decl_implicit_alias_p (d))
+ if (!DECL_REALLY_EXTERN (decl))
{
- set = true;
- SET_IDENTIFIER_GLOBAL_VALUE (id, decl);
- }
+ bool set = false;
- if (!G.need_abi_warning)
- return;
+ /* Check IDENTIFIER_GLOBAL_VALUE before setting to avoid redundant
+ errors from multiple definitions. */
+ tree d = IDENTIFIER_GLOBAL_VALUE (id);
+ if (!d || decl_implicit_alias_p (d))
+ {
+ set = true;
+ SET_IDENTIFIER_GLOBAL_VALUE (id, decl);
+ }
- /* If the mangling will change in the future, emit an alias with the
- future mangled name for forward-compatibility. */
- int save_ver;
- tree id2;
+ if (!G.need_abi_warning)
+ return;
- if (!set)
- {
- SET_IDENTIFIER_GLOBAL_VALUE (id, decl);
- inform (DECL_SOURCE_LOCATION (decl), "a later -fabi-version= (or "
- "=0) avoids this error with a change in mangling");
- }
-
- save_ver = flag_abi_version;
+ /* If the mangling will change in the future, emit an alias with the
+ future mangled name for forward-compatibility. */
+ if (!set)
+ {
+ SET_IDENTIFIER_GLOBAL_VALUE (id, decl);
+ inform (DECL_SOURCE_LOCATION (decl), "a later -fabi-version= (or "
+ "=0) avoids this error with a change in mangling");
+ }
- flag_abi_version = flag_abi_compat_version;
- id2 = mangle_decl_string (decl);
- id2 = targetm.mangle_decl_assembler_name (decl, id2);
+ flag_abi_version = flag_abi_compat_version;
+ id2 = mangle_decl_string (decl);
+ id2 = targetm.mangle_decl_assembler_name (decl, id2);
+ flag_abi_version = save_ver;
- if (id2 != id)
- note_mangling_alias (decl, id2);
+ if (id2 != id)
+ note_mangling_alias (decl, id2);
+ }
if (warn_abi)
{
- if (flag_abi_compat_version != warn_abi_version)
+ if (flag_abi_compat_version != warn_abi_version
+ || id2 == NULL_TREE)
{
flag_abi_version = warn_abi_version;
id2 = mangle_decl_string (decl);