diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-05-13 23:29:59 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-05-17 23:23:56 +0200 |
commit | b508d84449b10b696c20be2ca58a89dfccb620d6 (patch) | |
tree | 065d1ddc7c555a87286b75c41956b93b2fdabfe3 | |
parent | d3a25d90664d833e9657689d920ee05bdba30f7f (diff) | |
download | sparse-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.c | 2 | ||||
-rw-r--r-- | symbol.h | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -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; } @@ -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 */ |