The kernel and other projects use lots of attributes which sparse doesn't know about. Since these are often used in widely included header files (e.g. no_sanitize_address or assume_aligned), we get a lot of noise for no benefit (the compiler proper complains if the attributes are not properly guarded by suitable version checks). So turn off these annoying and useless warnings. They can be turned on explicitly by Wunknown-attribute. Signed-off-by: Rasmus Villemoes <rv@xxxxxxxxxxxxxxxxxx> --- lib.c | 2 ++ lib.h | 1 + parse.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib.c b/lib.c index c8ab2a2..ebd31c9 100644 --- a/lib.c +++ b/lib.c @@ -239,6 +239,7 @@ int Wtransparent_union = 0; int Wtypesign = 0; int Wundef = 0; int Wuninitialized = 1; +int Wunknown_attribute = 0; int Wvla = 1; int dbg_entry = 0; @@ -453,6 +454,7 @@ static const struct warning { { "typesign", &Wtypesign }, { "undef", &Wundef }, { "uninitialized", &Wuninitialized }, + { "unknown-attribute", &Wunknown_attribute }, { "vla", &Wvla }, }; diff --git a/lib.h b/lib.h index 0bca120..feff239 100644 --- a/lib.h +++ b/lib.h @@ -127,6 +127,7 @@ extern int Wtransparent_union; extern int Wtypesign; extern int Wundef; extern int Wuninitialized; +extern int Wunknown_attribute; extern int Wvla; extern int dbg_entry; diff --git a/parse.c b/parse.c index 5b82c68..6460655 100644 --- a/parse.c +++ b/parse.c @@ -1223,7 +1223,8 @@ static struct token *recover_unknown_attribute(struct token *token) { struct expression *expr = NULL; - sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident)); + if (Wunknown_attribute) + sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident)); token = token->next; if (match_op(token, '(')) token = parens_expression(token, &expr, "in attribute"); -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe smatch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html