aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-11 14:17:52 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-11 14:17:52 -0700
commitbcf15e39e2d4e2243f475852aca7749e40a70fbd (patch)
tree367c697ea25a0649a263d13131ffaf0ec3f82ad4 /src/link
parentdae22a0a1f13cc963e96cd704941eed29b8dde27 (diff)
downloadzig-bcf15e39e2d4e2243f475852aca7749e40a70fbd.tar.gz
zig-bcf15e39e2d4e2243f475852aca7749e40a70fbd.zip
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.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/C/zig.h32
1 files changed, 18 insertions, 14 deletions
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 <stdbool.h>
-#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 <stdbool.h>
+#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