diff options
Diffstat (limited to 'include/cpu_features_macros.h')
-rw-r--r-- | include/cpu_features_macros.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/cpu_features_macros.h b/include/cpu_features_macros.h index 2227160..52cb712 100644 --- a/include/cpu_features_macros.h +++ b/include/cpu_features_macros.h @@ -140,4 +140,22 @@ #define CPU_FEATURES_COMPILED_MIPS_MSA defined(__mips_msa) #endif +//////////////////////////////////////////////////////////////////////////////// +// Miscellaneous +//////////////////////////////////////////////////////////////////////////////// + +#ifndef thread_local +#if __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__ +#define thread_local _Thread_local +#elif defined _WIN32 && (defined _MSC_VER || defined __ICL || \ + defined __DMC__ || defined __BORLANDC__) +#define thread_local __declspec(thread) +/* note that ICC (linux) and Clang are covered by __GNUC__ */ +#elif defined __GNUC__ || defined __SUNPRO_C || defined __xlC__ +#define thread_local __thread +#else +#error "Cannot define thread_local" +#endif +#endif + #endif // CPU_FEATURES_INCLUDE_CPU_FEATURES_MACROS_H_ |