Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
llvm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
8#define ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
9
10#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
11#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
12#endif
13
14#define __no_optimization __attribute__((optnone))
15
16#if __clang_major__ >= 10
17#define __fallthrough __attribute__((fallthrough))
18#endif
19
20#define TOOLCHAIN_CLANG_VERSION \
21 ((__clang_major__ * 10000) + (__clang_minor__ * 100) + \
22 __clang_patchlevel__)
23
24#define TOOLCHAIN_HAS_PRAGMA_DIAG 1
25
26#if TOOLCHAIN_CLANG_VERSION >= 30800
27#define TOOLCHAIN_HAS_C_GENERIC 1
28#define TOOLCHAIN_HAS_C_AUTO_TYPE 1
29#endif
30
32
33/*
34 * Provide these definitions only when minimal libc is used.
35 * Avoid collision with defines from include/zephyr/toolchain/zephyr_stdint.h
36 */
37#ifdef CONFIG_MINIMAL_LIBC
38
39#define __int_c(v, suffix) v ## suffix
40#define int_c(v, suffix) __int_c(v, suffix)
41#define uint_c(v, suffix) __int_c(v ## U, suffix)
42
43#ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
44
45#ifdef __INT64_TYPE__
46#undef __int_least64_c_suffix__
47#undef __int_least32_c_suffix__
48#undef __int_least16_c_suffix__
49#undef __int_least8_c_suffix__
50#ifdef __INT64_C_SUFFIX__
51#define __int_least64_c_suffix__ __INT64_C_SUFFIX__
52#define __int_least32_c_suffix__ __INT64_C_SUFFIX__
53#define __int_least16_c_suffix__ __INT64_C_SUFFIX__
54#define __int_least8_c_suffix__ __INT64_C_SUFFIX__
55#endif /* __INT64_C_SUFFIX__ */
56#endif /* __INT64_TYPE__ */
57
58#ifdef __INT_LEAST64_TYPE__
59#ifdef __int_least64_c_suffix__
60#define __INT64_C(x) int_c(x, __int_least64_c_suffix__)
61#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__)
62#else
63#define __INT64_C(x) x
64#define __UINT64_C(x) x ## U
65#endif /* __int_least64_c_suffix__ */
66#endif /* __INT_LEAST64_TYPE__ */
67
68#ifdef __INT32_TYPE__
69#undef __int_least32_c_suffix__
70#undef __int_least16_c_suffix__
71#undef __int_least8_c_suffix__
72#ifdef __INT32_C_SUFFIX__
73#define __int_least32_c_suffix__ __INT32_C_SUFFIX__
74#define __int_least16_c_suffix__ __INT32_C_SUFFIX__
75#define __int_least8_c_suffix__ __INT32_C_SUFFIX__
76#endif /* __INT32_C_SUFFIX__ */
77#endif /* __INT32_TYPE__ */
78
79#ifdef __INT_LEAST32_TYPE__
80#ifdef __int_least32_c_suffix__
81#define __INT32_C(x) int_c(x, __int_least32_c_suffix__)
82#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__)
83#else
84#define __INT32_C(x) x
85#define __UINT32_C(x) x ## U
86#endif /* __int_least32_c_suffix__ */
87#endif /* __INT_LEAST32_TYPE__ */
88
89#endif /* !CONFIG_ENFORCE_ZEPHYR_STDINT */
90
91#ifdef __INT16_TYPE__
92#undef __int_least16_c_suffix__
93#undef __int_least8_c_suffix__
94#ifdef __INT16_C_SUFFIX__
95#define __int_least16_c_suffix__ __INT16_C_SUFFIX__
96#define __int_least8_c_suffix__ __INT16_C_SUFFIX__
97#endif /* __INT16_C_SUFFIX__ */
98#endif /* __INT16_TYPE__ */
99
100#ifdef __INT_LEAST16_TYPE__
101#ifdef __int_least16_c_suffix__
102#define __INT16_C(x) int_c(x, __int_least16_c_suffix__)
103#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__)
104#else
105#define __INT16_C(x) x
106#define __UINT16_C(x) x ## U
107#endif /* __int_least16_c_suffix__ */
108#endif /* __INT_LEAST16_TYPE__ */
109
110#ifdef __INT8_TYPE__
111#undef __int_least8_c_suffix__
112#ifdef __INT8_C_SUFFIX__
113#define __int_least8_c_suffix__ __INT8_C_SUFFIX__
114#endif /* __INT8_C_SUFFIX__ */
115#endif /* __INT8_TYPE__ */
116
117#ifdef __INT_LEAST8_TYPE__
118#ifdef __int_least8_c_suffix__
119#define __INT8_C(x) int_c(x, __int_least8_c_suffix__)
120#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__)
121#else
122#define __INT8_C(x) x
123#define __UINT8_C(x) x ## U
124#endif /* __int_least8_c_suffix__ */
125#endif /* __INT_LEAST8_TYPE__ */
126
127#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__)
128#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__)
129
130#endif /* CONFIG_MINIMAL_LIBC */
131
132#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_ */
GCC toolchain abstraction.