2021-04-19 06:11:19 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 Intel Corporation.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
|
|
|
|
#define ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
|
|
|
|
|
2023-09-14 11:51:56 +02:00
|
|
|
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
|
|
|
|
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
|
|
|
|
#endif
|
2021-04-19 06:11:19 +02:00
|
|
|
|
|
|
|
#define __no_optimization __attribute__((optnone))
|
2022-02-23 16:24:01 +01:00
|
|
|
|
|
|
|
#if __clang_major__ >= 10
|
|
|
|
#define __fallthrough __attribute__((fallthrough))
|
|
|
|
#endif
|
|
|
|
|
2022-04-22 06:46:34 +02:00
|
|
|
#define TOOLCHAIN_CLANG_VERSION \
|
2022-02-25 21:17:19 +01:00
|
|
|
((__clang_major__ * 10000) + (__clang_minor__ * 100) + \
|
|
|
|
__clang_patchlevel__)
|
|
|
|
|
2022-02-25 21:35:53 +01:00
|
|
|
#define TOOLCHAIN_HAS_PRAGMA_DIAG 1
|
|
|
|
|
2022-04-22 06:46:34 +02:00
|
|
|
#if TOOLCHAIN_CLANG_VERSION >= 30800
|
2022-02-25 21:50:04 +01:00
|
|
|
#define TOOLCHAIN_HAS_C_GENERIC 1
|
2022-02-25 23:09:18 +01:00
|
|
|
#define TOOLCHAIN_HAS_C_AUTO_TYPE 1
|
2022-02-25 21:50:04 +01:00
|
|
|
#endif
|
|
|
|
|
2022-05-06 10:30:42 +02:00
|
|
|
#include <zephyr/toolchain/gcc.h>
|
2021-04-19 06:11:19 +02:00
|
|
|
|
2024-05-02 10:39:40 +02:00
|
|
|
/*
|
|
|
|
* Provide these definitions only when minimal libc is used.
|
|
|
|
* Avoid collision with defines from include/zephyr/toolchain/zephyr_stdint.h
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_MINIMAL_LIBC
|
2023-01-23 23:20:45 +01:00
|
|
|
|
2024-04-30 15:36:06 +02:00
|
|
|
#define __int_c(v, suffix) v ## suffix
|
|
|
|
#define int_c(v, suffix) __int_c(v, suffix)
|
|
|
|
#define uint_c(v, suffix) __int_c(v ## U, suffix)
|
|
|
|
|
2024-06-11 05:28:26 +02:00
|
|
|
#ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
|
|
|
|
|
2024-04-30 15:36:06 +02:00
|
|
|
#ifdef __INT64_TYPE__
|
|
|
|
#undef __int_least64_c_suffix__
|
|
|
|
#undef __int_least32_c_suffix__
|
|
|
|
#undef __int_least16_c_suffix__
|
|
|
|
#undef __int_least8_c_suffix__
|
|
|
|
#ifdef __INT64_C_SUFFIX__
|
|
|
|
#define __int_least64_c_suffix__ __INT64_C_SUFFIX__
|
|
|
|
#define __int_least32_c_suffix__ __INT64_C_SUFFIX__
|
|
|
|
#define __int_least16_c_suffix__ __INT64_C_SUFFIX__
|
|
|
|
#define __int_least8_c_suffix__ __INT64_C_SUFFIX__
|
|
|
|
#endif /* __INT64_C_SUFFIX__ */
|
|
|
|
#endif /* __INT64_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT_LEAST64_TYPE__
|
|
|
|
#ifdef __int_least64_c_suffix__
|
|
|
|
#define __INT64_C(x) int_c(x, __int_least64_c_suffix__)
|
|
|
|
#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__)
|
|
|
|
#else
|
|
|
|
#define __INT64_C(x) x
|
|
|
|
#define __UINT64_C(x) x ## U
|
|
|
|
#endif /* __int_least64_c_suffix__ */
|
|
|
|
#endif /* __INT_LEAST64_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT32_TYPE__
|
|
|
|
#undef __int_least32_c_suffix__
|
|
|
|
#undef __int_least16_c_suffix__
|
|
|
|
#undef __int_least8_c_suffix__
|
|
|
|
#ifdef __INT32_C_SUFFIX__
|
|
|
|
#define __int_least32_c_suffix__ __INT32_C_SUFFIX__
|
|
|
|
#define __int_least16_c_suffix__ __INT32_C_SUFFIX__
|
|
|
|
#define __int_least8_c_suffix__ __INT32_C_SUFFIX__
|
|
|
|
#endif /* __INT32_C_SUFFIX__ */
|
|
|
|
#endif /* __INT32_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT_LEAST32_TYPE__
|
|
|
|
#ifdef __int_least32_c_suffix__
|
|
|
|
#define __INT32_C(x) int_c(x, __int_least32_c_suffix__)
|
|
|
|
#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__)
|
|
|
|
#else
|
2023-01-23 23:20:45 +01:00
|
|
|
#define __INT32_C(x) x
|
|
|
|
#define __UINT32_C(x) x ## U
|
2024-04-30 15:36:06 +02:00
|
|
|
#endif /* __int_least32_c_suffix__ */
|
|
|
|
#endif /* __INT_LEAST32_TYPE__ */
|
|
|
|
|
2024-06-11 05:31:57 +02:00
|
|
|
#endif /* !CONFIG_ENFORCE_ZEPHYR_STDINT */
|
|
|
|
|
2024-04-30 15:36:06 +02:00
|
|
|
#ifdef __INT16_TYPE__
|
|
|
|
#undef __int_least16_c_suffix__
|
|
|
|
#undef __int_least8_c_suffix__
|
|
|
|
#ifdef __INT16_C_SUFFIX__
|
|
|
|
#define __int_least16_c_suffix__ __INT16_C_SUFFIX__
|
|
|
|
#define __int_least8_c_suffix__ __INT16_C_SUFFIX__
|
|
|
|
#endif /* __INT16_C_SUFFIX__ */
|
|
|
|
#endif /* __INT16_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT_LEAST16_TYPE__
|
|
|
|
#ifdef __int_least16_c_suffix__
|
|
|
|
#define __INT16_C(x) int_c(x, __int_least16_c_suffix__)
|
|
|
|
#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__)
|
|
|
|
#else
|
|
|
|
#define __INT16_C(x) x
|
|
|
|
#define __UINT16_C(x) x ## U
|
|
|
|
#endif /* __int_least16_c_suffix__ */
|
|
|
|
#endif /* __INT_LEAST16_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT8_TYPE__
|
|
|
|
#undef __int_least8_c_suffix__
|
|
|
|
#ifdef __INT8_C_SUFFIX__
|
|
|
|
#define __int_least8_c_suffix__ __INT8_C_SUFFIX__
|
|
|
|
#endif /* __INT8_C_SUFFIX__ */
|
|
|
|
#endif /* __INT8_TYPE__ */
|
|
|
|
|
|
|
|
#ifdef __INT_LEAST8_TYPE__
|
|
|
|
#ifdef __int_least8_c_suffix__
|
|
|
|
#define __INT8_C(x) int_c(x, __int_least8_c_suffix__)
|
|
|
|
#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__)
|
|
|
|
#else
|
|
|
|
#define __INT8_C(x) x
|
|
|
|
#define __UINT8_C(x) x ## U
|
|
|
|
#endif /* __int_least8_c_suffix__ */
|
|
|
|
#endif /* __INT_LEAST8_TYPE__ */
|
2023-01-23 23:20:45 +01:00
|
|
|
|
2024-04-30 15:36:06 +02:00
|
|
|
#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__)
|
|
|
|
#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__)
|
2023-01-23 23:20:45 +01:00
|
|
|
|
2024-05-02 10:39:40 +02:00
|
|
|
#endif /* CONFIG_MINIMAL_LIBC */
|
2021-04-19 06:11:19 +02:00
|
|
|
|
|
|
|
#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_ */
|