From bcf15e39e2d4e2243f475852aca7749e40a70fbd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 11 May 2021 14:17:52 -0700 Subject: stage2: add `owns_tv` flag to `Module.Decl` Decl objects need to know whether they are the owner of the Type/Value associated with them, in order to decide whether to destroy the associated Namespace, Fn, or Var when cleaning up. --- src/link/C/zig.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/link') diff --git a/src/link/C/zig.h b/src/link/C/zig.h index 640dfb2345..ad2b5d4498 100644 --- a/src/link/C/zig.h +++ b/src/link/C/zig.h @@ -1,25 +1,15 @@ -#if __STDC_VERSION__ >= 199901L -#include -#else -#define bool unsigned char -#define true 1 -#define false 0 -#endif - #if __STDC_VERSION__ >= 201112L #define zig_noreturn _Noreturn +#define zig_threadlocal thread_local #elif __GNUC__ #define zig_noreturn __attribute__ ((noreturn)) +#define zig_threadlocal __thread #elif _MSC_VER #define zig_noreturn __declspec(noreturn) +#define zig_threadlocal __declspec(thread) #else #define zig_noreturn -#endif - -#if defined(__GNUC__) -#define zig_unreachable() __builtin_unreachable() -#else -#define zig_unreachable() +#define zig_threadlocal zig_threadlocal_unavailable #endif #if __STDC_VERSION__ >= 199901L @@ -30,6 +20,20 @@ #define ZIG_RESTRICT #endif +#if __STDC_VERSION__ >= 199901L +#include +#else +#define bool unsigned char +#define true 1 +#define false 0 +#endif + +#if defined(__GNUC__) +#define zig_unreachable() __builtin_unreachable() +#else +#define zig_unreachable() +#endif + #ifdef __cplusplus #define ZIG_EXTERN_C extern "C" #else -- cgit v1.2.3