From f587209e04f93ac36fdd2e4b4f831e87b240f9ae Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Fri, 7 Nov 2025 19:15:55 -0800 Subject: Move/coalesce CompressDebugSections enum to `std.zig.CompressDebugSections` --- src/main.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index ccb8935972..4903889231 100644 --- a/src/main.zig +++ b/src/main.zig @@ -850,7 +850,7 @@ fn buildOutputType( var disable_c_depfile = false; var linker_sort_section: ?link.File.Lld.Elf.SortSection = null; var linker_gc_sections: ?bool = null; - var linker_compress_debug_sections: ?link.File.Lld.Elf.CompressDebugSections = null; + var linker_compress_debug_sections: ?std.zig.CompressDebugSections = null; var linker_allow_shlib_undefined: ?bool = null; var allow_so_scripts: bool = false; var linker_bind_global_refs_locally: ?bool = null; @@ -1167,11 +1167,11 @@ fn buildOutputType( } else if (mem.eql(u8, arg, "-install_name")) { install_name = args_iter.nextOrFatal(); } else if (mem.cutPrefix(u8, arg, "--compress-debug-sections=")) |param| { - linker_compress_debug_sections = std.meta.stringToEnum(link.File.Lld.Elf.CompressDebugSections, param) orelse { + linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, param) orelse { fatal("expected --compress-debug-sections=[none|zlib|zstd], found '{s}'", .{param}); }; } else if (mem.eql(u8, arg, "--compress-debug-sections")) { - linker_compress_debug_sections = link.File.Lld.Elf.CompressDebugSections.zlib; + linker_compress_debug_sections = .zlib; } else if (mem.eql(u8, arg, "-pagezero_size")) { const next_arg = args_iter.nextOrFatal(); pagezero_size = std.fmt.parseUnsigned(u64, eatIntPrefix(next_arg, 16), 16) catch |err| { @@ -2335,7 +2335,7 @@ fn buildOutputType( if (it.only_arg.len == 0) { linker_compress_debug_sections = .zlib; } else { - linker_compress_debug_sections = std.meta.stringToEnum(link.File.Lld.Elf.CompressDebugSections, it.only_arg) orelse { + linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, it.only_arg) orelse { fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{it.only_arg}); }; } @@ -2523,7 +2523,7 @@ fn buildOutputType( try linker_export_symbol_names.append(arena, linker_args_it.nextOrFatal()); } else if (mem.eql(u8, arg, "--compress-debug-sections")) { const arg1 = linker_args_it.nextOrFatal(); - linker_compress_debug_sections = std.meta.stringToEnum(link.File.Lld.Elf.CompressDebugSections, arg1) orelse { + linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, arg1) orelse { fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{arg1}); }; } else if (mem.cutPrefix(u8, arg, "-z")) |z_rest| { -- cgit v1.2.3 From da77d306b637f9ecd4ad4657978b22063c9ecf1d Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Fri, 7 Nov 2025 19:16:52 -0800 Subject: Move/coalesce RcIncludes enum to `std.zig.RcIncludes` --- lib/std/Build/Step/Compile.zig | 3 +-- lib/std/zig.zig | 11 +++++++++++ src/Compilation.zig | 15 ++------------- src/main.zig | 6 +++--- 4 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src/main.zig') diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index f36b584339..85257b9560 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -66,13 +66,12 @@ installed_headers: std.array_list.Managed(HeaderInstallation), /// created otherwise. installed_headers_include_tree: ?*Step.WriteFile = null, -// keep in sync with src/Compilation.zig:RcIncludes /// Behavior of automatic detection of include directories when compiling .rc files. /// any: Use MSVC if available, fall back to MinGW. /// msvc: Use MSVC include paths (must be present on the system). /// gnu: Use MinGW include paths (distributed with Zig). /// none: Do not use any autodetected include paths. -rc_includes: enum { any, msvc, gnu, none } = .any, +rc_includes: std.zig.RcIncludes = .any, /// (Windows) .manifest file to embed in the compilation /// Set via options; intended to be read-only after that. diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 1b65571e1b..4c0203b83d 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -379,6 +379,17 @@ pub const Subsystem = enum { pub const CompressDebugSections = enum { none, zlib, zstd }; +pub const RcIncludes = enum { + /// Use MSVC if available, fall back to MinGW. + any, + /// Use MSVC include paths (MSVC install + Windows SDK, must be present on the system). + msvc, + /// Use MinGW include paths (distributed with Zig). + gnu, + /// Do not use any autodetected include paths. + none, +}; + /// Renders a `std.Target.Cpu` value into a textual representation that can be parsed /// via the `-mcpu` flag passed to the Zig compiler. /// Appends the result to `buffer`. diff --git a/src/Compilation.zig b/src/Compilation.zig index 967c035213..3076cfdc6d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -195,7 +195,7 @@ self_exe_path: ?[]const u8, dirs: Directories, libc_include_dir_list: []const []const u8, libc_framework_dir_list: []const []const u8, -rc_includes: RcIncludes, +rc_includes: std.zig.RcIncludes, mingw_unicode_entry_point: bool, thread_pool: *ThreadPool, @@ -954,17 +954,6 @@ pub const RcSourceFile = struct { extra_flags: []const []const u8 = &.{}, }; -pub const RcIncludes = enum { - /// Use MSVC if available, fall back to MinGW. - any, - /// Use MSVC include paths (MSVC install + Windows SDK, must be present on the system). - msvc, - /// Use MinGW include paths (distributed with Zig). - gnu, - /// Do not use any autodetected include paths. - none, -}; - const Job = union(enum) { /// Given the generated AIR for a function, put it onto the code generation queue. /// This `Job` exists (instead of the `link.ZcuTask` being directly queued) to ensure that @@ -1680,7 +1669,7 @@ pub const CreateOptions = struct { c_source_files: []const CSourceFile = &.{}, rc_source_files: []const RcSourceFile = &.{}, manifest_file: ?[]const u8 = null, - rc_includes: RcIncludes = .any, + rc_includes: std.zig.RcIncludes = .any, link_inputs: []const link.Input = &.{}, framework_dirs: []const []const u8 = &[0][]const u8{}, frameworks: []const Framework = &.{}, diff --git a/src/main.zig b/src/main.zig index 4903889231..9606bf2c30 100644 --- a/src/main.zig +++ b/src/main.zig @@ -918,7 +918,7 @@ fn buildOutputType( var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty; var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty; var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; - var rc_includes: Compilation.RcIncludes = .any; + var rc_includes: std.zig.RcIncludes = .any; var manifest_file: ?[]const u8 = null; var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .empty; @@ -6787,8 +6787,8 @@ fn accessFrameworkPath( return false; } -fn parseRcIncludes(arg: []const u8) Compilation.RcIncludes { - return std.meta.stringToEnum(Compilation.RcIncludes, arg) orelse +fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes { + return std.meta.stringToEnum(std.zig.RcIncludes, arg) orelse fatal("unsupported rc includes type: '{s}'", .{arg}); } -- cgit v1.2.3