mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
5872f1a2e5
commit
8d4beed7bb
1 changed files with 7 additions and 2 deletions
|
@ -220,9 +220,14 @@ struct ftrace_likely_data {
|
|||
#define __pick_scalar_type(x, type, 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) \
|
||||
__pick_scalar_type(x, unsigned type, \
|
||||
__pick_scalar_type(x, signed type, otherwise))
|
||||
__pick_scalar_type(x, type, \
|
||||
__pick_scalar_type(x, unsigned type, \
|
||||
__pick_scalar_type(x, signed type, otherwise)))
|
||||
|
||||
#define __unqual_scalar_typeof(x) typeof( \
|
||||
__pick_integer_type(x, char, \
|
||||
|
|
Loading…
Reference in a new issue