| ... | @@ -2437,6 +2437,7 @@ pub const TargetQuery = struct { | ... | @@ -2437,6 +2437,7 @@ pub const TargetQuery = struct { |
| 2437 | }; | 2437 | }; |
| 2438 | } | 2438 | } |
| 2439 | }; | 2439 | }; |
| | 2440 | |
| 2440 | pub const ObjectFormat = enum(u4) { | 2441 | pub const ObjectFormat = enum(u4) { |
| 2441 | c, | 2442 | c, |
| 2442 | coff, | 2443 | coff, |
| ... | @@ -2451,8 +2452,17 @@ pub const TargetQuery = struct { | ... | @@ -2451,8 +2452,17 @@ pub const TargetQuery = struct { |
| 2451 | default, | 2452 | default, |
| 2452 | | 2453 | |
| 2453 | pub fn init(x: ?std.Target.ObjectFormat) @This() { | 2454 | pub fn init(x: ?std.Target.ObjectFormat) @This() { |
| 2454 | // TODO comptime assert the enums match | 2455 | return switch (x orelse return .default) { |
| 2455 | return @enumFromInt(@intFromEnum(x orelse return .default)); | 2456 | .c => .c, |
| | 2457 | .coff => .coff, |
| | 2458 | .elf => .elf, |
| | 2459 | .hex => .hex, |
| | 2460 | .macho => .macho, |
| | 2461 | .plan9 => .plan9, |
| | 2462 | .raw => .raw, |
| | 2463 | .spirv => .spirv, |
| | 2464 | .wasm => .wasm, |
| | 2465 | }; |
| 2456 | } | 2466 | } |
| 2457 | | 2467 | |
| 2458 | pub fn unwrap(this: @This()) ?std.Target.ObjectFormat { | 2468 | pub fn unwrap(this: @This()) ?std.Target.ObjectFormat { |