Skip to content

Commit ea6b101

Browse files
rustyrusselltorvalds
authored andcommitted
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>
1 parent 7387be3 commit ea6b101

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎include/linux/compiler-gcc.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
(typeof(ptr)) (__ptr + (off)); })
3636

3737
/* &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]))
4039

4140
/*
4241
* Force always-inline if the user requests it so via the .config,

0 commit comments

Comments
 (0)