aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4f2fc2e..28052df 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13731,11 +13731,15 @@ grokdeclarator (const cp_declarator *declarator,
if (friendp)
{
- if (attrlist && !funcdef_flag
- /* Hack to allow attributes like vector_size on a friend. */
- && any_non_type_attribute_p (*attrlist))
- error_at (id_loc, "attribute appertains to a friend "
- "declaration that is not a definition");
+ /* Packages tend to use GNU attributes on friends, so we only
+ warn for standard attributes. */
+ if (attrlist && !funcdef_flag && cxx11_attribute_p (*attrlist))
+ {
+ *attrlist = NULL_TREE;
+ if (warning_at (id_loc, OPT_Wattributes, "attribute ignored"))
+ inform (id_loc, "an attribute that appertains to a friend "
+ "declaration that is not a definition is ignored");
+ }
/* Friends are treated specially. */
if (ctype == current_class_type)
; /* We already issued a permerror. */