diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-04-05 23:48:50 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-04-07 13:42:48 +0900 |
commit | f99af439805fe51b38aa1cf79f9c657f857510f4 (patch) | |
tree | c7fb3f820a4031b16d820e474ecb5058d91f152f /ext/-test- | |
parent | cc0b8c47bfb108cb4ad6d5148669c9fac54b6ac4 (diff) | |
download | ruby-f99af439805fe51b38aa1cf79f9c657f857510f4.tar.gz |
[Bug#19161] Detect thread local storage specifier
Checking by `__STDC_VERSION__` is unreliable because old gcc 4.8
supports `-std=gnu11` option but does not implement `_Thread_local`.
Check the implementation directly instead.
Diffstat (limited to 'ext/-test-')
-rw-r--r-- | ext/-test-/thread/instrumentation/instrumentation.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/-test-/thread/instrumentation/instrumentation.c b/ext/-test-/thread/instrumentation/instrumentation.c index d2a2c2740b..edb8738a29 100644 --- a/ext/-test-/thread/instrumentation/instrumentation.c +++ b/ext/-test-/thread/instrumentation/instrumentation.c @@ -8,13 +8,8 @@ static rb_atomic_t resumed_count = 0; static rb_atomic_t suspended_count = 0; static rb_atomic_t exited_count = 0; -#if __STDC_VERSION__ >= 201112 - #define RB_THREAD_LOCAL_SPECIFIER _Thread_local -#elif defined(__GNUC__) && !defined(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED) - /* note that ICC (linux) and Clang are covered by __GNUC__ */ - #define RB_THREAD_LOCAL_SPECIFIER __thread -#else - #define RB_THREAD_LOCAL_SPECIFIER +#ifndef RB_THREAD_LOCAL_SPECIFIER +# define RB_THREAD_LOCAL_SPECIFIER #endif static RB_THREAD_LOCAL_SPECIFIER unsigned int local_ready_count = 0; |