mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Error if -no-thread-local is used in presence of -no-crt on Unix
This commit is contained in:
+10
-5
@@ -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) {
|
if (build_context.no_crt && !build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR && !build_context.ODIN_DEFAULT_TO_PANIC_ALLOCATOR) {
|
||||||
switch (build_context.metrics.os) {
|
switch (build_context.metrics.os) {
|
||||||
case TargetOs_linux:
|
case TargetOs_linux:
|
||||||
@@ -2133,12 +2134,12 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
case TargetOs_openbsd:
|
case TargetOs_openbsd:
|
||||||
case TargetOs_netbsd:
|
case TargetOs_netbsd:
|
||||||
case TargetOs_haiku:
|
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;
|
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) {
|
switch (build_context.metrics.os) {
|
||||||
case TargetOs_linux:
|
case TargetOs_linux:
|
||||||
case TargetOs_darwin:
|
case TargetOs_darwin:
|
||||||
@@ -2147,11 +2148,15 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
case TargetOs_openbsd:
|
case TargetOs_openbsd:
|
||||||
case TargetOs_netbsd:
|
case TargetOs_netbsd:
|
||||||
case TargetOs_haiku:
|
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");
|
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");
|
||||||
return false;
|
no_crt_checks_failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (no_crt_checks_failed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1822,19 +1822,6 @@ gb_internal Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *nam
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Entity_Variable:
|
case Entity_Variable:
|
||||||
if (e->kind == Entity_Variable && build_context.no_crt && !build_context.no_thread_local && e->Variable.thread_local_model != "") {
|
|
||||||
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:
|
|
||||||
Token token = ast_token(n);
|
|
||||||
error(token, "Illegal usage of thread locals: '%.*s'", LIT(e->token.string));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e->flags |= EntityFlag_Used;
|
e->flags |= EntityFlag_Used;
|
||||||
if (type == t_invalid) {
|
if (type == t_invalid) {
|
||||||
o->type = t_invalid;
|
o->type = t_invalid;
|
||||||
|
|||||||
Reference in New Issue
Block a user