mirror of git://gcc.gnu.org/git/gcc.git
PR c++/77379 - ABI tag on thunk
* mangle.c (maybe_check_abi_tags): Add version parm, handle thunks. (mangle_thunk): Add thunk parameter. * method.c (finish_thunk): Pass it. * cp-tree.h: Declare it. From-SVN: r239830
This commit is contained in:
parent
34cedad50c
commit
328eae1cb4
|
|
@ -1,3 +1,11 @@
|
||||||
|
2016-08-29 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/77379
|
||||||
|
* mangle.c (maybe_check_abi_tags): Add version parm, handle thunks.
|
||||||
|
(mangle_thunk): Add thunk parameter.
|
||||||
|
* method.c (finish_thunk): Pass it.
|
||||||
|
* cp-tree.h: Declare it.
|
||||||
|
|
||||||
2016-08-15 Jason Merrill <jason@redhat.com>
|
2016-08-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
Avoid calling a trivial default constructor.
|
Avoid calling a trivial default constructor.
|
||||||
|
|
|
||||||
|
|
@ -6802,7 +6802,7 @@ extern tree mangle_typeinfo_string_for_type (tree);
|
||||||
extern tree mangle_vtbl_for_type (tree);
|
extern tree mangle_vtbl_for_type (tree);
|
||||||
extern tree mangle_vtt_for_type (tree);
|
extern tree mangle_vtt_for_type (tree);
|
||||||
extern tree mangle_ctor_vtbl_for_type (tree, tree);
|
extern tree mangle_ctor_vtbl_for_type (tree, tree);
|
||||||
extern tree mangle_thunk (tree, int, tree, tree);
|
extern tree mangle_thunk (tree, int, tree, tree, tree);
|
||||||
extern tree mangle_conv_op_name_for_type (tree);
|
extern tree mangle_conv_op_name_for_type (tree);
|
||||||
extern tree mangle_guard_variable (tree);
|
extern tree mangle_guard_variable (tree);
|
||||||
extern tree mangle_tls_init_fn (tree);
|
extern tree mangle_tls_init_fn (tree);
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ static void write_local_name (tree, const tree, const tree);
|
||||||
static void dump_substitution_candidates (void);
|
static void dump_substitution_candidates (void);
|
||||||
static tree mangle_decl_string (const tree);
|
static tree mangle_decl_string (const tree);
|
||||||
static int local_class_index (tree);
|
static int local_class_index (tree);
|
||||||
static void maybe_check_abi_tags (tree, tree = NULL_TREE);
|
static void maybe_check_abi_tags (tree, tree = NULL_TREE, int = 10);
|
||||||
static bool equal_abi_tags (tree, tree);
|
static bool equal_abi_tags (tree, tree);
|
||||||
|
|
||||||
/* Control functions. */
|
/* Control functions. */
|
||||||
|
|
@ -4024,10 +4024,13 @@ mangle_call_offset (const tree fixed_offset, const tree virtual_offset)
|
||||||
|
|
||||||
tree
|
tree
|
||||||
mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
|
mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
|
||||||
tree virtual_offset)
|
tree virtual_offset, tree thunk)
|
||||||
{
|
{
|
||||||
tree result;
|
tree result;
|
||||||
|
|
||||||
|
if (abi_version_at_least (11))
|
||||||
|
maybe_check_abi_tags (fn_decl, thunk, 11);
|
||||||
|
|
||||||
start_mangling (fn_decl);
|
start_mangling (fn_decl);
|
||||||
|
|
||||||
write_string ("_Z");
|
write_string ("_Z");
|
||||||
|
|
@ -4142,7 +4145,7 @@ mangle_conv_op_name_for_type (const tree type)
|
||||||
guard variable for T. */
|
guard variable for T. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_check_abi_tags (tree t, tree for_decl)
|
maybe_check_abi_tags (tree t, tree for_decl, int ver)
|
||||||
{
|
{
|
||||||
if (DECL_ASSEMBLER_NAME_SET_P (t))
|
if (DECL_ASSEMBLER_NAME_SET_P (t))
|
||||||
return;
|
return;
|
||||||
|
|
@ -4153,9 +4156,14 @@ maybe_check_abi_tags (tree t, tree for_decl)
|
||||||
|
|
||||||
tree newtags = get_abi_tags (t);
|
tree newtags = get_abi_tags (t);
|
||||||
if (newtags && newtags != oldtags
|
if (newtags && newtags != oldtags
|
||||||
&& abi_version_crosses (10))
|
&& abi_version_crosses (ver))
|
||||||
{
|
{
|
||||||
if (for_decl)
|
if (for_decl && DECL_THUNK_P (for_decl))
|
||||||
|
warning_at (DECL_SOURCE_LOCATION (t), OPT_Wabi,
|
||||||
|
"the mangled name of a thunk for %qD changes between "
|
||||||
|
"-fabi-version=%d and -fabi-version=%d",
|
||||||
|
t, flag_abi_version, warn_abi_version);
|
||||||
|
else if (for_decl)
|
||||||
warning_at (DECL_SOURCE_LOCATION (for_decl), OPT_Wabi,
|
warning_at (DECL_SOURCE_LOCATION (for_decl), OPT_Wabi,
|
||||||
"the mangled name of %qD changes between "
|
"the mangled name of %qD changes between "
|
||||||
"-fabi-version=%d and -fabi-version=%d",
|
"-fabi-version=%d and -fabi-version=%d",
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ finish_thunk (tree thunk)
|
||||||
virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
|
virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
|
||||||
function = THUNK_TARGET (thunk);
|
function = THUNK_TARGET (thunk);
|
||||||
name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
|
name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
|
||||||
fixed_offset, virtual_offset);
|
fixed_offset, virtual_offset, thunk);
|
||||||
|
|
||||||
/* We can end up with declarations of (logically) different
|
/* We can end up with declarations of (logically) different
|
||||||
covariant thunks, that do identical adjustments. The two thunks
|
covariant thunks, that do identical adjustments. The two thunks
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
// PR c++/77379
|
||||||
|
// { dg-options "-fabi-version=0 -Wabi=10" }
|
||||||
|
|
||||||
|
struct __attribute ((abi_tag ("bar"))) string { };
|
||||||
|
|
||||||
|
struct Mother
|
||||||
|
{
|
||||||
|
virtual ~Mother() {};
|
||||||
|
int bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Father
|
||||||
|
{
|
||||||
|
virtual string get_foo() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Derived:
|
||||||
|
public Mother,
|
||||||
|
public Father
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
string get_foo(); // { dg-warning "mangled name" }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Final:
|
||||||
|
public Derived
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Final().get_foo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
// PR c++/77379
|
||||||
|
// { dg-options -fabi-version=10 }
|
||||||
|
|
||||||
|
struct __attribute ((abi_tag ("bar"))) string { };
|
||||||
|
|
||||||
|
struct Mother
|
||||||
|
{
|
||||||
|
virtual ~Mother() {};
|
||||||
|
int bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Father
|
||||||
|
{
|
||||||
|
virtual string get_foo() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Derived:
|
||||||
|
public Mother,
|
||||||
|
public Father
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
string get_foo();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Final:
|
||||||
|
public Derived
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Final().get_foo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
|
||||||
Loading…
Reference in New Issue