2#ifndef __LINUX_COMPILER_TYPES_H
3#define __LINUX_COMPILER_TYPES_H
11#define __has_builtin(x) (0)
15#define ___PASTE(a, b) a##b
16#define __PASTE(a, b) ___PASTE(a, b)
29#if __STDC_VERSION__ < 202311L
30# define auto __auto_type
37#if defined(CONFIG_DEBUG_INFO_BTF) && defined(CONFIG_PAHOLE_HAS_BTF_TAG) && \
38 __has_attribute(btf_type_tag) && !defined(__BINDGEN__)
39# define BTF_TYPE_TAG(value) __attribute__((btf_type_tag(#value)))
41# define BTF_TYPE_TAG(value)
49# define __kernel __attribute__((address_space(0)))
50# define __user __attribute__((noderef, address_space(__user)))
51# define __iomem __attribute__((noderef, address_space(__iomem)))
52# define __percpu __attribute__((noderef, address_space(__percpu)))
53# define __rcu __attribute__((noderef, address_space(__rcu)))
57# define __force __attribute__((force))
58# define __nocast __attribute__((nocast))
59# define __safe __attribute__((safe))
60# define __private __attribute__((noderef))
61# define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member))
65# ifdef STRUCTLEAK_PLUGIN
66# define __user __attribute__((user))
68# define __user BTF_TYPE_TAG(user)
71# define __percpu __percpu_qual BTF_TYPE_TAG(percpu)
72# define __rcu BTF_TYPE_TAG(rcu)
74# define __chk_user_ptr(x) (void)0
75# define __chk_io_ptr(x) (void)0
81# define ACCESS_PRIVATE(p, member) ((p)->member)
82# define __builtin_warning(x, y...) (1)
90#if CONFIG_FUNCTION_ALIGNMENT > 0
91#define __function_aligned __aligned(CONFIG_FUNCTION_ALIGNMENT)
93#define __function_aligned
111#if defined(CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT) || (CONFIG_FUNCTION_ALIGNMENT == 0)
112#define __cold __attribute__((__cold__))
139#if __has_attribute(__preserve_most__) && (defined(CONFIG_X86_64) || defined(CONFIG_ARM64))
140# define __preserve_most notrace __attribute__((__preserve_most__))
142# define __preserve_most
160#if __has_attribute(__retain__) && \
161 (defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || \
162 defined(CONFIG_LTO_CLANG))
163# define __retain __attribute__((__retain__))
171#elif defined(__GNUC__)
175#error "Unknown compiler"
186#ifdef CONFIG_HAVE_ARCH_COMPILER_H
187#include <asm/compiler.h>
190struct ftrace_branch_data {
196 unsigned long correct;
197 unsigned long incorrect;
203 unsigned long miss_hit[2];
207struct ftrace_likely_data {
208 struct ftrace_branch_data
data;
209 unsigned long constant;
212#if defined(CC_USING_HOTPATCH)
213#define notrace __attribute__((hotpatch(0, 0)))
214#elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY)
215#define notrace __attribute__((patchable_function_entry(0, 0)))
217#define notrace __attribute__((__no_instrument_function__))
226#define __naked __attribute__((__naked__)) notrace
235#define inline inline __gnu_inline __inline_maybe_unused notrace
247#define __inline__ inline
254#ifdef KBUILD_EXTRA_WARN2
255#define __inline_maybe_unused
257#define __inline_maybe_unused __maybe_unused
264#define noinline_for_stack noinline
270#define noinline_for_tracing noinline
279#ifdef __SANITIZE_ADDRESS__
286# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
287# define __no_sanitize_or_inline __no_kasan_or_inline
289# define __no_kasan_or_inline __always_inline
303# define __data_racy volatile
308#ifdef __SANITIZE_THREAD__
318# define __no_kcsan __no_sanitize_thread __disable_sanitizer_instrumentation
319# define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused
324#ifdef __SANITIZE_MEMORY__
332# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused
335#ifndef __no_sanitize_or_inline
336#define __no_sanitize_or_inline __always_inline
356#ifdef CONFIG_CC_HAS_ASSUME
357# define __assume(expr) __attribute__((__assume__(expr)))
359# define __assume(expr)
375#ifdef CONFIG_CC_HAS_COUNTED_BY
376# define __counted_by(member) __attribute__((__counted_by__(member)))
378# define __counted_by(member)
391#ifdef CONFIG_CC_HAS_COUNTED_BY_PTR
392#define __counted_by_ptr(member) __attribute__((__counted_by__(member)))
394#define __counted_by_ptr(member)
403#ifdef CONFIG_CC_HAS_MULTIDIMENSIONAL_NONSTRING
404# define __nonstring_array __attribute__((__nonstring__))
406# define __nonstring_array
412#ifdef __LITTLE_ENDIAN
413#define __counted_by_le(member) __counted_by(member)
414#define __counted_by_be(member)
416#define __counted_by_le(member)
417#define __counted_by_be(member) __counted_by(member)
430#define at_least static
436#define __noinstr_section(section) \
437 noinline notrace __attribute((__section__(section))) \
438 __no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage \
441#define noinstr __noinstr_section(".noinstr.text")
453#define __cpuidle __noinstr_section(".cpuidle.text")
464#ifndef __latent_entropy
465# define __latent_entropy
468#if defined(RANDSTRUCT) && !defined(__CHECKER__)
469# define __randomize_layout __designated_init __attribute__((randomize_layout))
470# define __no_randomize_layout __attribute__((no_randomize_layout))
472# define randomized_struct_fields_start struct {
473# define randomized_struct_fields_end } __randomize_layout;
475# define __randomize_layout __designated_init
476# define __no_randomize_layout
477# define randomized_struct_fields_start
478# define randomized_struct_fields_end
481#ifndef __no_kstack_erase
482# define __no_kstack_erase
489#if defined(CONFIG_CFI)
490# define __nocfi __attribute__((__no_sanitize__("kcfi")))
495#if defined(CONFIG_ARCH_USES_CFI_GENERIC_LLVM_PASS)
496# define __nocfi_generic __nocfi
498# define __nocfi_generic
508# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc
509# define __realloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__)
511# define __alloc_size(x, ...) __malloc
512# define __realloc_size(x, ...)
524#if __has_builtin(__builtin_dynamic_object_size)
525#define __struct_size(p) __builtin_dynamic_object_size(p, 0)
526#define __member_size(p) __builtin_dynamic_object_size(p, 1)
528#define __struct_size(p) __builtin_object_size(p, 0)
529#define __member_size(p) __builtin_object_size(p, 1)
538#if __has_builtin(__builtin_has_attribute)
539#define __annotated(var, attr) __builtin_has_attribute(var, attr)
548#if __has_builtin(__builtin_counted_by_ref) && \
549 !defined(CONFIG_CC_HAS_BROKEN_COUNTED_BY_REF)
569#define __flex_counter(FAM) __builtin_counted_by_ref(FAM)
571#define __flex_counter(FAM) ((void *)NULL)
581#ifndef asm_goto_output
582#define asm_goto_output(x...) asm volatile goto(x)
590 #define ASM_INPUT_G "g"
591 #define ASM_INPUT_RM "rm"
592 #define ASM_OUTPUT_RM "=rm"
595#ifdef CONFIG_CC_HAS_ASM_INLINE
596#define asm_inline asm __inline
598#define asm_inline asm
605#if CC_HAS_TYPEOF_UNQUAL || defined(__CHECKER__)
606# define USE_TYPEOF_UNQUAL 1
610#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
616#ifndef USE_TYPEOF_UNQUAL
621#define __scalar_type_to_expr_cases(type) \
622 unsigned type: (unsigned type)0, \
623 signed type: (signed type)0
625#define __unqual_scalar_typeof(x) typeof( \
628 __scalar_type_to_expr_cases(char), \
629 __scalar_type_to_expr_cases(short), \
630 __scalar_type_to_expr_cases(int), \
631 __scalar_type_to_expr_cases(long), \
632 __scalar_type_to_expr_cases(long long), \
635#define __unqual_scalar_typeof(x) __typeof_unqual__(x)
647#define __scalar_type_to_signed_cases(type) \
648 unsigned type: (signed type)0, \
649 signed type: (signed type)0
651#define __signed_scalar_typeof(x) typeof( \
653 char: (signed char)0, \
654 __scalar_type_to_signed_cases(char), \
655 __scalar_type_to_signed_cases(short), \
656 __scalar_type_to_signed_cases(int), \
657 __scalar_type_to_signed_cases(long), \
658 __scalar_type_to_signed_cases(long long), \
662#define __native_word(t) \
663 (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
664 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
673# define __compiletime_assert(condition, msg, prefix, suffix) \
680 __noreturn extern void prefix ## suffix(void) \
681 __compiletime_error(msg); \
683 prefix ## suffix(); \
686# define __compiletime_assert(condition, msg, prefix, suffix) ((void)(condition))
689#define _compiletime_assert(condition, msg, prefix, suffix) \
690 __compiletime_assert(condition, msg, prefix, suffix)
701#define compiletime_assert(condition, msg) \
702 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
704#define compiletime_assert_atomic_type(t) \
705 compiletime_assert(__native_word(t), \
706 "Need native word sized stores/loads for atomicity.")
710#define __diag(string)
714#define __diag_GCC(version, severity, string)
718#define __diag_clang(version, severity, string)
721#define __diag_push() __diag(push)
722#define __diag_pop() __diag(pop)
724#define __diag_ignore(compiler, version, option, comment) \
725 __diag_ ## compiler(version, ignore, option)
726#define __diag_warn(compiler, version, option, comment) \
727 __diag_ ## compiler(version, warn, option)
728#define __diag_error(compiler, version, option, comment) \
729 __diag_ ## compiler(version, error, option)
731#ifndef __diag_ignore_all
732#define __diag_ignore_all(option, comment)
#define __chk_io_ptr(x)
Definition compiler_types.h:75
#define __chk_user_ptr(x)
Definition compiler_types.h:74
#define __user
Definition compiler_types.h:68
#define __iomem
Definition compiler_types.h:70
void * data
Definition kthread.h:30