mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-19 12:22:23 -07:00
Fix +build tag logic
This commit is contained in:
@@ -1,45 +1,24 @@
|
||||
//+build !freestanding
|
||||
package runtime
|
||||
|
||||
when ODIN_OS == "freestanding" {
|
||||
_OS_Errno :: distinct int;
|
||||
_OS_Handle :: distinct uintptr;
|
||||
import "core:os"
|
||||
|
||||
os_stdout :: proc "contextless" () -> _OS_Handle {
|
||||
return 1;
|
||||
}
|
||||
os_stderr :: proc "contextless" () -> _OS_Handle {
|
||||
return 2;
|
||||
}
|
||||
_OS_Errno :: distinct int;
|
||||
_OS_Handle :: os.Handle;
|
||||
|
||||
// TODO(bill): reimplement `os.write`
|
||||
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
|
||||
return 0, -1;
|
||||
}
|
||||
|
||||
current_thread_id :: proc "contextless" () -> int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
import "core:os"
|
||||
|
||||
_OS_Errno :: distinct int;
|
||||
_OS_Handle :: os.Handle;
|
||||
|
||||
os_stdout :: proc "contextless" () -> _OS_Handle {
|
||||
return os.stdout;
|
||||
}
|
||||
os_stderr :: proc "contextless" () -> _OS_Handle {
|
||||
return os.stderr;
|
||||
}
|
||||
|
||||
// TODO(bill): reimplement `os.write`
|
||||
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
|
||||
n, err := os.write(fd, data);
|
||||
return int(n), _OS_Errno(err);
|
||||
}
|
||||
|
||||
current_thread_id :: proc "contextless" () -> int {
|
||||
return os.current_thread_id();
|
||||
}
|
||||
os_stdout :: proc "contextless" () -> _OS_Handle {
|
||||
return os.stdout;
|
||||
}
|
||||
os_stderr :: proc "contextless" () -> _OS_Handle {
|
||||
return os.stderr;
|
||||
}
|
||||
|
||||
// TODO(bill): reimplement `os.write`
|
||||
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
|
||||
n, err := os.write(fd, data);
|
||||
return int(n), _OS_Errno(err);
|
||||
}
|
||||
|
||||
current_thread_id :: proc "contextless" () -> int {
|
||||
return os.current_thread_id();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//+build freestanding
|
||||
package runtime
|
||||
|
||||
_OS_Errno :: distinct int;
|
||||
_OS_Handle :: distinct uintptr;
|
||||
|
||||
os_stdout :: proc "contextless" () -> _OS_Handle {
|
||||
return 1;
|
||||
}
|
||||
os_stderr :: proc "contextless" () -> _OS_Handle {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// TODO(bill): reimplement `os.write`
|
||||
os_write :: proc(fd: _OS_Handle, data: []byte) -> (int, _OS_Errno) {
|
||||
return 0, -1;
|
||||
}
|
||||
|
||||
current_thread_id :: proc "contextless" () -> int {
|
||||
return 0;
|
||||
}
|
||||
+8
-8
@@ -4821,16 +4821,16 @@ bool parse_build_tag(Token token_for_pos, String s) {
|
||||
TargetArchKind arch = get_target_arch_from_string(p);
|
||||
if (os != TargetOs_Invalid) {
|
||||
GB_ASSERT(arch == TargetArch_Invalid);
|
||||
if (is_notted && os == build_context.metrics.os) {
|
||||
this_kind_correct = false;
|
||||
} else if (os != build_context.metrics.os) {
|
||||
this_kind_correct = false;
|
||||
if (is_notted) {
|
||||
this_kind_correct = this_kind_correct && (os != build_context.metrics.os);
|
||||
} else {
|
||||
this_kind_correct = this_kind_correct && (os == build_context.metrics.os);
|
||||
}
|
||||
} else if (arch != TargetArch_Invalid) {
|
||||
if (is_notted && arch == build_context.metrics.arch) {
|
||||
this_kind_correct = false;
|
||||
} else if (arch != build_context.metrics.arch) {
|
||||
this_kind_correct = false;
|
||||
if (is_notted) {
|
||||
this_kind_correct = this_kind_correct && (arch != build_context.metrics.arch);
|
||||
} else {
|
||||
this_kind_correct = this_kind_correct && (arch == build_context.metrics.arch);
|
||||
}
|
||||
}
|
||||
if (os == TargetOs_Invalid && arch == TargetArch_Invalid) {
|
||||
|
||||
Reference in New Issue
Block a user