aboutsummaryrefslogtreecommitdiff
path: root/src/build_settings.cpp
diff options
context:
space:
mode:
authorflysand7 <thebumboni@gmail.com>2025-01-17 02:15:30 +0300
committerflysand7 <thebumboni@gmail.com>2025-01-17 02:51:22 +0300
commit3f20b6324353cfb9e3ad27fe9ee5f8d07148911b (patch)
tree84224438fea8d3962b69284fc98db5258eee7428 /src/build_settings.cpp
parent4f0206ce08593628bf9458b623f61c2989558f69 (diff)
Error if -no-thread-local is used in presence of -no-crt on Unix
Diffstat (limited to 'src/build_settings.cpp')
-rw-r--r--src/build_settings.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index b3321637f..a8d06d56d 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -2124,6 +2124,7 @@ gb_internal bool init_build_paths(String init_filename) {
}
}
+ bool no_crt_checks_failed = false;
if (build_context.no_crt && !build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR && !build_context.ODIN_DEFAULT_TO_PANIC_ALLOCATOR) {
switch (build_context.metrics.os) {
case TargetOs_linux:
@@ -2133,12 +2134,12 @@ 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");
- return false;
+ 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");
+ no_crt_checks_failed = true;
}
}
- if (build_context.no_crt && !build_context.no_thread_local && !build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR) {
+ if (build_context.no_crt && !build_context.no_thread_local) {
switch (build_context.metrics.os) {
case TargetOs_linux:
case TargetOs_darwin:
@@ -2147,11 +2148,15 @@ 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 -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;
+ gb_printf_err("-no-crt on Unix systems requires the -no-thread-local flag to also be present, because the TLS is inaccessible without CRT\n");
+ no_crt_checks_failed = true;
}
}
+ if (no_crt_checks_failed) {
+ return false;
+ }
+
return true;
}