diff options
| author | Jay Petacat <jay@jayschwa.net> | 2021-05-05 00:02:16 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-05 03:15:44 -0400 |
| commit | 70a9a3a562582173c140a064762b674e3c761a41 (patch) | |
| tree | 06897ff50e2b4ac3df4881bf0c86df478fe5e78a /src | |
| parent | 785a6c1aa9a7979a962db9d741a53897c423cb92 (diff) | |
| download | zig-70a9a3a562582173c140a064762b674e3c761a41.tar.gz zig-70a9a3a562582173c140a064762b674e3c761a41.zip | |
stage1: Fix other OS target
PR #7827 added some new `std.Target.Os.Tag` before `other`.
The corresponding enum in stage1.h was not updated, which caused a
mismatch in the underlying integer values. While attempting to target
`other`, I encountered crashes.
This PR updates the stage1.h enum to include the added OS tags.
The new tags also had to be added to various switch cases to fix
compiler warnings, but have not been tested in any way.
Diffstat (limited to 'src')
| -rw-r--r-- | src/stage1/stage1.h | 5 | ||||
| -rw-r--r-- | src/stage1/target.cpp | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/stage1/stage1.h b/src/stage1/stage1.h index 59632b9877..6413914f6e 100644 --- a/src/stage1/stage1.h +++ b/src/stage1/stage1.h @@ -56,7 +56,7 @@ enum TargetSubsystem { // ABI warning -// Synchronize with target.cpp::os_list +// Synchronize with std.Target.Os.Tag and target.cpp::os_list enum Os { OsFreestanding, OsAnanas, @@ -94,6 +94,9 @@ enum Os { OsWASI, OsEmscripten, OsUefi, + OsOpenCL, + OsGLSL450, + OsVulkan, OsOther, }; diff --git a/src/stage1/target.cpp b/src/stage1/target.cpp index 6aa3cfcbd0..5a1e18e152 100644 --- a/src/stage1/target.cpp +++ b/src/stage1/target.cpp @@ -122,6 +122,9 @@ static const Os os_list[] = { OsWASI, OsEmscripten, OsUefi, + OsOpenCL, + OsGLSL450, + OsVulkan, OsOther, }; @@ -213,6 +216,9 @@ Os target_os_enum(size_t index) { ZigLLVM_OSType get_llvm_os_type(Os os_type) { switch (os_type) { case OsFreestanding: + case OsOpenCL: + case OsGLSL450: + case OsVulkan: case OsOther: return ZigLLVM_UnknownOS; case OsAnanas: @@ -330,6 +336,9 @@ const char *target_os_name(Os os_type) { case OsHurd: case OsWASI: case OsEmscripten: + case OsOpenCL: + case OsGLSL450: + case OsVulkan: return ZigLLVMGetOSTypeName(get_llvm_os_type(os_type)); } zig_unreachable(); @@ -733,6 +742,9 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) { case OsAMDPAL: case OsHermitCore: case OsHurd: + case OsOpenCL: + case OsGLSL450: + case OsVulkan: zig_panic("TODO c type size in bits for this target"); } zig_unreachable(); @@ -999,6 +1011,10 @@ ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) { case OsWASI: case OsEmscripten: return ZigLLVM_Musl; + case OsOpenCL: + case OsGLSL450: + case OsVulkan: + return ZigLLVM_UnknownEnvironment; } zig_unreachable(); } |
