Skip to content

Commit 7e32b20

Browse files
ceolinkartben
authored andcommitted
toolchain: xcc: Avoid undefs
Re-order some definitions and header inclusion to avoid undef symbols. Signed-off-by: Flavio Ceolin <[email protected]>
1 parent e0f94f8 commit 7e32b20

File tree

1 file changed

+14
-19
lines changed
  • include/zephyr/toolchain

1 file changed

+14
-19
lines changed

include/zephyr/toolchain/xcc.h

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
1212
#endif
1313

14+
/*
15+
* XCC does not support using deprecated attribute in enum,
16+
* so just nullify it here to avoid compilation errors.
17+
*/
18+
#define __deprecated
19+
20+
#define __in_section_unique(seg) \
21+
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
22+
23+
#define __in_section_unique_named(seg, name) \
24+
__attribute__((section("." STRINGIFY(seg) \
25+
"." STRINGIFY(__COUNTER__) \
26+
"." STRINGIFY(name))))
27+
1428
/* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined
1529
* there. However, __BYTE_ORDER__ is actually being defined later in
1630
* this file. So define __BYTE_ORDER__ to skip the check in gcc.h
@@ -121,16 +135,6 @@
121135
#define __COUNTER__ __LINE__
122136
#endif
123137

124-
#undef __in_section_unique
125-
#define __in_section_unique(seg) \
126-
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
127-
128-
#undef __in_section_unique_named
129-
#define __in_section_unique_named(seg, name) \
130-
__attribute__((section("." STRINGIFY(seg) \
131-
"." STRINGIFY(__COUNTER__) \
132-
"." STRINGIFY(name))))
133-
134138
#ifndef __GCC_LINKER_CMD__
135139
#include <xtensa/config/core.h>
136140

@@ -155,13 +159,4 @@
155159
#define __sync_synchronize() do { __asm__ __volatile__ ("" ::: "memory"); } \
156160
while (false)
157161

158-
#ifdef __deprecated
159-
/*
160-
* XCC does not support using deprecated attribute in enum,
161-
* so just nullify it here to avoid compilation errors.
162-
*/
163-
#undef __deprecated
164-
#define __deprecated
165-
#endif
166-
167162
#endif

0 commit comments

Comments
 (0)