Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings

This commit is contained in:
gingerBill
2022-01-20 19:56:05 +00:00
parent cfbc1a447b
commit 3d7d347192
101 changed files with 341 additions and 310 deletions
+1 -1
View File
@@ -539,7 +539,7 @@ __init_context :: proc "contextless" (c: ^Context) {
}
default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code_Location) -> ! {
when ODIN_OS == "freestanding" {
when ODIN_OS == .Freestanding {
// Do nothing
} else {
print_caller_location(loc)
+1 -1
View File
@@ -32,7 +32,7 @@ nil_allocator :: proc() -> Allocator {
when ODIN_OS == "freestanding" {
when ODIN_OS == .Freestanding {
default_allocator_proc :: nil_allocator_proc
default_allocator :: nil_allocator
}
@@ -3,7 +3,7 @@ package runtime
DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE: int : #config(DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE, 1<<22)
when ODIN_OS == "freestanding" || ODIN_OS == "js" || ODIN_DEFAULT_TO_NIL_ALLOCATOR {
when ODIN_OS == .Freestanding || ODIN_OS == .JS || ODIN_DEFAULT_TO_NIL_ALLOCATOR {
Default_Temp_Allocator :: struct {}
default_temp_allocator_init :: proc(s: ^Default_Temp_Allocator, size: int, backup_allocator := context.allocator) {}
+1 -1
View File
@@ -22,7 +22,7 @@ when ODIN_BUILD_MODE == .Dynamic {
return true
}
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
when ODIN_ARCH == "i386" || ODIN_NO_CRT {
when ODIN_ARCH == .i386 || ODIN_NO_CRT {
@(link_name="mainCRTStartup", linkage="strong", require)
mainCRTStartup :: proc "stdcall" () -> i32 {
context = default_context()
+2 -2
View File
@@ -1,7 +1,7 @@
package runtime
bounds_trap :: proc "contextless" () -> ! {
when ODIN_OS == "windows" {
when ODIN_OS == .Windows {
windows_trap_array_bounds()
} else {
trap()
@@ -9,7 +9,7 @@ bounds_trap :: proc "contextless" () -> ! {
}
type_assertion_trap :: proc "contextless" () -> ! {
when ODIN_OS == "windows" {
when ODIN_OS == .Windows {
windows_trap_type_assertion()
} else {
trap()
+1 -1
View File
@@ -3,7 +3,7 @@ package runtime
import "core:intrinsics"
@(private="file")
IS_WASM :: ODIN_ARCH == "wasm32" || ODIN_ARCH == "wasm64"
IS_WASM :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64
@(private)
RUNTIME_LINKAGE :: "strong" when (
+2 -2
View File
@@ -1,6 +1,6 @@
package runtime
when ODIN_NO_CRT && ODIN_OS == "windows" {
when ODIN_NO_CRT && ODIN_OS == .Windows {
foreign import lib "system:NtDll.lib"
@(private="file")
@@ -25,7 +25,7 @@ when ODIN_NO_CRT && ODIN_OS == "windows" {
RtlMoveMemory(dst, src, len)
return dst
}
} else when ODIN_NO_CRT || (ODIN_ARCH == "wasm32" || ODIN_ARCH == "wasm64") {
} else when ODIN_NO_CRT || (ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64) {
@(link_name="memset", linkage="strong", require)
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr {
if ptr != nil && len != 0 {