aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-01-05 00:57:30 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-01-04 17:57:30 -0700
commit29d2485270f422a4b89bfa79e448843509cd0568 (patch)
treef1e8cf0a03dff36fd00f2c23d9cebce2ecbc3871 /gcc/attribs.c
parentf6be1179bb66624403d0f55620d67344d9d98c51 (diff)
downloadgcc-29d2485270f422a4b89bfa79e448843509cd0568.zip
gcc-29d2485270f422a4b89bfa79e448843509cd0568.tar.gz
gcc-29d2485270f422a4b89bfa79e448843509cd0568.tar.bz2
PR c/88546 - Copy attribute unusable for weakrefs
gcc/c-family/ChangeLog: PR c/88546 * c-attribs.c (handle_copy_attribute): Avoid copying attribute leaf. Handle C++ empty throw specification and C11 _Noreturn. (has_attribute): Also handle C11 _Noreturn. gcc/ChangeLog: PR c/88546 * attribs.c (decls_mismatched_attributes): Avoid warning for attribute leaf. gcc/testsuite/ChangeLog: PR c/88546 * g++.dg/ext/attr-copy.C: New test. * gcc.dg/attr-copy-4.c: Disable macro expansion tracking. * gcc.dg/attr-copy-6.c: New test. * gcc.dg/attr-copy-7.c: New test. From-SVN: r267591
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 3b4084e..d9b6a04 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -1912,6 +1912,12 @@ decls_mismatched_attributes (tree tmpl, tree decl, tree attrlist,
for (unsigned i = 0; blacklist[i]; ++i)
{
+ /* Attribute leaf only applies to extern functions. Avoid mentioning
+ it when it's missing from a static declaration. */
+ if (!TREE_PUBLIC (decl)
+ && !strcmp ("leaf", blacklist[i]))
+ continue;
+
for (unsigned j = 0; j != 2; ++j)
{
if (!has_attribute (tmpls[j], tmpl_attrs[j], blacklist[i]))