diff options
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index 2cac9c403b4..140863be1d9 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -410,6 +410,22 @@ diag_attr_exclusions (tree last_decl, tree node, tree attrname, if (!lookup_attribute (excl->name, attrs[i])) continue; + /* An exclusion may apply either to a function declaration, + type declaration, or a field/variable declaration, or + any subset of the three. */ + if (TREE_CODE (node) == FUNCTION_DECL + && !excl->function) + continue; + + if (TREE_CODE (node) == TYPE_DECL + && !excl->type) + continue; + + if ((TREE_CODE (node) == FIELD_DECL + || TREE_CODE (node) == VAR_DECL) + && !excl->variable) + continue; + found = true; /* Print a note? */ |