Zephyr API Documentation  3.6.99
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#ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
39
40#define __int_c(v, suffix) v ## suffix
41#define int_c(v, suffix) __int_c(v, suffix)
42#define uint_c(v, suffix) __int_c(v ## U, suffix)
43
44#ifdef __INT64_TYPE__
45#undef __int_least64_c_suffix__
46#undef __int_least32_c_suffix__
47#undef __int_least16_c_suffix__
48#undef __int_least8_c_suffix__
49#ifdef __INT64_C_SUFFIX__
50#define __int_least64_c_suffix__ __INT64_C_SUFFIX__
51#define __int_least32_c_suffix__ __INT64_C_SUFFIX__
52#define __int_least16_c_suffix__ __INT64_C_SUFFIX__
53#define __int_least8_c_suffix__ __INT64_C_SUFFIX__
54#endif /* __INT64_C_SUFFIX__ */
55#endif /* __INT64_TYPE__ */
56
57#ifdef __INT_LEAST64_TYPE__
58#ifdef __int_least64_c_suffix__
59#define __INT64_C(x) int_c(x, __int_least64_c_suffix__)
60#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__)
61#else
62#define __INT64_C(x) x
63#define __UINT64_C(x) x ## U
64#endif /* __int_least64_c_suffix__ */
65#endif /* __INT_LEAST64_TYPE__ */
66
67#ifdef __INT32_TYPE__
68#undef __int_least32_c_suffix__
69#undef __int_least16_c_suffix__
70#undef __int_least8_c_suffix__
71#ifdef __INT32_C_SUFFIX__
72#define __int_least32_c_suffix__ __INT32_C_SUFFIX__
73#define __int_least16_c_suffix__ __INT32_C_SUFFIX__
74#define __int_least8_c_suffix__ __INT32_C_SUFFIX__
75#endif /* __INT32_C_SUFFIX__ */
76#endif /* __INT32_TYPE__ */
77
78#ifdef __INT_LEAST32_TYPE__
79#ifdef __int_least32_c_suffix__
80#define __INT32_C(x) int_c(x, __int_least32_c_suffix__)
81#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__)
82#else
83#define __INT32_C(x) x
84#define __UINT32_C(x) x ## U
85#endif /* __int_least32_c_suffix__ */
86#endif /* __INT_LEAST32_TYPE__ */
87
88#ifdef __INT16_TYPE__
89#undef __int_least16_c_suffix__
90#undef __int_least8_c_suffix__
91#ifdef __INT16_C_SUFFIX__
92#define __int_least16_c_suffix__ __INT16_C_SUFFIX__
93#define __int_least8_c_suffix__ __INT16_C_SUFFIX__
94#endif /* __INT16_C_SUFFIX__ */
95#endif /* __INT16_TYPE__ */
96
97#ifdef __INT_LEAST16_TYPE__
98#ifdef __int_least16_c_suffix__
99#define __INT16_C(x) int_c(x, __int_least16_c_suffix__)
100#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__)
101#else
102#define __INT16_C(x) x
103#define __UINT16_C(x) x ## U
104#endif /* __int_least16_c_suffix__ */
105#endif /* __INT_LEAST16_TYPE__ */
106
107#ifdef __INT8_TYPE__
108#undef __int_least8_c_suffix__
109#ifdef __INT8_C_SUFFIX__
110#define __int_least8_c_suffix__ __INT8_C_SUFFIX__
111#endif /* __INT8_C_SUFFIX__ */
112#endif /* __INT8_TYPE__ */
113
114#ifdef __INT_LEAST8_TYPE__
115#ifdef __int_least8_c_suffix__
116#define __INT8_C(x) int_c(x, __int_least8_c_suffix__)
117#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__)
118#else
119#define __INT8_C(x) x
120#define __UINT8_C(x) x ## U
121#endif /* __int_least8_c_suffix__ */
122#endif /* __INT_LEAST8_TYPE__ */
123
124#endif /* !CONFIG_ENFORCE_ZEPHYR_STDINT */
125
126#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__)
127#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__)
128
129#endif /* CONFIG_MINIMAL_LIBC */
130
131#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_ */
GCC toolchain abstraction.