Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_ #define ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_ /* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined * there. However, __BYTE_ORDER__ is actually being defined later in * this file. So define __BYTE_ORDER__ to skip the check in gcc.h * and undefine after including gcc.h. * * Clang has it defined so there is no need to work around. */ #ifndef __clang__ #define __BYTE_ORDER__ #endif #include <toolchain/gcc.h> #ifndef __clang__ #undef __BYTE_ORDER__ #endif #include <stdbool.h> #ifndef __INT8_C #define __INT8_C(x) x #endif #ifndef INT8_C #define INT8_C(x) __INT8_C(x) #endif #ifndef __UINT8_C #define __UINT8_C(x) x ## U #endif #ifndef UINT8_C #define UINT8_C(x) __UINT8_C(x) #endif #ifndef __INT16_C #define __INT16_C(x) x #endif #ifndef INT16_C #define INT16_C(x) __INT16_C(x) #endif #ifndef __UINT16_C #define __UINT16_C(x) x ## U #endif #ifndef UINT16_C #define UINT16_C(x) __UINT16_C(x) #endif #ifndef __INT32_C #define __INT32_C(x) x #endif #ifndef INT32_C #define INT32_C(x) __INT32_C(x) #endif #ifndef __UINT32_C #define __UINT32_C(x) x ## U #endif #ifndef UINT32_C #define UINT32_C(x) __UINT32_C(x) #endif #ifndef __INT64_C #define __INT64_C(x) x #endif #ifndef INT64_C #define INT64_C(x) __INT64_C(x) #endif #ifndef __UINT64_C #define __UINT64_C(x) x ## ULL #endif #ifndef UINT64_C #define UINT64_C(x) __UINT64_C(x) #endif #ifndef __INTMAX_C #define __INTMAX_C(x) x #endif #ifndef INTMAX_C #define INTMAX_C(x) __INTMAX_C(x) #endif #ifndef __UINTMAX_C #define __UINTMAX_C(x) x ## ULL #endif #ifndef UINTMAX_C #define UINTMAX_C(x) __UINTMAX_C(x) #endif #ifndef __COUNTER__ /* XCC (GCC-based compiler) doesn't support __COUNTER__ * but this should be good enough */ #define __COUNTER__ __LINE__ #endif #undef __in_section_unique #define __in_section_unique(seg) \ __attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__)))) #ifndef __GCC_LINKER_CMD__ #include <xtensa/config/core.h> /* * XCC does not define the following macros with the expected names, but the * HAL defines similar ones. Thus we include it and define the missing macros * ourselves. */ #if XCHAL_MEMORY_ORDER == XTHAL_BIGENDIAN #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ #elif XCHAL_MEMORY_ORDER == XTHAL_LITTLEENDIAN #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #else #error "Cannot determine __BYTE_ORDER__" #endif #endif /* __GCC_LINKER_CMD__ */ #define __builtin_unreachable() do { __ASSERT(false, "Unreachable code"); } \ while (true) #ifdef __deprecated /* * XCC does not support using deprecated attribute in enum, * so just nullify it here to avoid compilation errors. */ #undef __deprecated #define __deprecated #endif #endif |