[PATCH 3/6] attribute: allow some attribute to be present multiple times

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 parse.c  | 2 +-
 symbol.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/parse.c b/parse.c
index 974ff7a1961c..c1573b396840 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 18476582aa8d..9ba764b596da 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 */
-- 
2.26.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux