Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

compiler.h: move __is_constexpr() to compiler.h

Prior to f747e6667ebb2 __is_constexpr() was in its only user minmax.h.
That commit moved it to const.h - but that file just defines ULL(x) and
UL(x) so that constants can be defined for .S and .c files.

So apart from the word 'const' it wasn't really a good location. Instead
move the definition to compiler.h just before the similar

is_signed_type() and is_unsigned_type().

This may not be a good long-term home, but the three definitions belong
together.

Link: https://lkml.kernel.org/r/2a6680bbe2e84459816a113730426782@AcuMS.aculab.com
Signed-off-by: David Laight <david.laight@aculab.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Laight and committed by
Andrew Morton
598f0ac1 fbd126f5

+16 -16
+8
include/linux/compiler.h
··· 228 228 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) 229 229 230 230 /* 231 + * This returns a constant expression while determining if an argument is 232 + * a constant expression, most importantly without evaluating the argument. 233 + * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> 234 + */ 235 + #define __is_constexpr(x) \ 236 + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 237 + 238 + /* 231 239 * Whether 'type' is a signed type or an unsigned type. Supports scalar types, 232 240 * bool and also pointer types. 233 241 */
-8
include/linux/const.h
··· 3 3 4 4 #include <vdso/const.h> 5 5 6 - /* 7 - * This returns a constant expression while determining if an argument is 8 - * a constant expression, most importantly without evaluating the argument. 9 - * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> 10 - */ 11 - #define __is_constexpr(x) \ 12 - (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 13 - 14 6 #endif /* _LINUX_CONST_H */
+8
tools/include/linux/compiler.h
··· 63 63 # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) 64 64 #endif 65 65 66 + /* 67 + * This returns a constant expression while determining if an argument is 68 + * a constant expression, most importantly without evaluating the argument. 69 + * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> 70 + */ 71 + #define __is_constexpr(x) \ 72 + (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 73 + 66 74 #ifdef __ANDROID__ 67 75 /* 68 76 * FIXME: Big hammer to get rid of tons of:
-8
tools/include/linux/const.h
··· 3 3 4 4 #include <vdso/const.h> 5 5 6 - /* 7 - * This returns a constant expression while determining if an argument is 8 - * a constant expression, most importantly without evaluating the argument. 9 - * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> 10 - */ 11 - #define __is_constexpr(x) \ 12 - (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) 13 - 14 6 #endif /* _LINUX_CONST_H */