From 2c93c6e91b6ed5177cd45336899f73940d1fa600 Mon Sep 17 00:00:00 2001 From: K4 Date: Tue, 21 Jul 2026 12:59:11 +0300 Subject: [PATCH] `std.lang.OptimizeMode` -> `std.lang.Optimize` migration progress --- build.zig | 12 +++---- lib/compiler/Maker.zig | 4 +-- lib/compiler/Maker/Graph.zig | 2 +- lib/compiler/Maker/Step/Compile.zig | 10 +++--- lib/compiler/Maker/Step/TranslateC.zig | 2 +- lib/compiler/Maker/WebServer.zig | 4 +-- lib/compiler/std-docs.zig | 4 +-- lib/std/Build.zig | 10 +++--- lib/std/Build/Configuration.zig | 2 +- lib/std/Build/Module.zig | 4 +-- lib/std/Build/Step/TranslateC.zig | 6 ++-- lib/std/Io/Threaded.zig | 4 +-- lib/std/heap/debug_allocator.zig | 2 +- lib/std/log.zig | 2 +- lib/std/os/windows.zig | 4 +-- lib/std/process/Args.zig | 4 +-- src/codegen/riscv64/CodeGen.zig | 2 +- src/codegen/sparc64/CodeGen.zig | 2 +- src/main.zig | 2 +- .../invalid_member_of_builtin_enum.zig | 4 +-- test/cli/options/build.zig | 2 +- test/src/Cases.zig | 2 +- test/src/Debugger.zig | 4 +-- test/src/ErrorTrace.zig | 2 +- test/src/Libc.zig | 2 +- test/src/Link.zig | 2 +- test/src/LlvmIr.zig | 2 +- test/src/StackTrace.zig | 2 +- test/standalone/c_compiler/build.zig | 10 +++--- test/standalone/c_embed_path/build.zig | 2 +- test/standalone/child_process/build.zig | 2 +- test/standalone/coff_dwarf/build.zig | 2 +- test/standalone/compile_asm/build.zig | 2 +- test/standalone/dep_diamond/build.zig | 2 +- .../dep_mutually_recursive/build.zig | 2 +- test/standalone/dep_recursive/build.zig | 2 +- test/standalone/dep_shared_builtin/build.zig | 2 +- test/standalone/dep_triangle/build.zig | 2 +- test/standalone/dependency_options/build.zig | 6 ++-- test/standalone/dirname/build.zig | 4 +-- test/standalone/elf2/build.zig | 2 +- .../standalone/embed_generated_file/build.zig | 4 +-- test/standalone/emit_asm_no_bin/build.zig | 2 +- test/standalone/emit_llvm_no_bin/build.zig | 2 +- test/standalone/empty_env/build.zig | 2 +- test/standalone/entry_point/build.zig | 4 +-- test/standalone/env_vars/build.zig | 2 +- test/standalone/extern/build.zig | 2 +- test/standalone/glibc_compat/build.zig | 6 ++-- test/standalone/global_linkage/build.zig | 2 +- test/standalone/install_headers/build.zig | 8 ++--- test/standalone/install_raw_hex/build.zig | 2 +- test/standalone/ios/build.zig | 2 +- test/standalone/issue_11595/build.zig | 2 +- test/standalone/issue_12706/build.zig | 2 +- test/standalone/issue_339/build.zig | 2 +- test/standalone/issue_5825/build.zig | 2 +- .../standalone/load_dynamic_library/build.zig | 2 +- test/standalone/mix_c_files/build.zig | 10 +++--- test/standalone/mix_o_files/build.zig | 2 +- test/standalone/pkg_import/build.zig | 2 +- test/standalone/posix/build.zig | 2 +- test/standalone/run_cwd/build.zig | 2 +- test/standalone/self_exe_symlink/build.zig | 2 +- test/standalone/shared_library/build.zig | 2 +- test/standalone/simple/build.zig | 2 +- test/standalone/static_c_lib/build.zig | 2 +- test/standalone/strip_empty_loop/build.zig | 2 +- test/standalone/strip_struct_init/build.zig | 2 +- test/standalone/tsan/build.zig | 4 +-- test/standalone/windows_argv/build.zig | 2 +- test/standalone/windows_bat_args/build.zig | 2 +- .../standalone/windows_entry_points/build.zig | 24 ++++++------- test/standalone/windows_paths/build.zig | 2 +- test/standalone/windows_resources/build.zig | 2 +- test/standalone/windows_spawn/build.zig | 2 +- test/standalone/zerolength_check/build.zig | 10 +++--- test/tests.zig | 8 ++--- tools/doctest.zig | 34 +++++++++---------- tools/migrate_langref.zig | 8 ++--- 80 files changed, 160 insertions(+), 160 deletions(-) diff --git a/build.zig b/build.zig index da346f86474aebeb8663de55da7f278090d0a4dd..2e6439b66003c8c575c34365aeb69e1e1e0c04a7 100644 --- a/build.zig +++ b/build.zig @@ -57,7 +57,7 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .root_source_file = b.path("lib/std/std.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }), }); const install_std_docs = b.addInstallDirectory(.{ @@ -431,7 +431,7 @@ pub fn build(b: *std.Build) !void { const test_target_filters = b.option([]const []const u8, "test-target-filter", "Skip tests whose target triple do not match any filter") orelse &[0][]const u8{}; const test_extra_targets = b.option(bool, "test-extra-targets", "Enable running module tests for additional targets") orelse false; - var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined; + var chosen_opt_modes_buf: [4]std.lang.Optimize = undefined; var chosen_mode_index: usize = 0; if (!skip_debug) { chosen_opt_modes_buf[chosen_mode_index] = .debug; @@ -788,7 +788,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { const semver = try std.SemanticVersion.parse(version); const exe = addCompilerStep(b, .{ - .optimize = .ReleaseSmall, + .optimize = .small, .target = b.resolveTargetQuery(std.Target.Query.parse(.{ .arch_os_abi = "wasm32-wasi", // * `nontrapping_bulk_memory_len0` is supported by `wasm2c`. @@ -853,7 +853,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { } const AddCompilerModOptions = struct { - optimize: std.lang.OptimizeMode, + optimize: std.lang.Optimize, target: std.Build.ResolvedTarget, strip: ?bool = null, valgrind: ?bool = null, @@ -1606,7 +1606,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath { .root_module = b.createModule(.{ .root_source_file = b.path("tools/doctest.zig"), .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, }), }); @@ -1649,7 +1649,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath { .root_module = b.createModule(.{ .root_source_file = b.path("tools/docgen.zig"), .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, }), }); diff --git a/lib/compiler/Maker.zig b/lib/compiler/Maker.zig index d32e3e15ad4f9bb37bf6fb9ccb358c9b1ea9f7c4..4d4577f2f179ce0b9af9390a19de77324ad8535f 100644 --- a/lib/compiler/Maker.zig +++ b/lib/compiler/Maker.zig @@ -440,9 +440,9 @@ pub fn main(init: process.Init.Minimal) !void { } else if (mem.eql(u8, arg, "--debug-pkg-config")) { debug_pkg_config = true; } else if (mem.eql(u8, arg, "--debug-rt")) { - graph.debug_compiler_runtime_libs = .Debug; + graph.debug_compiler_runtime_libs = .debug; } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| { - graph.debug_compiler_runtime_libs = stringToEnum(std.lang.OptimizeMode, rest) orelse + graph.debug_compiler_runtime_libs = stringToEnum(std.lang.Optimize, rest) orelse fatal("unrecognized optimization mode: {s}", .{rest}); } else if (is_debug_mode and mem.eql(u8, arg, "--debug-maker-leaks")) { debug_maker_leaks = true; diff --git a/lib/compiler/Maker/Graph.zig b/lib/compiler/Maker/Graph.zig index fabe31d5367c5611bd69612b9c61669af1ec4d12..ec4159991a7bae901142726540bd9cfddd08688e 100644 --- a/lib/compiler/Maker/Graph.zig +++ b/lib/compiler/Maker/Graph.zig @@ -18,7 +18,7 @@ local_cache_root: Directory, zig_lib_directory: Directory, build_root_directory: Directory, -debug_compiler_runtime_libs: ?std.builtin.OptimizeMode = null, +debug_compiler_runtime_libs: ?std.builtin.Optimize = null, incremental: ?bool = null, random_seed: u32 = 0, allow_so_scripts: ?bool = null, diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig index bca0df4de84cc95c42b2067d3ec1f5d65176488b..806b2d0f358f8bc52ee8b5ba5a59c90125bd191e 100644 --- a/lib/compiler/Maker/Step/Compile.zig +++ b/lib/compiler/Maker/Step/Compile.zig @@ -666,7 +666,7 @@ fn lowerZigArgs( try zig_args.ensureUnusedCapacity(gpa, 1); if (graph.debug_compiler_runtime_libs) |mode| switch (mode) { - .Debug => zig_args.appendAssumeCapacity("--debug-rt"), + .debug => zig_args.appendAssumeCapacity("--debug-rt"), else => zig_args.appendAssumeCapacity(try arena.print("--debug-rt={t}", .{mode})), }; @@ -1266,10 +1266,10 @@ fn appendModuleFlags( } switch (m.flags.optimize) { - .debug => zig_args.appendAssumeCapacity("-ODebug"), - .safe => zig_args.appendAssumeCapacity("-OReleaseSafe"), - .fast => zig_args.appendAssumeCapacity("-OReleaseFast"), - .small => zig_args.appendAssumeCapacity("-OReleaseSmall"), + .debug => zig_args.appendAssumeCapacity("-Odebug"), + .safe => zig_args.appendAssumeCapacity("-Osafe"), + .fast => zig_args.appendAssumeCapacity("-Ofast"), + .small => zig_args.appendAssumeCapacity("-Osmall"), .default => {}, } diff --git a/lib/compiler/Maker/Step/TranslateC.zig b/lib/compiler/Maker/Step/TranslateC.zig index 79b8571ba6bfef3474ac68e2036f9bdbd1c2f5f8..d3605c0dcb47993452f05dfddb30dcaede927ea0 100644 --- a/lib/compiler/Maker/Step/TranslateC.zig +++ b/lib/compiler/Maker/Step/TranslateC.zig @@ -4,7 +4,7 @@ const std = @import("std"); const Io = std.Io; const Configuration = std.Build.Configuration; const assert = std.debug.assert; -const OptimizeMode = std.lang.OptimizeMode; +const OptimizeMode = std.lang.Optimize; const Step = @import("../Step.zig"); const Maker = @import("../../Maker.zig"); diff --git a/lib/compiler/Maker/WebServer.zig b/lib/compiler/Maker/WebServer.zig index 1064519adc547a78c26bafc23351a640367178f5..3d470ebea31f212a53a2b7ca1c5f876de64167d1 100644 --- a/lib/compiler/Maker/WebServer.zig +++ b/lib/compiler/Maker/WebServer.zig @@ -531,7 +531,7 @@ fn serveLibFile( fn serveClientWasm( ws: *WebServer, req: *http.Server.Request, - optimize_mode: std.builtin.OptimizeMode, + optimize_mode: std.builtin.Optimize, ) !void { const gpa = ws.graph.cache.gpa; @@ -603,7 +603,7 @@ pub fn serveTarFile(ws: *WebServer, request: *http.Server.Request, paths: []cons try response.end(); } -fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.OptimizeMode) !Cache.Path { +fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.Optimize) !Cache.Path { const root_name = "build-web"; const arch_os_abi = "wasm32-freestanding"; const cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_globals+nontrapping_fptoint+reference_types+sign_ext"; diff --git a/lib/compiler/std-docs.zig b/lib/compiler/std-docs.zig index 0ed2c5bf186c2c91730b1aa4aa1755babdab0be2..09e6df88fdfd07d5416c2e0083fc8085fd22b566 100644 --- a/lib/compiler/std-docs.zig +++ b/lib/compiler/std-docs.zig @@ -259,7 +259,7 @@ fn serveSourcesTar(request: *std.http.Server.Request, context: *Context) !void { fn serveWasm( request: *std.http.Server.Request, context: *Context, - optimize_mode: std.builtin.OptimizeMode, + optimize_mode: std.builtin.Optimize, ) !void { const gpa = context.gpa; const io = context.io; @@ -302,7 +302,7 @@ const autodoc_cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_gl fn buildWasmBinary( arena: Allocator, context: *Context, - optimize_mode: std.builtin.OptimizeMode, + optimize_mode: std.builtin.Optimize, ) !Cache.Path { const gpa = context.gpa; const io = context.io; diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 9471499021f4da8a87b63f8ad91318118a996a25..55271b4a6a4e2977093675e15b82cf40fe54e8cd 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -691,7 +691,7 @@ pub const AssemblyOptions = struct { /// To choose the same computer as the one building the package, pass the /// `host` field of the package's `Build` instance. target: ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.builtin.Optimize, max_rss: u64 = 0, zig_lib_dir: ?LazyPath = null, }; @@ -1188,22 +1188,22 @@ pub fn step(b: *Build, name: []const u8, description: []const u8) *Step { } pub const StandardOptimizeOptionOptions = struct { - preferred_optimize_mode: ?std.builtin.OptimizeMode = null, + preferred_optimize_mode: ?std.builtin.Optimize = null, }; -pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.OptimizeMode { +pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.Optimize { const graph = b.graph; if (options.preferred_optimize_mode) |mode| { if (b.option(bool, "release", "optimize for end users") orelse (graph.release_mode != .off)) { return mode; } else { - return .Debug; + return .debug; } } if (b.option( - std.builtin.OptimizeMode, + std.builtin.Optimize, "optimize", "Prioritize performance, safety, or binary size", )) |mode| { diff --git a/lib/std/Build/Configuration.zig b/lib/std/Build/Configuration.zig index b53fe377189bd4f82a92f3927552b327f84cd9a4..f0337507418a420489755e6eebf4607bbe19054c 100644 --- a/lib/std/Build/Configuration.zig +++ b/lib/std/Build/Configuration.zig @@ -1660,7 +1660,7 @@ pub const Module = struct { small, default, - pub fn init(o: ?std.builtin.OptimizeMode) Optimize { + pub fn init(o: ?std.builtin.Optimize) Optimize { return switch (o orelse return .default) { .debug => .debug, .safe => .safe, diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 7189ecd3e40c232b7a833a9d0bbb257835baab7a..cf25d2f73ffb175ee929c5d42e7e770b7298e040 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -15,7 +15,7 @@ root_source_file: ?LazyPath, import_table: std.array_hash_map.String(*Module), resolved_target: ?std.Build.ResolvedTarget = null, -optimize: ?std.builtin.OptimizeMode = null, +optimize: ?std.builtin.Optimize = null, dwarf_format: ?std.dwarf.Format, c_macros: ArrayList([]const u8), @@ -200,7 +200,7 @@ pub const CreateOptions = struct { imports: []const Import = &.{}, target: ?std.Build.ResolvedTarget = null, - optimize: ?std.builtin.OptimizeMode = null, + optimize: ?std.builtin.Optimize = null, /// `true` requires a compilation that includes this Module to link libc. /// `false` causes a build failure if a compilation that includes this Module would link libc. diff --git a/lib/std/Build/Step/TranslateC.zig b/lib/std/Build/Step/TranslateC.zig index be205bee22b83395a364d9f962f5545888597ada..fbe89039894c8575fee6e24ac7ace02b20232a8a 100644 --- a/lib/std/Build/Step/TranslateC.zig +++ b/lib/std/Build/Step/TranslateC.zig @@ -13,7 +13,7 @@ include_dirs: std.ArrayList(std.Build.Module.IncludeDir) = .empty, system_libs: std.ArrayList(std.Build.Module.SystemLib) = .empty, c_macros: std.ArrayList(Configuration.String) = .empty, target: std.Build.ResolvedTarget, -optimize: std.builtin.OptimizeMode, +optimize: std.builtin.Optimize, output_file: Configuration.GeneratedFileIndex, link_libc: bool, @@ -22,7 +22,7 @@ pub const base_tag: Step.Tag = .translate_c; pub const Options = struct { root_source_file: std.Build.LazyPath, target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, + optimize: std.builtin.Optimize, link_libc: bool = true, }; @@ -50,7 +50,7 @@ pub const AddExecutableOptions = struct { name: ?[]const u8 = null, version: ?std.SemanticVersion = null, target: ?std.Build.ResolvedTarget = null, - optimize: ?std.builtin.OptimizeMode = null, + optimize: ?std.builtin.Optimize = null, linkage: ?std.builtin.LinkMode = null, }; diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index b3610de85dae5f42f39eaafb309c9e4145673daa..9cb2dccf8f9b116ed44c2a23ca22876f9570b09c 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -16972,7 +16972,7 @@ test argvToCommandLineWindows { , \\-O , - \\ReleaseSafe + \\safe , \\-- , @@ -16981,7 +16981,7 @@ test argvToCommandLineWindows { \\--eval=new Regex("Dwayne \"The Rock\" Johnson") , }, - \\"C:\Program Files\zig\zig.exe" run .\src\main.zig -target x86_64-windows-gnu -O ReleaseSafe -- --emoji=🗿 "--eval=new Regex(\"Dwayne \\\"The Rock\\\" Johnson\")" + \\"C:\Program Files\zig\zig.exe" run .\src\main.zig -target x86_64-windows-gnu -O safe -- --emoji=🗿 "--eval=new Regex(\"Dwayne \\\"The Rock\\\" Johnson\")" ); try t(&.{}, ""); diff --git a/lib/std/heap/debug_allocator.zig b/lib/std/heap/debug_allocator.zig index 057e63e47ec47ec2e8ada83d2fb65a1bbeeaa524..5d410fe92647d389304da9655537ae86911981ea 100644 --- a/lib/std/heap/debug_allocator.zig +++ b/lib/std/heap/debug_allocator.zig @@ -105,7 +105,7 @@ const Log2USize = std.math.Log2Int(usize); const default_sys_stack_trace_frames: usize = if (std.debug.sys_can_stack_trace) 6 else 0; const default_stack_trace_frames: usize = switch (builtin.mode) { - .Debug => default_sys_stack_trace_frames, + .debug => default_sys_stack_trace_frames, else => 0, }; diff --git a/lib/std/log.zig b/lib/std/log.zig index 9599308b91784eaa0319f1563746de3097405f03..321277a777722fd11b3cf62c1d15239f55c697c6 100644 --- a/lib/std/log.zig +++ b/lib/std/log.zig @@ -52,7 +52,7 @@ pub const Level = enum { /// The default log level is based on build mode. pub const default_level: Level = switch (builtin.mode) { - .Debug => .debug, + .debug => .debug, .safe, .fast, .small => .info, }; diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index f2c3706c2738184e5fcddf0be6cb4521adb50d8a..ce570987c9283e87ff33a858007be693e9348c55 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -3955,7 +3955,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { pub fn statusBug(status: NTSTATUS) UnexpectedError { switch (builtin.mode) { - .Debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{ + .debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{ @backingInt(status), std.enums.tagName(NTSTATUS, status) orelse "", }), @@ -3965,7 +3965,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError { pub fn errorBug(err: Win32Error) UnexpectedError { switch (builtin.mode) { - .Debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{ + .debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{ @backingInt(err), std.enums.tagName(Win32Error, err) orelse "", }), diff --git a/lib/std/process/Args.zig b/lib/std/process/Args.zig index 35e5b7cce411f9064a76dfe7f223d531f9f848c2..353fcfe4247b6709b2505c34c5b0ecc09ec7cb3e 100644 --- a/lib/std/process/Args.zig +++ b/lib/std/process/Args.zig @@ -537,7 +537,7 @@ test "Iterator.Windows" { const t = testIteratorWindows; try t( - \\"C:\Program Files\zig\zig.exe" run .\src\main.zig -target x86_64-windows-gnu -O ReleaseSafe -- --emoji=🗿 --eval="new Regex(\"Dwayne \\\"The Rock\\\" Johnson\")" + \\"C:\Program Files\zig\zig.exe" run .\src\main.zig -target x86_64-windows-gnu -O safe -- --emoji=🗿 --eval="new Regex(\"Dwayne \\\"The Rock\\\" Johnson\")" , &.{ \\C:\Program Files\zig\zig.exe , @@ -551,7 +551,7 @@ test "Iterator.Windows" { , \\-O , - \\ReleaseSafe + \\safe , \\-- , diff --git a/src/codegen/riscv64/CodeGen.zig b/src/codegen/riscv64/CodeGen.zig index 106640f519a47de8a43a420bc539a716f47f711f..f2c3875a4a7d67ba8d73339e93d94cce7579d2f0 100644 --- a/src/codegen/riscv64/CodeGen.zig +++ b/src/codegen/riscv64/CodeGen.zig @@ -8341,7 +8341,7 @@ fn resolveCallingConventionValues( fn wantSafety(func: *Func) bool { return switch (func.mod.optimize_mode) { - .Debug => true, + .debug => true, .safe => true, .fast => false, .small => false, diff --git a/src/codegen/sparc64/CodeGen.zig b/src/codegen/sparc64/CodeGen.zig index e354976c91628f88e6d4c71180ab8cf4351fc538..77241a7826a92929cd04008dac7cd12b3e84aa3c 100644 --- a/src/codegen/sparc64/CodeGen.zig +++ b/src/codegen/sparc64/CodeGen.zig @@ -4766,7 +4766,7 @@ fn truncRegister( /// TODO support scope overrides. Also note this logic is duplicated with `Zcu.wantSafety`. fn wantSafety(self: *Self) bool { return switch (self.bin_file.comp.root_mod.optimize_mode) { - .Debug => true, + .debug => true, .safe => true, .fast => false, .small => false, diff --git a/src/main.zig b/src/main.zig index eb5ae7d15354880032f098a121e8099578ea32c3..7e33a7fdf2d15ec9fa8e1417c0533fb702d22dfd 100644 --- a/src/main.zig +++ b/src/main.zig @@ -805,7 +805,7 @@ const compile_usage = \\ --debug-compile-errors Crash with helpful diagnostics at the first compile error \\ --debug-link-snapshot Enable dumping of the linker's state in JSON format \\ --debug-rt[=mode] Build compiler runtime libraries with [mode] optimization - \\ (Debug if [=mode] is omitted) + \\ (debug if [=mode] is omitted) \\ --debug-incremental Enable incremental compilation debug features \\ ; diff --git a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig index 9902f027bf45c5db93744caa8242194df29a3f41..b9f250823dc3818a616e437c44e02776afb73cf6 100644 --- a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig +++ b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig @@ -1,10 +1,10 @@ const lang = @import("std").lang; export fn entry() void { - const foo = lang.OptimizeMode.x86; + const foo = lang.Optimize.x86; _ = foo; } // error // -// :3:35: error: enum 'lang.Optimize' has no member named 'x86' +// :3:31: error: enum 'lang.Optimize' has no member named 'x86' // : note: enum declared here diff --git a/test/cli/options/build.zig b/test/cli/options/build.zig index 5f1e496c4bf9bdef1745355920533edf71b09061..d352ac587569f90cdb532670a310a8af27f4b9c9 100644 --- a/test/cli/options/build.zig +++ b/test/cli/options/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const main = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, }) }); const options = b.addOptions(); diff --git a/test/src/Cases.zig b/test/src/Cases.zig index c629f42381afb196a4621d6530ba106e788b52b3..77e20147cd7fac1458d528e062f79c2820147538 100644 --- a/test/src/Cases.zig +++ b/test/src/Cases.zig @@ -49,7 +49,7 @@ pub const Case = struct { /// In order to be able to run e.g. Execution updates, this must be set /// to Executable. output_mode: std.builtin.OutputMode, - optimize_mode: std.builtin.OptimizeMode = .Debug, + optimize_mode: std.builtin.Optimize = .debug, files: std.array_list.Managed(File), case: ?union(enum) { diff --git a/test/src/Debugger.zig b/test/src/Debugger.zig index 0e20799f3949884c437bbd39931c29f93a41d5b5..6a8082248547bdaf7f24d70fcebb236ee5035733 100644 --- a/test/src/Debugger.zig +++ b/test/src/Debugger.zig @@ -7,14 +7,14 @@ pub const Options = struct { test_target_filters: []const []const u8, gdb: ?[]const u8, lldb: ?[]const u8, - optimize_modes: []const std.builtin.OptimizeMode, + optimize_modes: []const std.builtin.Optimize, skip_single_threaded: bool, skip_libc: bool, }; pub const Target = struct { resolved: std.Build.ResolvedTarget, - optimize_mode: std.builtin.OptimizeMode = .Debug, + optimize_mode: std.builtin.Optimize = .debug, link_libc: ?bool = null, single_threaded: ?bool = null, pic: ?bool = null, diff --git a/test/src/ErrorTrace.zig b/test/src/ErrorTrace.zig index edaa5bbb0c2043fad31925dd6b58f4fac869403f..15b8e7f46dafc0bf4c155fdf66cf85e7896848cd 100644 --- a/test/src/ErrorTrace.zig +++ b/test/src/ErrorTrace.zig @@ -33,7 +33,7 @@ pub const Options = struct { pub const CaseParameters = struct { target: std.Target.Query = .{}, - optimize: std.builtin.OptimizeMode = .debug, + optimize: OptimizeMode = .debug, use_llvm: ?bool = null, use_lld: ?bool = null, diff --git a/test/src/Libc.zig b/test/src/Libc.zig index 12a4468b1f6d33b7494d7fb87b43636533e8ed90..6474fc43fed2f3a58b4bd5fe2d67d91b6cf145b3 100644 --- a/test/src/Libc.zig +++ b/test/src/Libc.zig @@ -7,7 +7,7 @@ libc_test_src_path: std.Build.LazyPath, test_cases: std.ArrayList(TestCase) = .empty, pub const Options = struct { - optimize_modes: []const std.builtin.OptimizeMode, + optimize_modes: []const std.builtin.Optimize, test_filters: []const []const u8, test_target_filters: []const []const u8, skip_wasm: bool, diff --git a/test/src/Link.zig b/test/src/Link.zig index f0266923e34a380c1e5547c3f180b2d6febbe71c..9478b7eb3a1f885cb6eb61a0478840a595ece3c8 100644 --- a/test/src/Link.zig +++ b/test/src/Link.zig @@ -1,6 +1,6 @@ b: *Build, step: *Step, -optimize: std.builtin.OptimizeMode, +optimize: std.builtin.Optimize, target: std.Build.ResolvedTarget, target_desc: []const u8, use_llvm: bool, diff --git a/test/src/LlvmIr.zig b/test/src/LlvmIr.zig index fc0fddeb32f4893af6b38d1ef80c780fdae4676f..3dce66058b2c3eb21e9046f16091d348826d37a4 100644 --- a/test/src/LlvmIr.zig +++ b/test/src/LlvmIr.zig @@ -27,7 +27,7 @@ const TestCase = struct { // For most cases, we want to test the LLVM IR that we output; we don't want to be in the // business of testing LLVM's optimization passes. `Debug` gets us the closest to that as it // disables the vast majority of passes in LLVM. - optimize: std.builtin.OptimizeMode = .Debug, + optimize: std.builtin.Optimize = .debug, pic: ?bool = null, pie: ?bool = null, red_zone: ?bool = null, diff --git a/test/src/StackTrace.zig b/test/src/StackTrace.zig index 523eadab53f0f1e20b5d013203db3ef58a54e84a..51d5355fa00bd85d5f43a0cba2b59bb82febbd1f 100644 --- a/test/src/StackTrace.zig +++ b/test/src/StackTrace.zig @@ -34,7 +34,7 @@ pub const Options = struct { pub const CaseParameters = struct { linkage: ?std.builtin.LinkMode = null, target: std.Target.Query = .{}, - optimize: std.builtin.OptimizeMode = .debug, + optimize: std.lang.Optimize = .debug, link_libc: ?bool = null, use_llvm: ?bool = null, use_lld: ?bool = null, diff --git a/test/standalone/c_compiler/build.zig b/test/standalone/c_compiler/build.zig index 4dd3eb7e845a8483ab56b048b2f26fe36f51aa12..cae1709b2200d349f32ea16aa20c293e9eaf6401 100644 --- a/test/standalone/c_compiler/build.zig +++ b/test/standalone/c_compiler/build.zig @@ -5,10 +5,10 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - add(b, test_step, "test_c_Debug", "test_cpp_Debug", .Debug); - add(b, test_step, "test_c_ReleaseFast", "test_cpp_ReleaseFast", .ReleaseFast); - add(b, test_step, "test_c_ReleaseSmall", "test_cpp_ReleaseSmall", .ReleaseSmall); - add(b, test_step, "test_c_ReleaseSafe", "test_cpp_ReleaseSafe", .ReleaseSafe); + add(b, test_step, "test_c_debug", "test_cpp_debug", .debug); + add(b, test_step, "test_c_fast", "test_cpp_fast", .fast); + add(b, test_step, "test_c_small", "test_cpp_small", .small); + add(b, test_step, "test_c_safe", "test_cpp_safe", .safe); } fn add( @@ -16,7 +16,7 @@ fn add( test_step: *std.Build.Step, c_name: []const u8, cpp_name: []const u8, - optimize: std.builtin.OptimizeMode, + optimize: std.builtin.Optimize, ) void { const target = b.graph.host; diff --git a/test/standalone/c_embed_path/build.zig b/test/standalone/c_embed_path/build.zig index 246e18b3f0dec9a657ef98297f7a105cc1d8dd88..21ba97d3e984f69c55a40fea5cdbd659e05500fa 100644 --- a/test/standalone/c_embed_path/build.zig +++ b/test/standalone/c_embed_path/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const exe = b.addExecutable(.{ .name = "test", diff --git a/test/standalone/child_process/build.zig b/test/standalone/child_process/build.zig index 9e96aaa608e05c3792f434fb62a9668e061c4192..9abf401665367c7f82be82a230d69a83b96f341b 100644 --- a/test/standalone/child_process/build.zig +++ b/test/standalone/child_process/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag == .wasi) return; diff --git a/test/standalone/coff_dwarf/build.zig b/test/standalone/coff_dwarf/build.zig index d35e744a6c32d5c0b7a98f52c746506c2aefd2e2..6ff69e948964dac924043d3635a50df44757a279 100644 --- a/test/standalone/coff_dwarf/build.zig +++ b/test/standalone/coff_dwarf/build.zig @@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = switch (host.result.os.tag) { .windows => host, else => b.resolveTargetQuery(.{ .os_tag = .windows }), diff --git a/test/standalone/compile_asm/build.zig b/test/standalone/compile_asm/build.zig index ee82332973d072bf7464dca1f2c4606e09c4e4eb..1cd675bc9b6a14a7a31f7299255f8c85cf27a0cc 100644 --- a/test/standalone/compile_asm/build.zig +++ b/test/standalone/compile_asm/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.resolveTargetQuery(.{ .os_tag = .freestanding, .cpu_arch = .arm, diff --git a/test/standalone/dep_diamond/build.zig b/test/standalone/dep_diamond/build.zig index ba437c310abd4411db868265be93bc2438929d83..db78e8336384dd6a651aaa956f656fb093f615f4 100644 --- a/test/standalone/dep_diamond/build.zig +++ b/test/standalone/dep_diamond/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main_mod = b.createModule(.{ .root_source_file = b.path("test.zig"), diff --git a/test/standalone/dep_mutually_recursive/build.zig b/test/standalone/dep_mutually_recursive/build.zig index f333c1917a4798b3b09aa56732b3486e7c49008a..170bda1902d3c6149ca894c1b047135dee7864f3 100644 --- a/test/standalone/dep_mutually_recursive/build.zig +++ b/test/standalone/dep_mutually_recursive/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main_mod = b.createModule(.{ .root_source_file = b.path("test.zig"), diff --git a/test/standalone/dep_recursive/build.zig b/test/standalone/dep_recursive/build.zig index 133b7706b008913897217e4038b3058b7f55ce9f..8eb79506cf97484e2fac024688f19258eaa464f5 100644 --- a/test/standalone/dep_recursive/build.zig +++ b/test/standalone/dep_recursive/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main_mod = b.createModule(.{ .root_source_file = b.path("test.zig"), diff --git a/test/standalone/dep_shared_builtin/build.zig b/test/standalone/dep_shared_builtin/build.zig index eb8457e4942ac29ebf22df73f810d1d987cc0192..f35523784b9573aa87eaec457927efd320c1fb34 100644 --- a/test/standalone/dep_shared_builtin/build.zig +++ b/test/standalone/dep_shared_builtin/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main_mod = b.createModule(.{ .root_source_file = b.path("test.zig"), diff --git a/test/standalone/dep_triangle/build.zig b/test/standalone/dep_triangle/build.zig index 70f64dc3347985b3964c09a1816efdac468073aa..1b8b7b6fd36f2e9062f53b37a3878fcc96898a55 100644 --- a/test/standalone/dep_triangle/build.zig +++ b/test/standalone/dep_triangle/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main_mod = b.createModule(.{ .root_source_file = b.path("test.zig"), diff --git a/test/standalone/dependency_options/build.zig b/test/standalone/dependency_options/build.zig index f56bef5ae48942740f0a23161357876c3f70f7e9..5465cf7157a2d77378f2cd44b7369d70c2fe02c4 100644 --- a/test/standalone/dependency_options/build.zig +++ b/test/standalone/dependency_options/build.zig @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) !void { const none_specified_mod = none_specified.module("dummy"); if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed; - const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) { + const expected_optimize: std.builtin.Optimize = switch (b.graph.release_mode) { .off => .debug, .any => unreachable, .fast => .fast, @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void { const all_specified = b.dependency("other", .{ .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }), - .optimize = @as(std.builtin.OptimizeMode, .safe), + .optimize = @as(std.builtin.Optimize, .safe), .bool = @as(bool, true), .int = @as(i64, 123), .float = @as(f64, 0.5), @@ -70,7 +70,7 @@ pub fn build(b: *std.Build) !void { const all_specified_optional = b.dependency("other", .{ .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })), - .optimize = @as(?std.builtin.OptimizeMode, .safe), + .optimize = @as(?std.builtin.Optimize, .safe), .bool = @as(?bool, true), .int = @as(?i64, 123), .float = @as(?f64, 0.5), diff --git a/test/standalone/dirname/build.zig b/test/standalone/dirname/build.zig index e3f2ebd72688abec98183469663edf32b3245967..a1cc44f79881a8be156d2d39d6b00448e46463df 100644 --- a/test/standalone/dirname/build.zig +++ b/test/standalone/dirname/build.zig @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { .name = "touch", .root_module = b.createModule(.{ .root_source_file = touch_src, - .optimize = .Debug, + .optimize = .debug, .target = target, }), }); @@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void { .name = "exists_in", .root_module = b.createModule(.{ .root_source_file = b.path("exists_in.zig"), - .optimize = .Debug, + .optimize = .debug, .target = target, }), }); diff --git a/test/standalone/elf2/build.zig b/test/standalone/elf2/build.zig index 54d880b66bf4e50992cf39f8d17110c7979bbe61..b8a656ec6d5172506a4866958072b48f92f27865 100644 --- a/test/standalone/elf2/build.zig +++ b/test/standalone/elf2/build.zig @@ -32,7 +32,7 @@ fn addOne( const mod = b.createModule(.{ .root_source_file = b.path("hello.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = link_mode == .dynamic, }); const exe = b.addExecutable(.{ diff --git a/test/standalone/embed_generated_file/build.zig b/test/standalone/embed_generated_file/build.zig index 75670f6ba0bff84d431309a5d27b7a5249828e7b..4669e8e440517ecd3af2243b02cba143f83cbae1 100644 --- a/test/standalone/embed_generated_file/build.zig +++ b/test/standalone/embed_generated_file/build.zig @@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void { .cpu_arch = .x86, .os_tag = .freestanding, }), - .optimize = .ReleaseSmall, + .optimize = .small, }), }); const exe = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, }) }); exe.root_module.addAnonymousImport("bootloader.elf", .{ .root_source_file = bootloader.getEmittedBin(), diff --git a/test/standalone/emit_asm_no_bin/build.zig b/test/standalone/emit_asm_no_bin/build.zig index cd5b670146c372f3d95c747ec14338502b7d8a1e..8ad952b84a934da62100b90e2287655be0c20f01 100644 --- a/test/standalone/emit_asm_no_bin/build.zig +++ b/test/standalone/emit_asm_no_bin/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const obj = b.addObject(.{ .name = "main", diff --git a/test/standalone/emit_llvm_no_bin/build.zig b/test/standalone/emit_llvm_no_bin/build.zig index 04946e47b6be011553450f86d6c1e68047d8c922..4b384c5efee526621e3cee2c7f83be852d9d0c1f 100644 --- a/test/standalone/emit_llvm_no_bin/build.zig +++ b/test/standalone/emit_llvm_no_bin/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const obj = b.addObject(.{ .name = "main", diff --git a/test/standalone/empty_env/build.zig b/test/standalone/empty_env/build.zig index 97f77b9e3ed30f8fee19cac3c9f0fe4a1b0a1cfe..0027086d4ecc23864f5f9b806408f2e65117e986 100644 --- a/test/standalone/empty_env/build.zig +++ b/test/standalone/empty_env/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; if (builtin.os.tag == .windows and b.graph.environ_map.contains("ConEmuHWND")) { // ConEmu injects environment variables into processes before they are executed diff --git a/test/standalone/entry_point/build.zig b/test/standalone/entry_point/build.zig index 42ba6211ae24faefec2f69117f54a559d6373a04..376b599d289165054717fef0e457ce9aa040e2e3 100644 --- a/test/standalone/entry_point/build.zig +++ b/test/standalone/entry_point/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void { .target = b.resolveTargetQuery(try .parse(.{ .arch_os_abi = "x86_64-linux", })), - .optimize = .ReleaseFast, // non-Debug build for reproducible output + .optimize = .fast, // non-Debug build for reproducible output .root_source_file = b.path("main.zig"), }); @@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void { .name = "check_differ", .root_module = b.createModule(.{ .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, .root_source_file = b.path("check_differ.zig"), }), }); diff --git a/test/standalone/env_vars/build.zig b/test/standalone/env_vars/build.zig index 1dff97d214b145dfaa34321fe0a283c0a445cb0c..3de113d361d19e31b8394bcc4736034f8d364d7c 100644 --- a/test/standalone/env_vars/build.zig +++ b/test/standalone/env_vars/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main = b.addExecutable(.{ .name = "main", diff --git a/test/standalone/extern/build.zig b/test/standalone/extern/build.zig index 178fa76d41fe2805edde6ddbc1789119d79307e5..bad65c67ce532a651132f636923b31923ab4a56d 100644 --- a/test/standalone/extern/build.zig +++ b/test/standalone/extern/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const obj = b.addObject(.{ .name = "exports", diff --git a/test/standalone/glibc_compat/build.zig b/test/standalone/glibc_compat/build.zig index 69568d72d9c1fd1b190aa482a0e1749feb7fa886..202449a1e233b1940c632db8d87db3ec8645e984 100644 --- a/test/standalone/glibc_compat/build.zig +++ b/test/standalone/glibc_compat/build.zig @@ -122,19 +122,19 @@ pub fn build(b: *std.Build) void { const malloc_translation = b.addTranslateC(.{ .root_source_file = b.path("include_malloc.h"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }); const stdlib_translation = b.addTranslateC(.{ .root_source_file = b.path("include_stdlib.h"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }); const string_translation = b.addTranslateC(.{ .root_source_file = b.path("include_string.h"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }); const exe = b.addExecutable(.{ diff --git a/test/standalone/global_linkage/build.zig b/test/standalone/global_linkage/build.zig index c706b329004c21a464df8d2839e032cd5de4982e..6b063c6f015360c22290b942625bb7997f005661 100644 --- a/test/standalone/global_linkage/build.zig +++ b/test/standalone/global_linkage/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test the program"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; const obj1 = b.addLibrary(.{ diff --git a/test/standalone/install_headers/build.zig b/test/standalone/install_headers/build.zig index fe855e32c20f17a64541cc7681bfb5dfcf23d031..4dd45b648a8e4aae49943d2ea41149ebffe91528 100644 --- a/test/standalone/install_headers/build.zig +++ b/test/standalone/install_headers/build.zig @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = b.resolveTargetQuery(.{}), - .optimize = .Debug, + .optimize = .debug, }), }); libfoo.root_module.addCSourceFile(.{ .file = empty_c }); @@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = b.resolveTargetQuery(.{}), - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = b.resolveTargetQuery(.{}), - .optimize = .Debug, + .optimize = .debug, }), }); libbar.root_module.addCSourceFile(.{ .file = empty_c }); @@ -93,7 +93,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("check_exists.zig"), .target = b.resolveTargetQuery(.{}), - .optimize = .Debug, + .optimize = .debug, }), }); const run_check_exists = b.addRunArtifact(check_exists); diff --git a/test/standalone/install_raw_hex/build.zig b/test/standalone/install_raw_hex/build.zig index c12949a9cec08b55180d367f07197d5e451a1b66..3fd9e91a9a1184ca2de89beec01ae7dc7bf2c714 100644 --- a/test/standalone/install_raw_hex/build.zig +++ b/test/standalone/install_raw_hex/build.zig @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { .abi = .gnueabihf, }); - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const elf = b.addExecutable(.{ .name = "zig-nrf52-blink.elf", diff --git a/test/standalone/ios/build.zig b/test/standalone/ios/build.zig index cd1d52aec973ab44c8c4f30d0224c6e0f34b5268..22ae25d7d318b2e7ae86f8a3eab1861ec3dfafd5 100644 --- a/test/standalone/ios/build.zig +++ b/test/standalone/ios/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { .name = "main", .root_module = b.createModule(.{ .root_source_file = b.path("panic.zig"), - .optimize = .Debug, + .optimize = .debug, .target = target, .link_libc = true, }), diff --git a/test/standalone/issue_11595/build.zig b/test/standalone/issue_11595/build.zig index 88b7af06a55ee440b3766169cb69f3b3343a687a..8f92f20422e012281b5f9f58a417f54e4ae20750 100644 --- a/test/standalone/issue_11595/build.zig +++ b/test/standalone/issue_11595/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag == .windows) { diff --git a/test/standalone/issue_12706/build.zig b/test/standalone/issue_12706/build.zig index cace3c7d2d3b66376e529376ffabb316a2fd4e8f..e2b4d4fe2bf61750bd7e1435237385c502cde0b4 100644 --- a/test/standalone/issue_12706/build.zig +++ b/test/standalone/issue_12706/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; const exe = b.addExecutable(.{ diff --git a/test/standalone/issue_339/build.zig b/test/standalone/issue_339/build.zig index 364dc0e81bef9816b6a186bfb51a6348a4c95e10..6e2ed10d4477f9fe9b9c8687fe7a081541d2d5eb 100644 --- a/test/standalone/issue_339/build.zig +++ b/test/standalone/issue_339/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; const obj = b.addObject(.{ diff --git a/test/standalone/issue_5825/build.zig b/test/standalone/issue_5825/build.zig index e102febe2dcb702f7df29a6a0b95b8f36d2d096f..10a23101966b0e9b2a40043e7934eff377171059 100644 --- a/test/standalone/issue_5825/build.zig +++ b/test/standalone/issue_5825/build.zig @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { .os_tag = .windows, .abi = .msvc, }); - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const obj = b.addObject(.{ .name = "issue_5825", .root_module = b.createModule(.{ diff --git a/test/standalone/load_dynamic_library/build.zig b/test/standalone/load_dynamic_library/build.zig index 8af976e9929eef069673e71c0bb1c1a738ef4e7d..a4d441936eb867edc0a48fa72608c3c698b808c1 100644 --- a/test/standalone/load_dynamic_library/build.zig +++ b/test/standalone/load_dynamic_library/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag == .wasi) return; diff --git a/test/standalone/mix_c_files/build.zig b/test/standalone/mix_c_files/build.zig index a7415b4f01dbc2b511b19c0faced1a5acaba5b61..2ff4e6d3add8eee6d9a0a4140135914ee1eeb40c 100644 --- a/test/standalone/mix_c_files/build.zig +++ b/test/standalone/mix_c_files/build.zig @@ -9,13 +9,13 @@ pub fn build(b: *std.Build) void { return; } - add(b, test_step, .Debug); - add(b, test_step, .ReleaseFast); - add(b, test_step, .ReleaseSmall); - add(b, test_step, .ReleaseSafe); + add(b, test_step, .debug); + add(b, test_step, .fast); + add(b, test_step, .small); + add(b, test_step, .safe); } -fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { +fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize) void { const exe = b.addExecutable(.{ .name = "test", .root_module = b.createModule(.{ diff --git a/test/standalone/mix_o_files/build.zig b/test/standalone/mix_o_files/build.zig index 12b90f36247b379422b4ff616d671b85d5b5a66c..dcc5a09a0203d39440e92fdf0f3d7585c760e02f 100644 --- a/test/standalone/mix_o_files/build.zig +++ b/test/standalone/mix_o_files/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; const obj = b.addObject(.{ diff --git a/test/standalone/pkg_import/build.zig b/test/standalone/pkg_import/build.zig index 3d94930ef3fdbcfb61b15623dd51036f23855045..d8efe06f53a5d20c7d1b4b21651f0420a41ba748 100644 --- a/test/standalone/pkg_import/build.zig +++ b/test/standalone/pkg_import/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const exe = b.addExecutable(.{ .name = "test", diff --git a/test/standalone/posix/build.zig b/test/standalone/posix/build.zig index f163beea8a65f2ab90bced2d3adbc38a2ecf7782..2f32a06ee06149d2317908662f883f8e7e4a5d1b 100644 --- a/test/standalone/posix/build.zig +++ b/test/standalone/posix/build.zig @@ -54,7 +54,7 @@ pub fn build(b: *std.Build) void { } } -fn run_exe(b: *std.Build, optimize: std.builtin.OptimizeMode, case: *const Case, target: std.Build.ResolvedTarget, link_libc: bool) *std.Build.Step.Run { +fn run_exe(b: *std.Build, optimize: std.builtin.Optimize, case: *const Case, target: std.Build.ResolvedTarget, link_libc: bool) *std.Build.Step.Run { const exe_name = b.fmt("test-posix-{s}{s}{s}", .{ std.fs.path.stem(case.src_path), if (link_libc) "-libc" else "", diff --git a/test/standalone/run_cwd/build.zig b/test/standalone/run_cwd/build.zig index d66393a602cab8ff2b54cfabd821fb24a6aaa424..a29fe0c73a326f684cd80b79c6136467e6d8e86f 100644 --- a/test/standalone/run_cwd/build.zig +++ b/test/standalone/run_cwd/build.zig @@ -3,7 +3,7 @@ pub fn build(b: *Build) void { .name = "check_file_exists", .root_module = b.createModule(.{ .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, .root_source_file = b.path("check_file_exists.zig"), }), }); diff --git a/test/standalone/self_exe_symlink/build.zig b/test/standalone/self_exe_symlink/build.zig index 9e031dcdaab91b3624ee8ea5ae6c0916d56e53b7..b60a53c09cc1f92feff5c3c25d03cecd5fde6a24 100644 --- a/test/standalone/self_exe_symlink/build.zig +++ b/test/standalone/self_exe_symlink/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (target.result.os.tag == .netbsd) return; // F_GETPATH not reliable diff --git a/test/standalone/shared_library/build.zig b/test/standalone/shared_library/build.zig index 88eb66149f9c65c40997c6dcc7307f46020c4eee..c35def7f103c69a95ba979ac5d9f2d76abb7eb45 100644 --- a/test/standalone/shared_library/build.zig +++ b/test/standalone/shared_library/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.standardTargetOptions(.{}); const exe_names: []const []const u8 = &.{ diff --git a/test/standalone/simple/build.zig b/test/standalone/simple/build.zig index a61f2f1e975a1c3e46b1546791743842773e92de..45dd49648d619c2a73bda7b1928930a3a62963e3 100644 --- a/test/standalone/simple/build.zig +++ b/test/standalone/simple/build.zig @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { const skip_release_fast = b.option(bool, "skip_release_fast", "Skip release-fast builds") orelse false; const skip_release_small = b.option(bool, "skip_release_small", "Skip release-small builds") orelse false; - var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined; + var optimize_modes_buf: [4]std.builtin.Optimize = undefined; var optimize_modes_len: usize = 0; if (!skip_debug) { optimize_modes_buf[optimize_modes_len] = .debug; diff --git a/test/standalone/static_c_lib/build.zig b/test/standalone/static_c_lib/build.zig index 1ec3d5b463294fe3bd0dea0d6db11a437a815138..5475ad738ceee9381f0dbbbacb3202939cabcc92 100644 --- a/test/standalone/static_c_lib/build.zig +++ b/test/standalone/static_c_lib/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.standardTargetOptions(.{}); const exe_names: []const []const u8 = &.{ diff --git a/test/standalone/strip_empty_loop/build.zig b/test/standalone/strip_empty_loop/build.zig index 9f268d4cb864cf7ea6a405ddf238f2b040af7c1b..1e14c641f09d469c3f6cbd52ab679d940e8de468 100644 --- a/test/standalone/strip_empty_loop/build.zig +++ b/test/standalone/strip_empty_loop/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test the program"); b.default_step = test_step; - const optimize = std.builtin.OptimizeMode.Debug; + const optimize = std.builtin.Optimize.debug; const target = b.graph.host; const main = b.addExecutable(.{ diff --git a/test/standalone/strip_struct_init/build.zig b/test/standalone/strip_struct_init/build.zig index 175724df6348f524f7680a73177ec81ab2e97cf0..7dfeb9b45ed5cbdaf269f02e04c7bff4fa527285 100644 --- a/test/standalone/strip_struct_init/build.zig +++ b/test/standalone/strip_struct_init/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const main = b.addTest(.{ .root_module = b.createModule(.{ diff --git a/test/standalone/tsan/build.zig b/test/standalone/tsan/build.zig index 13e2629ecf3f10e534709bcbe19b395d7668bc58..3811ec0349d6aabc4dd32ca0eacb74fa4b9be6dc 100644 --- a/test/standalone/tsan/build.zig +++ b/test/standalone/tsan/build.zig @@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .sanitize_thread = true, }), }); @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .sanitize_thread = true, }), }); diff --git a/test/standalone/windows_argv/build.zig b/test/standalone/windows_argv/build.zig index cf83ecc5d4850b47c2177527e9ede6de540902fe..df235b996dd3d7d80d5a2c631632f9e3de9cc278 100644 --- a/test/standalone/windows_argv/build.zig +++ b/test/standalone/windows_argv/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void { if (builtin.os.tag != .windows) return; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const lib_gnu = b.addLibrary(.{ .linkage = .static, diff --git a/test/standalone/windows_bat_args/build.zig b/test/standalone/windows_bat_args/build.zig index d5053c5aad6d67dd43a507a0c1d85a3d2aa8f4de..107c643ea6dd1f4de84372fc891b7498c711b2cc 100644 --- a/test/standalone/windows_bat_args/build.zig +++ b/test/standalone/windows_bat_args/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag != .windows) return; diff --git a/test/standalone/windows_entry_points/build.zig b/test/standalone/windows_entry_points/build.zig index d63de59c2b970b7bfe04bcd95578eaae9fc6b88d..2c75c3e6ba8cda977eb9fb0f1f73f5af3872e5b1 100644 --- a/test/standalone/windows_entry_points/build.zig +++ b/test/standalone/windows_entry_points/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -66,7 +66,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = null, .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -84,7 +84,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }), }); @@ -98,7 +98,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -113,7 +113,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("wwinmain.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }), }); exe.mingw_unicode_entry_point = true; @@ -129,7 +129,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("wwinmain.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -143,7 +143,7 @@ pub fn build(b: *std.Build) void { const load_dll_exe = b.addExecutable(.{ .name = "load_dll", .root_module = b.createModule(.{ .root_source_file = b.path("loaddll.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }) }); { @@ -153,7 +153,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("dllmain.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }), }); @@ -174,7 +174,7 @@ pub fn build(b: *std.Build) void { .root_module = b.createModule(.{ .root_source_file = b.path("dllmain.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); @@ -195,7 +195,7 @@ pub fn build(b: *std.Build) void { .linkage = .dynamic, .root_module = b.createModule(.{ .target = target, - .optimize = .Debug, + .optimize = .debug, .link_libc = true, }), }); diff --git a/test/standalone/windows_paths/build.zig b/test/standalone/windows_paths/build.zig index b25bc9032edec1c0cd56f6bb8075136a819626b3..636ef92cd5b00d6a99d73af8efae1e71d4e1553b 100644 --- a/test/standalone/windows_paths/build.zig +++ b/test/standalone/windows_paths/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag != .windows) return; diff --git a/test/standalone/windows_resources/build.zig b/test/standalone/windows_resources/build.zig index 8cd410917d9673137fbfa65bb34694ab132b512c..09d91a29ed986247cf47cded3b70b3e2952cb0fd 100644 --- a/test/standalone/windows_resources/build.zig +++ b/test/standalone/windows_resources/build.zig @@ -31,7 +31,7 @@ fn add( .root_module = b.createModule(.{ .root_source_file = b.path("main.zig"), .target = target, - .optimize = .Debug, + .optimize = .debug, }), }); exe.root_module.addWin32ResourceFile(.{ diff --git a/test/standalone/windows_spawn/build.zig b/test/standalone/windows_spawn/build.zig index 43b0f162bf68b19e40e31331d1577394d768f034..f6321c27efa80c1bc57c1d359ec1e6023c6bd276 100644 --- a/test/standalone/windows_spawn/build.zig +++ b/test/standalone/windows_spawn/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const optimize: std.builtin.OptimizeMode = .Debug; + const optimize: std.builtin.Optimize = .debug; const target = b.graph.host; if (builtin.os.tag != .windows) return; diff --git a/test/standalone/zerolength_check/build.zig b/test/standalone/zerolength_check/build.zig index 7edc55932cbdedcd594988abe605cbeb282e31b6..19102ef6d68bb0cd948b1b0598e5578776c48dc5 100644 --- a/test/standalone/zerolength_check/build.zig +++ b/test/standalone/zerolength_check/build.zig @@ -4,13 +4,13 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - add(b, test_step, .Debug); - add(b, test_step, .ReleaseFast); - add(b, test_step, .ReleaseSmall); - add(b, test_step, .ReleaseSafe); + add(b, test_step, .debug); + add(b, test_step, .fast); + add(b, test_step, .small); + add(b, test_step, .safe); } -fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { +fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize) void { const unit_tests = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = b.resolveTargetQuery(.{ diff --git a/test/tests.zig b/test/tests.zig index caedd5452a157fe1df63cab1ef42e40a4e07f156..a8df197a14c77a7c6271cf22989075544c4a8ef1 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -2,7 +2,7 @@ const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; -const OptimizeMode = std.builtin.OptimizeMode; +const OptimizeMode = std.builtin.Optimize; const Step = std.Build.Step; // Cases @@ -21,7 +21,7 @@ pub const LinkContext = @import("src/Link.zig"); const ModuleTestTarget = struct { linkage: ?std.builtin.LinkMode = null, target: std.Target.Query = .{}, - optimize_mode: std.builtin.OptimizeMode = .debug, + optimize_mode: std.builtin.Optimize = .debug, link_libc: ?bool = null, single_threaded: ?bool = null, use_llvm: ?bool = null, @@ -2162,7 +2162,7 @@ const c_abi_targets = blk: { const LinkTarget = struct { target: std.Target.Query = .{}, - optimize_mode: std.builtin.OptimizeMode = .debug, + optimize_mode: std.builtin.Optimize = .debug, link_libc: bool = false, use_llvm: bool = false, use_lld: bool = false, @@ -2573,7 +2573,7 @@ pub fn addCliTests(b: *std.Build) *Step { // This is intended to be the exact CLI usage used by godbolt.org. const run = b.addSystemCommand(&.{ b.graph.zig_exe, "build-obj", "--cache-dir" }); run.addDirectoryArg(tmp_path); - run.addArgs(&.{ "--name", "example", "-fno-emit-bin", "-fno-emit-h", "-fstrip", "-OReleaseFast" }); + run.addArgs(&.{ "--name", "example", "-fno-emit-bin", "-fno-emit-h", "-fstrip", "-Ofast" }); run.addFileArg(example_zig); const example_s = run.addPrefixedOutputFileArg("-femit-asm=", "example.s"); diff --git a/tools/doctest.zig b/tools/doctest.zig index b653b84a8e3195d01c061921428273d3c351839a..18b73798d496f29e46660c213e19da67e8afcfa7 100644 --- a/tools/doctest.zig +++ b/tools/doctest.zig @@ -156,7 +156,7 @@ fn printOutput( try shell_out.print("$ zig build-exe {s}.zig ", .{code_name}); switch (code.mode) { - .Debug => {}, + .debug => {}, else => { try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) }); try shell_out.print("-O {s} ", .{@tagName(code.mode)}); @@ -291,7 +291,7 @@ fn printOutput( try shell_out.print("$ zig test {s}.zig ", .{code_name}); switch (code.mode) { - .Debug => {}, + .debug => {}, else => { try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode), @@ -354,7 +354,7 @@ fn printOutput( try shell_out.print("$ zig test {s}.zig ", .{code_name}); switch (code.mode) { - .Debug => {}, + .debug => {}, else => { try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) }); try shell_out.print("-O {s} ", .{@tagName(code.mode)}); @@ -404,18 +404,18 @@ fn printOutput( } var mode_arg: []const u8 = ""; switch (code.mode) { - .Debug => {}, - .ReleaseSafe => { - try test_args.append("-OReleaseSafe"); - mode_arg = "-OReleaseSafe"; + .debug => {}, + .safe => { + try test_args.append("-Osafe"); + mode_arg = "-Osafe"; }, - .ReleaseFast => { - try test_args.append("-OReleaseFast"); - mode_arg = "-OReleaseFast"; + .fast => { + try test_args.append("-Ofast"); + mode_arg = "-Ofast"; }, - .ReleaseSmall => { - try test_args.append("-OReleaseSmall"); - mode_arg = "-OReleaseSmall"; + .small => { + try test_args.append("-Osmall"); + mode_arg = "-Osmall"; }, } @@ -468,7 +468,7 @@ fn printOutput( try shell_out.print("$ zig build-obj {s}.zig ", .{code_name}); switch (code.mode) { - .Debug => {}, + .debug => {}, else => { try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) }); try shell_out.print("-O {s} ", .{@tagName(code.mode)}); @@ -548,7 +548,7 @@ fn printOutput( try shell_out.print("$ zig build-lib {s}.zig ", .{code_name}); switch (code.mode) { - .Debug => {}, + .debug => {}, else => { try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) }); try shell_out.print("-O {s} ", .{@tagName(code.mode)}); @@ -843,7 +843,7 @@ fn writeEscapedLines(out: *Writer, text: []const u8) !void { const Code = struct { id: Id, - mode: std.builtin.OptimizeMode, + mode: std.builtin.Optimize, link_objects: []const []const u8, target_str: ?[]const u8, link_libc: bool, @@ -903,7 +903,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { else fatal("unrecognized manifest id: '{s}'", .{first_line}); - var mode: std.builtin.OptimizeMode = .Debug; + var mode: std.builtin.Optimize = .debug; var link_mode: ?std.builtin.LinkMode = null; var link_objects: std.ArrayList([]const u8) = .empty; var additional_options: std.ArrayList([]const u8) = .empty; diff --git a/tools/migrate_langref.zig b/tools/migrate_langref.zig index 4c48113a8698f91067d5b7887adb3286df3bc351..9bbebfbecca9d4ad98cedb9fdae15be280bbca4d 100644 --- a/tools/migrate_langref.zig +++ b/tools/migrate_langref.zig @@ -243,7 +243,7 @@ const Code = struct { name: []const u8, source_token: Token, just_check_syntax: bool, - mode: std.builtin.OptimizeMode, + mode: std.builtin.Optimize, link_objects: []const []const u8, target_str: ?[]const u8, link_libc: bool, @@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str}); } - var mode: std.builtin.OptimizeMode = .debug; + var mode: std.builtin.Optimize = .debug; var link_objects = std.array_list.Managed([]const u8).init(arena); var target_str: ?[]const u8 = null; var link_libc = false; @@ -333,9 +333,9 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp const end_code_tag = try eatToken(tokenizer, .tag_content); const end_tag_name = tokenizer.buffer[end_code_tag.start..end_code_tag.end]; if (mem.eql(u8, end_tag_name, "code_release_fast")) { - mode = .ReleaseFast; + mode = .fast; } else if (mem.eql(u8, end_tag_name, "code_release_safe")) { - mode = .ReleaseSafe; + mode = .safe; } else if (mem.eql(u8, end_tag_name, "code_disable_cache")) { disable_cache = true; } else if (mem.eql(u8, end_tag_name, "code_link_object")) { -- 2.54.0