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