From a37a564b66b363cc509cc5cdd16fd65b7950b0be Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 27 Aug 2024 15:50:42 -0400 Subject: prelude: Define thread_local --- src/prelude.h | 20 +++++++++++++++++--- src/thread.h | 8 -------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/prelude.h b/src/prelude.h index 9aaec04..59fa645 100644 --- a/src/prelude.h +++ b/src/prelude.h @@ -19,10 +19,24 @@ // Get the static_assert() definition as well as __GLIBC__ #include +// Get the convenience macros that became standard spellings in C23 #if __STDC_VERSION__ < C23 -# include -# include -#endif + +/** _Alignas(), _Alignof() => alignas(), alignof() */ +#include +/** _Bool => bool, true, false */ +#include + +/** + * C23 deprecates `noreturn void` in favour of `[[noreturn]] void`, so we expose + * _noreturn instead with the other attributes. + */ +// #include + +/** Part of , but we don't use anything else from it. */ +#define thread_local _Thread_local + +#endif // !C23 // bfs packaging configuration diff --git a/src/thread.h b/src/thread.h index db11bd8..dbf11ce 100644 --- a/src/thread.h +++ b/src/thread.h @@ -11,14 +11,6 @@ #include "prelude.h" #include -#if __STDC_VERSION__ < C23 && !defined(thread_local) -# if BFS_USE_THREADS_H -# include -# else -# define thread_local _Thread_local -# endif -#endif - /** Thread entry point type. */ typedef void *thread_fn(void *arg); -- cgit v1.2.3