7#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
8#define ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
10#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
11#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
14#define __no_optimization __attribute__((optnone))
17#if __clang_major__ >= 10
18#define __fallthrough __attribute__((fallthrough))
22#define TOOLCHAIN_CLANG_VERSION \
23 ((__clang_major__ * 10000) + (__clang_minor__ * 100) + \
26#define TOOLCHAIN_HAS_PRAGMA_DIAG 1
28#if TOOLCHAIN_CLANG_VERSION >= 30800
29#define TOOLCHAIN_HAS_C_GENERIC 1
30#define TOOLCHAIN_HAS_C_AUTO_TYPE 1
38#if defined(__cplusplus) && (__cplusplus >= 201103L)
41#define BUILD_ASSERT(EXPR, MSG...) static_assert(EXPR, "" MSG)
43#elif !defined(__cplusplus) && ((__STDC_VERSION__) >= 201100)
46#define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
51#define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
56#define TOOLCHAIN_WARNING_SIZEOF_ARRAY_DECAY "-Wsizeof-array-decay"
57#define TOOLCHAIN_WARNING_UNNEEDED_INTERNAL_DECLARATION "-Wunneeded-internal-declaration"
58#define TOOLCHAIN_WARNING_USED_BUT_MARKED_UNUSED "-Wused-but-marked-unused"
59#define TOOLCHAIN_WARNING_UNALIGNED_ACCESS "-Wunaligned-access"
60#define TOOLCHAIN_WARNING_ARM_INTERRUPT_VFP_CLOBBER "-Warm-interrupt-vfp-clobber"
63#define TOOLCHAIN_DISABLE_CLANG_WARNING(warning) _TOOLCHAIN_DISABLE_WARNING(clang, warning)
64#define TOOLCHAIN_ENABLE_CLANG_WARNING(warning) _TOOLCHAIN_ENABLE_WARNING(clang, warning)
70#ifdef CONFIG_MINIMAL_LIBC
76#if TOOLCHAIN_CLANG_VERSION < 200100
78#define __int_c(v, suffix) v ## suffix
79#define int_c(v, suffix) __int_c(v, suffix)
80#define uint_c(v, suffix) __int_c(v ## U, suffix)
82#ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
85#undef __int_least64_c_suffix__
86#undef __int_least32_c_suffix__
87#undef __int_least16_c_suffix__
88#undef __int_least8_c_suffix__
89#ifdef __INT64_C_SUFFIX__
90#define __int_least64_c_suffix__ __INT64_C_SUFFIX__
91#define __int_least32_c_suffix__ __INT64_C_SUFFIX__
92#define __int_least16_c_suffix__ __INT64_C_SUFFIX__
93#define __int_least8_c_suffix__ __INT64_C_SUFFIX__
97#ifdef __INT_LEAST64_TYPE__
98#ifdef __int_least64_c_suffix__
99#define __INT64_C(x) int_c(x, __int_least64_c_suffix__)
100#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__)
102#define __INT64_C(x) x
103#define __UINT64_C(x) x ## U
108#undef __int_least32_c_suffix__
109#undef __int_least16_c_suffix__
110#undef __int_least8_c_suffix__
111#ifdef __INT32_C_SUFFIX__
112#define __int_least32_c_suffix__ __INT32_C_SUFFIX__
113#define __int_least16_c_suffix__ __INT32_C_SUFFIX__
114#define __int_least8_c_suffix__ __INT32_C_SUFFIX__
118#ifdef __INT_LEAST32_TYPE__
119#ifdef __int_least32_c_suffix__
120#define __INT32_C(x) int_c(x, __int_least32_c_suffix__)
121#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__)
123#define __INT32_C(x) x
124#define __UINT32_C(x) x ## U
131#undef __int_least16_c_suffix__
132#undef __int_least8_c_suffix__
133#ifdef __INT16_C_SUFFIX__
134#define __int_least16_c_suffix__ __INT16_C_SUFFIX__
135#define __int_least8_c_suffix__ __INT16_C_SUFFIX__
139#ifdef __INT_LEAST16_TYPE__
140#ifdef __int_least16_c_suffix__
141#define __INT16_C(x) int_c(x, __int_least16_c_suffix__)
142#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__)
144#define __INT16_C(x) x
145#define __UINT16_C(x) x ## U
150#undef __int_least8_c_suffix__
151#ifdef __INT8_C_SUFFIX__
152#define __int_least8_c_suffix__ __INT8_C_SUFFIX__
156#ifdef __INT_LEAST8_TYPE__
157#ifdef __int_least8_c_suffix__
158#define __INT8_C(x) int_c(x, __int_least8_c_suffix__)
159#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__)
162#define __UINT8_C(x) x ## U
166#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__)
167#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__)