src/cx/common.h

changeset 1650
aa8621b58cd7
parent 1536
b65c05e7be3c
equal deleted inserted replaced
1649:fef6bc928c87 1650:aa8621b58cd7
255 */ 255 */
256 #define cx_attr_nodiscard __attribute__((__warn_unused_result__)) 256 #define cx_attr_nodiscard __attribute__((__warn_unused_result__))
257 257
258 258
259 // --------------------------------------------------------------------------- 259 // ---------------------------------------------------------------------------
260 // MSVC specifics 260 // Support for thread_local
261 // --------------------------------------------------------------------------- 261 // ---------------------------------------------------------------------------
262 262
263 #ifdef __cplusplus
264 #define cx_thread_local thread_local
265 #else // ! __cplusplus
263 #ifdef _MSC_VER 266 #ifdef _MSC_VER
264 // fix missing _Thread_local support 267 #define cx_thread_local __declspec(thread)
265 #define _Thread_local __declspec(thread) 268 #else // ! _MSC_VER
269 #if __STDC_VERSION__ < 202300L
270 #define cx_thread_local _Thread_local
271 #else // C23 or newer
272 #define cx_thread_local thread_local
273 #endif // C23
266 #endif // _MSC_VER 274 #endif // _MSC_VER
275 #endif // __cplusplus
267 276
268 // --------------------------------------------------------------------------- 277 // ---------------------------------------------------------------------------
269 // Exported and inlined functions 278 // Exported and inlined functions
270 // --------------------------------------------------------------------------- 279 // ---------------------------------------------------------------------------
271 280

mercurial