diff options
| author | Ian Rogers <irogers@google.com> | 2025-10-16 13:51:25 -0700 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-01-14 08:56:41 +0100 |
| commit | 1d7cf255eefbb479d0eea9aa3b6372a1e52f8c62 (patch) | |
| tree | 811e5063ec4790c020423d844621020fc63f8a5c /tools/include/linux | |
| parent | a339671db64b12bb02492557d2b0658811286277 (diff) | |
tools headers: Update the linux/unaligned.h copy with the kernel sources
To pick up the changes in:
vdso: Switch get/put_unaligned() from packed struct to memcpy
As the code is dependent on __unqual_scalar_typeof, update also the tools
version of compiler_types.h to include this.
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20251016205126.2882625-4-irogers@google.com
Diffstat (limited to 'tools/include/linux')
| -rw-r--r-- | tools/include/linux/compiler_types.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h index d09f9dc172a4..890982283a5e 100644 --- a/tools/include/linux/compiler_types.h +++ b/tools/include/linux/compiler_types.h @@ -40,4 +40,26 @@ #define asm_goto_output(x...) asm goto(x) #endif +/* + * __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving + * non-scalar types unchanged. + */ +/* + * 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) \ + unsigned type: (unsigned type)0, \ + signed type: (signed type)0 + +#define __unqual_scalar_typeof(x) typeof( \ + _Generic((x), \ + char: (char)0, \ + __scalar_type_to_expr_cases(char), \ + __scalar_type_to_expr_cases(short), \ + __scalar_type_to_expr_cases(int), \ + __scalar_type_to_expr_cases(long), \ + __scalar_type_to_expr_cases(long long), \ + default: (x))) + #endif /* __LINUX_COMPILER_TYPES_H */ |
