Commit ea6b101d8a3ea4e1dec29df31188c2f9852296fe

Authored by Rusty Russell
Committed by Linus Torvalds
1 parent 7387be3373

include/linux/compiler-gcc.h: use __same_type() in __must_be_array()

We should use the __same_type() helper in __must_be_array().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

include/linux/compiler-gcc.h
... ... @@ -35,8 +35,7 @@
35 35 (typeof(ptr)) (__ptr + (off)); })
36 36  
37 37 /* &a[0] degrades to a pointer: a different type from an array */
38   -#define __must_be_array(a) \
39   - BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
  38 +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
40 39  
41 40 /*
42 41 * Force always-inline if the user requests it so via the .config,