diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-17 11:25:00 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-19 13:01:42 -0300 |
commit | f6441aff8946f7fd6ab730d7eb9eba18a9ebeba4 (patch) | |
tree | 4bd16f3906dd5623bc73ae75dc006b4cf7dea48d /tools/include/linux/compiler-gcc.h | |
parent | 379d61b1c7d42512cded04d372f15a7e725db9e1 (diff) | |
download | linux-f6441aff8946f7fd6ab730d7eb9eba18a9ebeba4.tar.gz linux-f6441aff8946f7fd6ab730d7eb9eba18a9ebeba4.tar.bz2 linux-f6441aff8946f7fd6ab730d7eb9eba18a9ebeba4.zip |
tools include: Adopt __same_type() and __must_be_array() from the kernel
Will be used to adopt the more stringent version of ARRAY_SIZE(), the
one in the kernel sources.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-d85dpvay1hoqscpezlntyd8x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include/linux/compiler-gcc.h')
-rw-r--r-- | tools/include/linux/compiler-gcc.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h index 616935f1ff56..825d44f89a29 100644 --- a/tools/include/linux/compiler-gcc.h +++ b/tools/include/linux/compiler-gcc.h @@ -16,3 +16,6 @@ #if GCC_VERSION >= 40300 # define __compiletime_error(message) __attribute__((error(message))) #endif /* GCC_VERSION >= 40300 */ + +/* &a[0] degrades to a pointer: a different type from an array */ +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) |