mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
379d61b1c7
commit
f6441aff89
2 changed files with 8 additions and 0 deletions
|
@ -16,3 +16,6 @@
|
||||||
#if GCC_VERSION >= 40300
|
#if GCC_VERSION >= 40300
|
||||||
# define __compiletime_error(message) __attribute__((error(message)))
|
# define __compiletime_error(message) __attribute__((error(message)))
|
||||||
#endif /* GCC_VERSION >= 40300 */
|
#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]))
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
# define __always_inline inline __attribute__((always_inline))
|
# define __always_inline inline __attribute__((always_inline))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Are two types/vars the same type (ignoring qualifiers)? */
|
||||||
|
#ifndef __same_type
|
||||||
|
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
/*
|
/*
|
||||||
* FIXME: Big hammer to get rid of tons of:
|
* FIXME: Big hammer to get rid of tons of:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue