aboutsummaryrefslogtreecommitdiff
path: root/src/build_settings.cpp
diff options
context:
space:
mode:
authorflysand7 <thebumboni@gmail.com>2025-01-17 01:12:23 +0300
committerflysand7 <thebumboni@gmail.com>2025-01-17 01:12:23 +0300
commit4f0206ce08593628bf9458b623f61c2989558f69 (patch)
tree1975f14ce2f710f48530affb629c71a83182ec44 /src/build_settings.cpp
parentaa3f0b86c143802d9e81122698e38361751c7a68 (diff)
Added compile-time checks for thread locals with -no-crt
Now using any thread-local variables with -no-crt enabled will cause a compiler error, unless -no-thread-local is given. Also fixed a minor typo in a comment.
Diffstat (limited to 'src/build_settings.cpp')
-rw-r--r--src/build_settings.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index 93168cf77..b3321637f 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -2133,7 +2133,21 @@ gb_internal bool init_build_paths(String init_filename) {
case TargetOs_openbsd:
case TargetOs_netbsd:
case TargetOs_haiku:
- gb_printf_err("-no-crt on unix systems requires either -default-to-nil-allocator or -default-to-panic-allocator to also be present because the default allocator requires crt\n");
+ gb_printf_err("-no-crt on unix systems requires either -default-to-nil-allocator or -default-to-panic-allocator to also be present, because the default allocator requires crt\n");
+ return false;
+ }
+ }
+
+ if (build_context.no_crt && !build_context.no_thread_local && !build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR) {
+ switch (build_context.metrics.os) {
+ case TargetOs_linux:
+ case TargetOs_darwin:
+ case TargetOs_essence:
+ case TargetOs_freebsd:
+ case TargetOs_openbsd:
+ case TargetOs_netbsd:
+ case TargetOs_haiku:
+ gb_printf_err("-no-crt on unix systems requires either -default-to-nil-allocator or -no-thread-local to also be present, because the temporary allocator is a thread local, which are inaccessible without CRT initializing TLS\n");
return false;
}
}