diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 5d6544545658..87a9ce3ebd13 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -486,15 +486,19 @@ struct ftrace_likely_data { * __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving * non-scalar types unchanged. */ + +#if defined(CONFIG_CC_HAS_TYPEOF_UNQUAL) && !defined(__CHECKER__) +# define __unqual_scalar_typeof(x) __typeof_unqual__(x) +#else /* * Prefer C11 _Generic for better compile-times and simpler code. Note: 'char' * is not type-compatible with 'signed char', and we define a separate case. */ -#define __scalar_type_to_expr_cases(type) \ + #define __scalar_type_to_expr_cases(type) \ unsigned type: (unsigned type)0, \ signed type: (signed type)0 -#define __unqual_scalar_typeof(x) typeof( \ + #define __unqual_scalar_typeof(x) typeof( \ _Generic((x), \ char: (char)0, \ __scalar_type_to_expr_cases(char), \ @@ -503,6 +507,7 @@ struct ftrace_likely_data { __scalar_type_to_expr_cases(long), \ __scalar_type_to_expr_cases(long long), \ default: (x))) +#endif /* Is this type a native word size -- useful for atomic operations */ #define __native_word(t) \