aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorCarl Åstholm <carl@astholm.se>2025-09-05 17:50:46 +0200
committerCarl Åstholm <carl@astholm.se>2025-11-05 01:31:26 +0100
commit54f2a7c833bf2ca0b370ebe2470bb0dd71206cba (patch)
treebad5322f30fbc01a0b842d8128659d43d947f82e /src/main.zig
parent075d300342afa72f5328c0ee4232151dd0968264 (diff)
downloadzig-54f2a7c833bf2ca0b370ebe2470bb0dd71206cba.tar.gz
zig-54f2a7c833bf2ca0b370ebe2470bb0dd71206cba.zip
Move `std.Target.SubSystem` to `std.zig.Subsystem`
Also updates the field names to conform with the rest of std.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/main.zig b/src/main.zig
index e6815bc424..ccb8935972 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -893,7 +893,7 @@ fn buildOutputType(
var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena);
var override_lib_dir: ?[]const u8 = try EnvVar.ZIG_LIB_DIR.get(arena);
var clang_preprocessor_mode: Compilation.ClangPreprocessorMode = .no;
- var subsystem: ?std.Target.SubSystem = null;
+ var subsystem: ?std.zig.Subsystem = null;
var major_subsystem_version: ?u16 = null;
var minor_subsystem_version: ?u16 = null;
var mingw_unicode_entry_point: bool = false;
@@ -1135,7 +1135,7 @@ fn buildOutputType(
}
n_jobs = num;
} else if (mem.eql(u8, arg, "--subsystem")) {
- subsystem = try parseSubSystem(args_iter.nextOrFatal());
+ subsystem = try parseSubsystem(args_iter.nextOrFatal());
} else if (mem.eql(u8, arg, "-O")) {
mod_opts.optimize_mode = parseOptimizeMode(args_iter.nextOrFatal());
} else if (mem.cutPrefix(u8, arg, "-fentry=")) |rest| {
@@ -2415,7 +2415,7 @@ fn buildOutputType(
} else if (mem.eql(u8, arg, "-rpath") or mem.eql(u8, arg, "--rpath") or mem.eql(u8, arg, "-R")) {
try create_module.rpath_list.append(arena, linker_args_it.nextOrFatal());
} else if (mem.eql(u8, arg, "--subsystem")) {
- subsystem = try parseSubSystem(linker_args_it.nextOrFatal());
+ subsystem = try parseSubsystem(linker_args_it.nextOrFatal());
} else if (mem.eql(u8, arg, "-I") or
mem.eql(u8, arg, "--dynamic-linker") or
mem.eql(u8, arg, "-dynamic-linker"))
@@ -2743,7 +2743,7 @@ fn buildOutputType(
try symbol_wrap_set.put(arena, next_arg, {});
} else if (mem.startsWith(u8, arg, "/subsystem:")) {
var split_it = mem.splitBackwardsScalar(u8, arg, ':');
- subsystem = try parseSubSystem(split_it.first());
+ subsystem = try parseSubsystem(split_it.first());
} else if (mem.startsWith(u8, arg, "/implib:")) {
var split_it = mem.splitBackwardsScalar(u8, arg, ':');
emit_implib = .{ .yes = split_it.first() };
@@ -6657,26 +6657,10 @@ fn warnAboutForeignBinaries(
}
}
-fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem {
- if (mem.eql(u8, next_arg, "console")) {
- return .Console;
- } else if (mem.eql(u8, next_arg, "windows")) {
- return .Windows;
- } else if (mem.eql(u8, next_arg, "posix")) {
- return .Posix;
- } else if (mem.eql(u8, next_arg, "native")) {
- return .Native;
- } else if (mem.eql(u8, next_arg, "efi_application")) {
- return .EfiApplication;
- } else if (mem.eql(u8, next_arg, "efi_boot_service_driver")) {
- return .EfiBootServiceDriver;
- } else if (mem.eql(u8, next_arg, "efi_rom")) {
- return .EfiRom;
- } else if (mem.eql(u8, next_arg, "efi_runtime_driver")) {
- return .EfiRuntimeDriver;
- } else {
+fn parseSubsystem(arg: []const u8) !std.zig.Subsystem {
+ return std.meta.stringToEnum(std.zig.Subsystem, arg) orelse
fatal("invalid: --subsystem: '{s}'. Options are:\n{s}", .{
- next_arg,
+ arg,
\\ console
\\ windows
\\ posix
@@ -6687,7 +6671,6 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem {
\\ efi_runtime_driver
\\
});
- }
}
/// Model a header searchlist as a group.