Skip to content

Commit

Permalink
include/linux/compiler-gcc.h: use __same_type() in __must_be_array()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rusty Russell authored and Linus Torvalds committed Aug 10, 2010
1 parent 7387be3 commit ea6b101
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/linux/compiler-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
(typeof(ptr)) (__ptr + (off)); })

/* &a[0] degrades to a pointer: a different type from an array */
#define __must_be_array(a) \
BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

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

0 comments on commit ea6b101

Please sign in to comment.