aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-13 23:29:59 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-17 23:23:56 +0200
commitb508d84449b10b696c20be2ca58a89dfccb620d6 (patch)
tree065d1ddc7c555a87286b75c41956b93b2fdabfe3
parentd3a25d90664d833e9657689d920ee05bdba30f7f (diff)
downloadsparse-b508d84449b10b696c20be2ca58a89dfccb620d6.tar.gz
attribute: allow some attribute to be present multiple times
A warning is issued when a qualifier or another modifier is present more than once in a declaration. This is fine but in the kernel some attributes, for example 'unused' & 'gnu_inline', are sometimes present multiple times in the same declaration (mainly they are added in the define used for 'inline'). This then creates a lot of useless noise. So, use a (now empty) white list to not warn when these attributes are present multiple times in the same declaration. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c2
-rw-r--r--symbol.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 974ff7a1..c1573b39 100644
--- a/parse.c
+++ b/parse.c
@@ -1129,7 +1129,7 @@ static struct token *attribute_aligned(struct token *token, struct symbol *attr,
static void apply_mod(struct position *pos, unsigned long *mods, unsigned long mod)
{
- if (*mods & mod)
+ if (*mods & mod & ~MOD_DUP_OK)
warning(*pos, "duplicate %s", modifier_string(mod));
*mods |= mod;
}
diff --git a/symbol.h b/symbol.h
index 18476582..9ba764b5 100644
--- a/symbol.h
+++ b/symbol.h
@@ -261,6 +261,8 @@ struct symbol {
#define MOD_FUN_ATTR (MOD_PURE|MOD_NORETURN)
/* like cvr-qualifiers but 'reversed' (OK: source <= target) */
#define MOD_REV_QUAL (MOD_PURE|MOD_NORETURN)
+/* do not warn when these are duplicated */
+#define MOD_DUP_OK 0
/* Current parsing/evaluation function */