The nocast modifier should be inherited when referencing a variable, so add it to MOD_PTRINHERIT. E.g. without this patch the following code snippet ... typedef int __attribute__((nocast)) test_type; static void foo(test_type *a) {} static void bar(void) { test_type a; foo(&a); } ... incorrectly generates the following sparse warnings: nocast_ref.c:8:10: warning: incorrect type in argument 1 (different modifiers) nocast_ref.c:8:10: expected int [nocast] [usertype] *a nocast_ref.c:8:10: got int *<noident> nocast_ref.c:8:10: warning: implicit cast to nocast type Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx> --- symbol.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/symbol.h b/symbol.h index 1e74579..c7ec35b 100644 --- a/symbol.h +++ b/symbol.h @@ -229,7 +229,8 @@ struct symbol { #define MOD_SIZE (MOD_CHAR | MOD_SHORT | MOD_LONG_ALL) #define MOD_IGNORE (MOD_TOPLEVEL | MOD_STORAGE | MOD_ADDRESSABLE | \ MOD_ASSIGNED | MOD_USERTYPE | MOD_ACCESSED | MOD_EXPLICITLY_SIGNED) -#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE | MOD_NORETURN) +#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE | \ + MOD_NORETURN | MOD_NOCAST) /* Current parsing/evaluation function */ -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html