diff --git a/include/zephyr/toolchain/xcc.h b/include/zephyr/toolchain/xcc.h index ae4bb811ec0..4078556e9e3 100644 --- a/include/zephyr/toolchain/xcc.h +++ b/include/zephyr/toolchain/xcc.h @@ -11,6 +11,20 @@ #error Please do not include toolchain-specific headers directly, use instead #endif +/* + * XCC does not support using deprecated attribute in enum, + * so just nullify it here to avoid compilation errors. + */ +#define __deprecated + +#define __in_section_unique(seg) \ + __attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__)))) + +#define __in_section_unique_named(seg, name) \ + __attribute__((section("." STRINGIFY(seg) \ + "." STRINGIFY(__COUNTER__) \ + "." STRINGIFY(name)))) + /* 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 @@ -121,16 +135,6 @@ #define __COUNTER__ __LINE__ #endif -#undef __in_section_unique -#define __in_section_unique(seg) \ - __attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__)))) - -#undef __in_section_unique_named -#define __in_section_unique_named(seg, name) \ - __attribute__((section("." STRINGIFY(seg) \ - "." STRINGIFY(__COUNTER__) \ - "." STRINGIFY(name)))) - #ifndef __GCC_LINKER_CMD__ #include @@ -155,13 +159,4 @@ #define __sync_synchronize() do { __asm__ __volatile__ ("" ::: "memory"); } \ while (false) -#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