Skip to content

Commit 9c5fda3

Browse files
danielfl-iarnashif
authored andcommitted
include: kernel: arch: sys: Use new TLS macro
PR #78645 replaced uses of the GNU keyword `__thread` with a new macro `Z_THREAD_LOCAL` which expands to correspond C/C++ standard keyword if applicable, else it falls back to `__thread`. This PR addresses some missed replacements in headers files for #78645. Signed-off-by: Daniel Flodin <[email protected]>
1 parent 2e6c038 commit 9c5fda3

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

include/zephyr/arch/riscv/syscall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static inline bool arch_is_user_context(void)
158158
}
159159

160160
/* Defined in arch/riscv/core/thread.c */
161-
extern __thread uint8_t is_user_mode;
161+
extern Z_THREAD_LOCAL uint8_t is_user_mode;
162162

163163
return is_user_mode != 0;
164164
}

include/zephyr/arch/xtensa/syscall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static inline bool arch_is_user_context(void)
211211
: "=a" (thread)
212212
);
213213
#ifdef CONFIG_THREAD_LOCAL_STORAGE
214-
extern __thread uint32_t is_user_mode;
214+
extern Z_THREAD_LOCAL uint32_t is_user_mode;
215215

216216
if (!thread) {
217217
return false;

include/zephyr/kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static inline k_tid_t k_current_get(void)
665665
#ifdef CONFIG_CURRENT_THREAD_USE_TLS
666666

667667
/* Thread-local cache of current thread ID, set in z_thread_entry() */
668-
extern __thread k_tid_t z_tls_current;
668+
extern Z_THREAD_LOCAL k_tid_t z_tls_current;
669669

670670
return z_tls_current;
671671
#else

include/zephyr/sys/errno_private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define ZEPHYR_INCLUDE_SYS_ERRNO_PRIVATE_H_
99

1010
#include <zephyr/toolchain.h>
11+
#include <zephyr/types.h> /* For Z_THREAD_LOCAL */
1112

1213
#ifdef __cplusplus
1314
extern "C" {
@@ -26,7 +27,7 @@ static inline int *z_errno(void)
2627
}
2728

2829
#elif defined(CONFIG_ERRNO_IN_TLS)
29-
extern __thread int z_errno_var;
30+
extern Z_THREAD_LOCAL int z_errno_var;
3031

3132
static inline int *z_errno(void)
3233
{

0 commit comments

Comments
 (0)