diff options
author | Jason Merrill <jason@redhat.com> | 2016-02-19 01:25:05 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-02-19 01:25:05 -0500 |
commit | 747b61fcb3b3afbb7300afc0c0b4cd6bcc10608c (patch) | |
tree | e194a1323865025cd46f4bcc67147d1d564fac21 /gcc/cp | |
parent | 654f089a925617d225457e18d4482ba553742735 (diff) | |
download | gcc-747b61fcb3b3afbb7300afc0c0b4cd6bcc10608c.zip gcc-747b61fcb3b3afbb7300afc0c0b4cd6bcc10608c.tar.gz gcc-747b61fcb3b3afbb7300afc0c0b4cd6bcc10608c.tar.bz2 |
mangle.c (maybe_check_abi_tags): Add for_decl parm.
* mangle.c (maybe_check_abi_tags): Add for_decl parm. Call
mangle_decl.
(mangle_decl): Call maybe_check_abi_tags for function scope.
(mangle_guard_variable): Call maybe_check_abi_tags here.
(write_guarded_var_name): Not here.
From-SVN: r233544
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 43 |
2 files changed, 35 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 18f8072..96150be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-02-18 Jason Merrill <jason@redhat.com> + + * mangle.c (maybe_check_abi_tags): Add for_decl parm. Call + mangle_decl. + (mangle_decl): Call maybe_check_abi_tags for function scope. + (mangle_guard_variable): Call maybe_check_abi_tags here. + (write_guarded_var_name): Not here. + 2016-02-17 Jason Merrill <jason@redhat.com> PR c++/65985 diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 410c7f4..5d38373 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -223,6 +223,7 @@ static void write_local_name (tree, const tree, const tree); static void dump_substitution_candidates (void); static tree mangle_decl_string (const tree); static int local_class_index (tree); +static void maybe_check_abi_tags (tree, tree = NULL_TREE); /* Control functions. */ @@ -3599,6 +3600,9 @@ mangle_decl (const tree decl) { gcc_assert (TREE_CODE (decl) != TYPE_DECL || !no_linkage_check (TREE_TYPE (decl), true)); + if (abi_version_at_least (10)) + if (tree fn = decl_function_context (decl)) + maybe_check_abi_tags (fn, decl); id = get_mangled_id (decl); } SET_DECL_ASSEMBLER_NAME (decl, id); @@ -3937,26 +3941,39 @@ mangle_conv_op_name_for_type (const tree type) /* Handle ABI backwards compatibility for past bugs where we didn't call check_abi_tags in places where it's needed: call check_abi_tags and warn if - it makes a difference. */ + it makes a difference. If FOR_DECL is non-null, it's the declaration + that we're actually trying to mangle; if it's null, we're mangling the + guard variable for T. */ static void -maybe_check_abi_tags (tree t) +maybe_check_abi_tags (tree t, tree for_decl) { + if (DECL_ASSEMBLER_NAME_SET_P (t)) + return; + tree attr = lookup_attribute ("abi_tag", DECL_ATTRIBUTES (t)); tree oldtags = NULL_TREE; if (attr) oldtags = TREE_VALUE (attr); - check_abi_tags (t); + mangle_decl (t); if (!attr) attr = lookup_attribute ("abi_tag", DECL_ATTRIBUTES (t)); if (attr && TREE_VALUE (attr) != oldtags && abi_version_crosses (10)) - warning_at (DECL_SOURCE_LOCATION (t), OPT_Wabi, - "the mangled name of the initialization guard variable for" - "%qD changes between -fabi-version=%d and -fabi-version=%d", - t, flag_abi_version, warn_abi_version); + { + if (for_decl) + warning_at (DECL_SOURCE_LOCATION (for_decl), OPT_Wabi, + "the mangled name of %qD changes between " + "-fabi-version=%d and -fabi-version=%d", + for_decl, flag_abi_version, warn_abi_version); + else + warning_at (DECL_SOURCE_LOCATION (t), OPT_Wabi, + "the mangled name of the initialization guard variable for" + "%qD changes between -fabi-version=%d and -fabi-version=%d", + t, flag_abi_version, warn_abi_version); + } } /* Write out the appropriate string for this variable when generating @@ -3971,15 +3988,7 @@ write_guarded_var_name (const tree variable) to the reference, not the temporary. */ write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4); else - { - /* Before ABI v10 we were failing to call check_abi_tags here. So if - we're in pre-10 mode, wait until after write_name to call it. */ - if (abi_version_at_least (10)) - maybe_check_abi_tags (variable); - write_name (variable, /*ignore_local_scope=*/0); - if (!abi_version_at_least (10)) - maybe_check_abi_tags (variable); - } + write_name (variable, /*ignore_local_scope=*/0); } /* Return an identifier for the name of an initialization guard @@ -3988,6 +3997,8 @@ write_guarded_var_name (const tree variable) tree mangle_guard_variable (const tree variable) { + if (abi_version_at_least (10)) + maybe_check_abi_tags (variable); start_mangling (variable); write_string ("_ZGV"); write_guarded_var_name (variable); |