From 28d927819677583dde8f59e2ce97b57e9552cb2f Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 15 Nov 2012 01:53:37 +0000 Subject: [PATCH] * class.c (finish_struct_1): Check virtual functions for missing ABI tags. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193525 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/class.c | 6 ++++++ gcc/doc/extend.texi | 2 +- gcc/testsuite/g++.dg/abi/abi-tag4.C | 8 ++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/abi/abi-tag4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bb5e4bad4a7..af55e29add3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2012-11-13 Jason Merrill + * class.c (finish_struct_1): Check virtual functions + for missing ABI tags. + PR c++/55275 * pt.c (maybe_process_partial_specialization): Update DECL_SOURCE_LOCATION for new specializations. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0665e90f5a0..cdc02ae7d7a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6275,6 +6275,12 @@ finish_struct_1 (tree t) /* Here we know enough to change the type of our virtual function table, but we will wait until later this function. */ build_primary_vtable (CLASSTYPE_PRIMARY_BINFO (t), t); + + /* If we're warning about ABI tags, check the types of the new + virtual functions. */ + if (warn_abi_tag) + for (tree v = virtuals; v; v = TREE_CHAIN (v)) + check_abi_tags (t, TREE_VALUE (v)); } if (TYPE_CONTAINS_VPTR_P (t)) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 25dd685e0ab..43b21c6231f 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -15622,7 +15622,7 @@ A redeclaration of a function or class must not add new ABI tags, since doing so would change the mangled name. The @option{-Wabi-tag} flag enables a warning about a class which does -not have all the ABI tags used by its subobjects; for users with code +not have all the ABI tags used by its subobjects and virtual functions; for users with code that needs to coexist with an earlier ABI, using this option can help to find all affected types that need to be tagged. diff --git a/gcc/testsuite/g++.dg/abi/abi-tag4.C b/gcc/testsuite/g++.dg/abi/abi-tag4.C new file mode 100644 index 00000000000..3f8d7bfbc3d --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag4.C @@ -0,0 +1,8 @@ +// { dg-options "-Wabi-tag" } + +struct __attribute ((abi_tag ("X"))) A { }; + +struct B // { dg-warning "abi tag" } +{ + virtual void f(A); // { dg-message "declared here" } +}; -- 2.11.4.GIT