提交 8d4beed7 编写于 作者: W Will Deacon

compiler-types.h: Include naked type in __pick_integer_type() match

__pick_integer_type() checks whether the type of its first argument is
compatible with an explicitly signed or unsigned integer type, returning
the compatible type if it exists.

Unfortunately, 'char' is neither compatible with 'signed char' nor
'unsigned char', so add a check against the naked type to allow the
__unqual_scalar_typeof() macro to strip qualifiers from char types
without an explicit signedness.
Reported-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: NWill Deacon <will@kernel.org>
上级 5872f1a2
...@@ -220,9 +220,14 @@ struct ftrace_likely_data { ...@@ -220,9 +220,14 @@ struct ftrace_likely_data {
#define __pick_scalar_type(x, type, otherwise) \ #define __pick_scalar_type(x, type, otherwise) \
__builtin_choose_expr(__same_type(x, type), (type)0, otherwise) __builtin_choose_expr(__same_type(x, type), (type)0, otherwise)
/*
* 'char' is not type-compatible with either 'signed char' or 'unsigned char',
* so we include the naked type here as well as the signed/unsigned variants.
*/
#define __pick_integer_type(x, type, otherwise) \ #define __pick_integer_type(x, type, otherwise) \
__pick_scalar_type(x, unsigned type, \ __pick_scalar_type(x, type, \
__pick_scalar_type(x, signed type, otherwise)) __pick_scalar_type(x, unsigned type, \
__pick_scalar_type(x, signed type, otherwise)))
#define __unqual_scalar_typeof(x) typeof( \ #define __unqual_scalar_typeof(x) typeof( \
__pick_integer_type(x, char, \ __pick_integer_type(x, char, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册