Zephyr Project API
4.4.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
#ifndef __fallthrough
17
#if __clang_major__ >= 10
18
#define __fallthrough __attribute__((fallthrough))
19
#endif
20
#endif
21
22
#define TOOLCHAIN_CLANG_VERSION \
23
((__clang_major__ * 10000) + (__clang_minor__ * 100) + \
24
__clang_patchlevel__)
25
26
#define TOOLCHAIN_HAS_PRAGMA_DIAG 1
27
28
#if TOOLCHAIN_CLANG_VERSION >= 30800
29
#define TOOLCHAIN_HAS_C_GENERIC 1
30
#define TOOLCHAIN_HAS_C_AUTO_TYPE 1
31
#endif
32
33
#include <
zephyr/toolchain/gcc.h
>
34
35
/* clear out common version. The build assert assert from gcc.h is defined to be empty */
36
#undef BUILD_ASSERT
37
38
#if defined(__cplusplus) && (__cplusplus >= 201103L)
39
40
/* C++11 has static_assert built in */
41
#define BUILD_ASSERT(EXPR, MSG...) static_assert(EXPR, "" MSG)
42
43
#elif !defined(__cplusplus) && ((__STDC_VERSION__) >= 201100)
44
45
/* C11 has static_assert built in */
46
#define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
47
48
#else
49
50
/* Rely on that the C-library provides a static assertion function */
51
#define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
52
53
#endif
54
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"
61
#define TOOLCHAIN_WARNING_DEPRECATED_DECLARATIONS "-Wdeprecated-declarations"
63
64
#define TOOLCHAIN_DISABLE_CLANG_WARNING(warning) _TOOLCHAIN_DISABLE_WARNING(clang, warning)
65
#define TOOLCHAIN_ENABLE_CLANG_WARNING(warning) _TOOLCHAIN_ENABLE_WARNING(clang, warning)
66
67
/*
68
* Provide these definitions only when minimal libc is used.
69
* Avoid collision with defines from include/zephyr/toolchain/zephyr_stdint.h
70
*/
71
#ifdef CONFIG_MINIMAL_LIBC
72
73
/*
74
* Predefined __INTN_C/__UINTN_C macros are provided by clang starting in version 20.1.
75
* Avoid redefining these macros if a sufficiently modern clang is being used.
76
*/
77
#if TOOLCHAIN_CLANG_VERSION < 200100
78
79
#define __int_c(v, suffix) v ## suffix
80
#define int_c(v, suffix) __int_c(v, suffix)
81
#define uint_c(v, suffix) __int_c(v ## U, suffix)
82
83
#ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
84
85
#ifdef __INT64_TYPE__
86
#undef __int_least64_c_suffix__
87
#undef __int_least32_c_suffix__
88
#undef __int_least16_c_suffix__
89
#undef __int_least8_c_suffix__
90
#ifdef __INT64_C_SUFFIX__
91
#define __int_least64_c_suffix__ __INT64_C_SUFFIX__
92
#define __int_least32_c_suffix__ __INT64_C_SUFFIX__
93
#define __int_least16_c_suffix__ __INT64_C_SUFFIX__
94
#define __int_least8_c_suffix__ __INT64_C_SUFFIX__
95
#endif
/* __INT64_C_SUFFIX__ */
96
#endif
/* __INT64_TYPE__ */
97
98
#ifdef __INT_LEAST64_TYPE__
99
#ifdef __int_least64_c_suffix__
100
#define __INT64_C(x) int_c(x, __int_least64_c_suffix__)
101
#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__)
102
#else
103
#define __INT64_C(x) x
104
#define __UINT64_C(x) x ## U
105
#endif
/* __int_least64_c_suffix__ */
106
#endif
/* __INT_LEAST64_TYPE__ */
107
108
#ifdef __INT32_TYPE__
109
#undef __int_least32_c_suffix__
110
#undef __int_least16_c_suffix__
111
#undef __int_least8_c_suffix__
112
#ifdef __INT32_C_SUFFIX__
113
#define __int_least32_c_suffix__ __INT32_C_SUFFIX__
114
#define __int_least16_c_suffix__ __INT32_C_SUFFIX__
115
#define __int_least8_c_suffix__ __INT32_C_SUFFIX__
116
#endif
/* __INT32_C_SUFFIX__ */
117
#endif
/* __INT32_TYPE__ */
118
119
#ifdef __INT_LEAST32_TYPE__
120
#ifdef __int_least32_c_suffix__
121
#define __INT32_C(x) int_c(x, __int_least32_c_suffix__)
122
#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__)
123
#else
124
#define __INT32_C(x) x
125
#define __UINT32_C(x) x ## U
126
#endif
/* __int_least32_c_suffix__ */
127
#endif
/* __INT_LEAST32_TYPE__ */
128
129
#endif
/* !CONFIG_ENFORCE_ZEPHYR_STDINT */
130
131
#ifdef __INT16_TYPE__
132
#undef __int_least16_c_suffix__
133
#undef __int_least8_c_suffix__
134
#ifdef __INT16_C_SUFFIX__
135
#define __int_least16_c_suffix__ __INT16_C_SUFFIX__
136
#define __int_least8_c_suffix__ __INT16_C_SUFFIX__
137
#endif
/* __INT16_C_SUFFIX__ */
138
#endif
/* __INT16_TYPE__ */
139
140
#ifdef __INT_LEAST16_TYPE__
141
#ifdef __int_least16_c_suffix__
142
#define __INT16_C(x) int_c(x, __int_least16_c_suffix__)
143
#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__)
144
#else
145
#define __INT16_C(x) x
146
#define __UINT16_C(x) x ## U
147
#endif
/* __int_least16_c_suffix__ */
148
#endif
/* __INT_LEAST16_TYPE__ */
149
150
#ifdef __INT8_TYPE__
151
#undef __int_least8_c_suffix__
152
#ifdef __INT8_C_SUFFIX__
153
#define __int_least8_c_suffix__ __INT8_C_SUFFIX__
154
#endif
/* __INT8_C_SUFFIX__ */
155
#endif
/* __INT8_TYPE__ */
156
157
#ifdef __INT_LEAST8_TYPE__
158
#ifdef __int_least8_c_suffix__
159
#define __INT8_C(x) int_c(x, __int_least8_c_suffix__)
160
#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__)
161
#else
162
#define __INT8_C(x) x
163
#define __UINT8_C(x) x ## U
164
#endif
/* __int_least8_c_suffix__ */
165
#endif
/* __INT_LEAST8_TYPE__ */
166
167
#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__)
168
#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__)
169
170
#endif
/* TOOLCHAIN_CLANG_VERSION < 200100 */
171
172
#endif
/* CONFIG_MINIMAL_LIBC */
173
174
#endif
/* ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_ */
gcc.h
GCC toolchain abstraction.
include
zephyr
toolchain
llvm.h
Generated on
for Zephyr Project API by
1.16.1