diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2011-05-24 20:13:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:46 -0400 |
commit | 5bd7e6a30e1eb38f58f0046c0cd42dfc38e90d64 (patch) | |
tree | 9e756cacd00f37be03db48be5912459c6fd5e515 | |
parent | 903c0c7cdc21f2ccb7562a7bbc70289c0c2b16ad (diff) |
sparse: define __must_be_array() for __CHECKER__
commit c5e631cf65f ("ARRAY_SIZE: check for type") added __must_be_array().
But sparse can't parse this gcc extention.
Now make C=2 makes following sparse errors a lot.
kernel/futex.c:2699:25: error: No right hand side of '+'-expression
Because __must_be_array() is used for ARRAY_SIZE() macro and it is
used very widely.
This patch fixes it.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/compiler-gcc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index cb4c1eb7778e..59e4028e833d 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -34,8 +34,12 @@ | |||
34 | __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ | 34 | __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ |
35 | (typeof(ptr)) (__ptr + (off)); }) | 35 | (typeof(ptr)) (__ptr + (off)); }) |
36 | 36 | ||
37 | #ifdef __CHECKER__ | ||
38 | #define __must_be_array(arr) 0 | ||
39 | #else | ||
37 | /* &a[0] degrades to a pointer: a different type from an array */ | 40 | /* &a[0] degrades to a pointer: a different type from an array */ |
38 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | 41 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) |
42 | #endif | ||
39 | 43 | ||
40 | /* | 44 | /* |
41 | * Force always-inline if the user requests it so via the .config, | 45 | * Force always-inline if the user requests it so via the .config, |