authorgravatar for k4@noreply.codeberg.orgK4 <k4@noreply.codeberg.org> 2026-07-21 12:59:11+03:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-23 14:30:48+02:00
log2c93c6e91b6ed5177cd45336899f73940d1fa600
treea25555d98fa16f6656a026dbfcfc9f74023b08d0
parent574eb23f2ba18da574f7b93a637fb286e3930f1e

`std.lang.OptimizeMode` -> `std.lang.Optimize` migration progress


80 files changed, 160 insertions(+), 160 deletions(-)

build.zig+6-6
......@@ -57,7 +57,7 @@ pub fn build(b: *std.Build) !void {
5757 .root_module = b.createModule(.{
5858 .root_source_file = b.path("lib/std/std.zig"),
5959 .target = target,
60 .optimize = .Debug,
60 .optimize = .debug,
6161 }),
6262 });
6363 const install_std_docs = b.addInstallDirectory(.{
......@@ -431,7 +431,7 @@ pub fn build(b: *std.Build) !void {
431431 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{};
432432 const test_extra_targets = b.option(bool, "test-extra-targets", "Enable running module tests for additional targets") orelse false;
433433
434 var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined;
434 var chosen_opt_modes_buf: [4]std.lang.Optimize = undefined;
435435 var chosen_mode_index: usize = 0;
436436 if (!skip_debug) {
437437 chosen_opt_modes_buf[chosen_mode_index] = .debug;
......@@ -788,7 +788,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
788788 const semver = try std.SemanticVersion.parse(version);
789789
790790 const exe = addCompilerStep(b, .{
791 .optimize = .ReleaseSmall,
791 .optimize = .small,
792792 .target = b.resolveTargetQuery(std.Target.Query.parse(.{
793793 .arch_os_abi = "wasm32-wasi",
794794 // * `nontrapping_bulk_memory_len0` is supported by `wasm2c`.
......@@ -853,7 +853,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
853853}
854854
855855const AddCompilerModOptions = struct {
856 optimize: std.lang.OptimizeMode,
856 optimize: std.lang.Optimize,
857857 target: std.Build.ResolvedTarget,
858858 strip: ?bool = null,
859859 valgrind: ?bool = null,
......@@ -1606,7 +1606,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {
16061606 .root_module = b.createModule(.{
16071607 .root_source_file = b.path("tools/doctest.zig"),
16081608 .target = b.graph.host,
1609 .optimize = .Debug,
1609 .optimize = .debug,
16101610 }),
16111611 });
16121612
......@@ -1649,7 +1649,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {
16491649 .root_module = b.createModule(.{
16501650 .root_source_file = b.path("tools/docgen.zig"),
16511651 .target = b.graph.host,
1652 .optimize = .Debug,
1652 .optimize = .debug,
16531653 }),
16541654 });
16551655
lib/compiler/Maker.zig+2-2
......@@ -440,9 +440,9 @@ pub fn main(init: process.Init.Minimal) !void {
440440 } else if (mem.eql(u8, arg, "--debug-pkg-config")) {
441441 debug_pkg_config = true;
442442 } else if (mem.eql(u8, arg, "--debug-rt")) {
443 graph.debug_compiler_runtime_libs = .Debug;
443 graph.debug_compiler_runtime_libs = .debug;
444444 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {
445 graph.debug_compiler_runtime_libs = stringToEnum(std.lang.OptimizeMode, rest) orelse
445 graph.debug_compiler_runtime_libs = stringToEnum(std.lang.Optimize, rest) orelse
446446 fatal("unrecognized optimization mode: {s}", .{rest});
447447 } else if (is_debug_mode and mem.eql(u8, arg, "--debug-maker-leaks")) {
448448 debug_maker_leaks = true;
lib/compiler/Maker/Graph.zig+1-1
......@@ -18,7 +18,7 @@ local_cache_root: Directory,
1818zig_lib_directory: Directory,
1919build_root_directory: Directory,
2020
21debug_compiler_runtime_libs: ?std.builtin.OptimizeMode = null,
21debug_compiler_runtime_libs: ?std.builtin.Optimize = null,
2222incremental: ?bool = null,
2323random_seed: u32 = 0,
2424allow_so_scripts: ?bool = null,
lib/compiler/Maker/Step/Compile.zig+5-5
......@@ -666,7 +666,7 @@ fn lowerZigArgs(
666666
667667 try zig_args.ensureUnusedCapacity(gpa, 1);
668668 if (graph.debug_compiler_runtime_libs) |mode| switch (mode) {
669 .Debug => zig_args.appendAssumeCapacity("--debug-rt"),
669 .debug => zig_args.appendAssumeCapacity("--debug-rt"),
670670 else => zig_args.appendAssumeCapacity(try arena.print("--debug-rt={t}", .{mode})),
671671 };
672672
......@@ -1266,10 +1266,10 @@ fn appendModuleFlags(
12661266 }
12671267
12681268 switch (m.flags.optimize) {
1269 .debug => zig_args.appendAssumeCapacity("-ODebug"),
1270 .safe => zig_args.appendAssumeCapacity("-OReleaseSafe"),
1271 .fast => zig_args.appendAssumeCapacity("-OReleaseFast"),
1272 .small => zig_args.appendAssumeCapacity("-OReleaseSmall"),
1269 .debug => zig_args.appendAssumeCapacity("-Odebug"),
1270 .safe => zig_args.appendAssumeCapacity("-Osafe"),
1271 .fast => zig_args.appendAssumeCapacity("-Ofast"),
1272 .small => zig_args.appendAssumeCapacity("-Osmall"),
12731273 .default => {},
12741274 }
12751275
lib/compiler/Maker/Step/TranslateC.zig+1-1
......@@ -4,7 +4,7 @@ const std = @import("std");
44const Io = std.Io;
55const Configuration = std.Build.Configuration;
66const assert = std.debug.assert;
7const OptimizeMode = std.lang.OptimizeMode;
7const OptimizeMode = std.lang.Optimize;
88
99const Step = @import("../Step.zig");
1010const Maker = @import("../../Maker.zig");
lib/compiler/Maker/WebServer.zig+2-2
......@@ -531,7 +531,7 @@ fn serveLibFile(
531531fn serveClientWasm(
532532 ws: *WebServer,
533533 req: *http.Server.Request,
534 optimize_mode: std.builtin.OptimizeMode,
534 optimize_mode: std.builtin.Optimize,
535535) !void {
536536 const gpa = ws.graph.cache.gpa;
537537
......@@ -603,7 +603,7 @@ pub fn serveTarFile(ws: *WebServer, request: *http.Server.Request, paths: []cons
603603 try response.end();
604604}
605605
606fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.OptimizeMode) !Cache.Path {
606fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.Optimize) !Cache.Path {
607607 const root_name = "build-web";
608608 const arch_os_abi = "wasm32-freestanding";
609609 const cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_globals+nontrapping_fptoint+reference_types+sign_ext";
lib/compiler/std-docs.zig+2-2
......@@ -259,7 +259,7 @@ fn serveSourcesTar(request: *std.http.Server.Request, context: *Context) !void {
259259fn serveWasm(
260260 request: *std.http.Server.Request,
261261 context: *Context,
262 optimize_mode: std.builtin.OptimizeMode,
262 optimize_mode: std.builtin.Optimize,
263263) !void {
264264 const gpa = context.gpa;
265265 const io = context.io;
......@@ -302,7 +302,7 @@ const autodoc_cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_gl
302302fn buildWasmBinary(
303303 arena: Allocator,
304304 context: *Context,
305 optimize_mode: std.builtin.OptimizeMode,
305 optimize_mode: std.builtin.Optimize,
306306) !Cache.Path {
307307 const gpa = context.gpa;
308308 const io = context.io;
lib/std/Build.zig+5-5
......@@ -691,7 +691,7 @@ pub const AssemblyOptions = struct {
691691 /// To choose the same computer as the one building the package, pass the
692692 /// `host` field of the package's `Build` instance.
693693 target: ResolvedTarget,
694 optimize: std.builtin.OptimizeMode,
694 optimize: std.builtin.Optimize,
695695 max_rss: u64 = 0,
696696 zig_lib_dir: ?LazyPath = null,
697697};
......@@ -1188,22 +1188,22 @@ pub fn step(b: *Build, name: []const u8, description: []const u8) *Step {
11881188}
11891189
11901190pub const StandardOptimizeOptionOptions = struct {
1191 preferred_optimize_mode: ?std.builtin.OptimizeMode = null,
1191 preferred_optimize_mode: ?std.builtin.Optimize = null,
11921192};
11931193
1194pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.OptimizeMode {
1194pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.Optimize {
11951195 const graph = b.graph;
11961196
11971197 if (options.preferred_optimize_mode) |mode| {
11981198 if (b.option(bool, "release", "optimize for end users") orelse (graph.release_mode != .off)) {
11991199 return mode;
12001200 } else {
1201 return .Debug;
1201 return .debug;
12021202 }
12031203 }
12041204
12051205 if (b.option(
1206 std.builtin.OptimizeMode,
1206 std.builtin.Optimize,
12071207 "optimize",
12081208 "Prioritize performance, safety, or binary size",
12091209 )) |mode| {
lib/std/Build/Configuration.zig+1-1
......@@ -1660,7 +1660,7 @@ pub const Module = struct {
16601660 small,
16611661 default,
16621662
1663 pub fn init(o: ?std.builtin.OptimizeMode) Optimize {
1663 pub fn init(o: ?std.builtin.Optimize) Optimize {
16641664 return switch (o orelse return .default) {
16651665 .debug => .debug,
16661666 .safe => .safe,
lib/std/Build/Module.zig+2-2
......@@ -15,7 +15,7 @@ root_source_file: ?LazyPath,
1515import_table: std.array_hash_map.String(*Module),
1616
1717resolved_target: ?std.Build.ResolvedTarget = null,
18optimize: ?std.builtin.OptimizeMode = null,
18optimize: ?std.builtin.Optimize = null,
1919dwarf_format: ?std.dwarf.Format,
2020
2121c_macros: ArrayList([]const u8),
......@@ -200,7 +200,7 @@ pub const CreateOptions = struct {
200200 imports: []const Import = &.{},
201201
202202 target: ?std.Build.ResolvedTarget = null,
203 optimize: ?std.builtin.OptimizeMode = null,
203 optimize: ?std.builtin.Optimize = null,
204204
205205 /// `true` requires a compilation that includes this Module to link libc.
206206 /// `false` causes a build failure if a compilation that includes this Module would link libc.
lib/std/Build/Step/TranslateC.zig+3-3
......@@ -13,7 +13,7 @@ include_dirs: std.ArrayList(std.Build.Module.IncludeDir) = .empty,
1313system_libs: std.ArrayList(std.Build.Module.SystemLib) = .empty,
1414c_macros: std.ArrayList(Configuration.String) = .empty,
1515target: std.Build.ResolvedTarget,
16optimize: std.builtin.OptimizeMode,
16optimize: std.builtin.Optimize,
1717output_file: Configuration.GeneratedFileIndex,
1818link_libc: bool,
1919
......@@ -22,7 +22,7 @@ pub const base_tag: Step.Tag = .translate_c;
2222pub const Options = struct {
2323 root_source_file: std.Build.LazyPath,
2424 target: std.Build.ResolvedTarget,
25 optimize: std.builtin.OptimizeMode,
25 optimize: std.builtin.Optimize,
2626 link_libc: bool = true,
2727};
2828
......@@ -50,7 +50,7 @@ pub const AddExecutableOptions = struct {
5050 name: ?[]const u8 = null,
5151 version: ?std.SemanticVersion = null,
5252 target: ?std.Build.ResolvedTarget = null,
53 optimize: ?std.builtin.OptimizeMode = null,
53 optimize: ?std.builtin.Optimize = null,
5454 linkage: ?std.builtin.LinkMode = null,
5555};
5656
lib/std/Io/Threaded.zig+2-2
......@@ -16972,7 +16972,7 @@ test argvToCommandLineWindows {
1697216972 ,
1697316973 \\-O
1697416974 ,
16975 \\ReleaseSafe
16975 \\safe
1697616976 ,
1697716977 \\--
1697816978 ,
......@@ -16981,7 +16981,7 @@ test argvToCommandLineWindows {
1698116981 \\--eval=new Regex("Dwayne \"The Rock\" Johnson")
1698216982 ,
1698316983 },
16984 \\"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\")"
16984 \\"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\")"
1698516985 );
1698616986
1698716987 try t(&.{}, "");
lib/std/heap/debug_allocator.zig+1-1
......@@ -105,7 +105,7 @@ const Log2USize = std.math.Log2Int(usize);
105105
106106const default_sys_stack_trace_frames: usize = if (std.debug.sys_can_stack_trace) 6 else 0;
107107const default_stack_trace_frames: usize = switch (builtin.mode) {
108 .Debug => default_sys_stack_trace_frames,
108 .debug => default_sys_stack_trace_frames,
109109 else => 0,
110110};
111111
lib/std/log.zig+1-1
......@@ -52,7 +52,7 @@ pub const Level = enum {
5252
5353/// The default log level is based on build mode.
5454pub const default_level: Level = switch (builtin.mode) {
55 .Debug => .debug,
55 .debug => .debug,
5656 .safe, .fast, .small => .info,
5757};
5858
lib/std/os/windows.zig+2-2
......@@ -3955,7 +3955,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError {
39553955
39563956pub fn statusBug(status: NTSTATUS) UnexpectedError {
39573957 switch (builtin.mode) {
3958 .Debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{
3958 .debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{
39593959 @backingInt(status),
39603960 std.enums.tagName(NTSTATUS, status) orelse "<unnamed>",
39613961 }),
......@@ -3965,7 +3965,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError {
39653965
39663966pub fn errorBug(err: Win32Error) UnexpectedError {
39673967 switch (builtin.mode) {
3968 .Debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{
3968 .debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{
39693969 @backingInt(err),
39703970 std.enums.tagName(Win32Error, err) orelse "<unnamed>",
39713971 }),
lib/std/process/Args.zig+2-2
......@@ -537,7 +537,7 @@ test "Iterator.Windows" {
537537 const t = testIteratorWindows;
538538
539539 try t(
540 \\"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\")"
540 \\"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\")"
541541 , &.{
542542 \\C:\Program Files\zig\zig.exe
543543 ,
......@@ -551,7 +551,7 @@ test "Iterator.Windows" {
551551 ,
552552 \\-O
553553 ,
554 \\ReleaseSafe
554 \\safe
555555 ,
556556 \\--
557557 ,
src/codegen/riscv64/CodeGen.zig+1-1
......@@ -8341,7 +8341,7 @@ fn resolveCallingConventionValues(
83418341
83428342fn wantSafety(func: *Func) bool {
83438343 return switch (func.mod.optimize_mode) {
8344 .Debug => true,
8344 .debug => true,
83458345 .safe => true,
83468346 .fast => false,
83478347 .small => false,
src/codegen/sparc64/CodeGen.zig+1-1
......@@ -4766,7 +4766,7 @@ fn truncRegister(
47664766/// TODO support scope overrides. Also note this logic is duplicated with `Zcu.wantSafety`.
47674767fn wantSafety(self: *Self) bool {
47684768 return switch (self.bin_file.comp.root_mod.optimize_mode) {
4769 .Debug => true,
4769 .debug => true,
47704770 .safe => true,
47714771 .fast => false,
47724772 .small => false,
src/main.zig+1-1
......@@ -805,7 +805,7 @@ const compile_usage =
805805 \\ --debug-compile-errors Crash with helpful diagnostics at the first compile error
806806 \\ --debug-link-snapshot Enable dumping of the linker's state in JSON format
807807 \\ --debug-rt[=mode] Build compiler runtime libraries with [mode] optimization
808 \\ (Debug if [=mode] is omitted)
808 \\ (debug if [=mode] is omitted)
809809 \\ --debug-incremental Enable incremental compilation debug features
810810 \\
811811;
test/cases/compile_errors/invalid_member_of_builtin_enum.zig+2-2
......@@ -1,10 +1,10 @@
11const lang = @import("std").lang;
22export fn entry() void {
3 const foo = lang.OptimizeMode.x86;
3 const foo = lang.Optimize.x86;
44 _ = foo;
55}
66
77// error
88//
9// :3:35: error: enum 'lang.Optimize' has no member named 'x86'
9// :3:31: error: enum 'lang.Optimize' has no member named 'x86'
1010// : note: enum declared here
test/cli/options/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const main = b.addTest(.{ .root_module = b.createModule(.{
55 .root_source_file = b.path("src/main.zig"),
66 .target = b.graph.host,
7 .optimize = .Debug,
7 .optimize = .debug,
88 }) });
99
1010 const options = b.addOptions();
test/src/Cases.zig+1-1
......@@ -49,7 +49,7 @@ pub const Case = struct {
4949 /// In order to be able to run e.g. Execution updates, this must be set
5050 /// to Executable.
5151 output_mode: std.builtin.OutputMode,
52 optimize_mode: std.builtin.OptimizeMode = .Debug,
52 optimize_mode: std.builtin.Optimize = .debug,
5353
5454 files: std.array_list.Managed(File),
5555 case: ?union(enum) {
test/src/Debugger.zig+2-2
......@@ -7,14 +7,14 @@ pub const Options = struct {
77 test_target_filters: []const []const u8,
88 gdb: ?[]const u8,
99 lldb: ?[]const u8,
10 optimize_modes: []const std.builtin.OptimizeMode,
10 optimize_modes: []const std.builtin.Optimize,
1111 skip_single_threaded: bool,
1212 skip_libc: bool,
1313};
1414
1515pub const Target = struct {
1616 resolved: std.Build.ResolvedTarget,
17 optimize_mode: std.builtin.OptimizeMode = .Debug,
17 optimize_mode: std.builtin.Optimize = .debug,
1818 link_libc: ?bool = null,
1919 single_threaded: ?bool = null,
2020 pic: ?bool = null,
test/src/ErrorTrace.zig+1-1
......@@ -33,7 +33,7 @@ pub const Options = struct {
3333
3434pub const CaseParameters = struct {
3535 target: std.Target.Query = .{},
36 optimize: std.builtin.OptimizeMode = .debug,
36 optimize: OptimizeMode = .debug,
3737 use_llvm: ?bool = null,
3838 use_lld: ?bool = null,
3939
test/src/Libc.zig+1-1
......@@ -7,7 +7,7 @@ libc_test_src_path: std.Build.LazyPath,
77test_cases: std.ArrayList(TestCase) = .empty,
88
99pub const Options = struct {
10 optimize_modes: []const std.builtin.OptimizeMode,
10 optimize_modes: []const std.builtin.Optimize,
1111 test_filters: []const []const u8,
1212 test_target_filters: []const []const u8,
1313 skip_wasm: bool,
test/src/Link.zig+1-1
......@@ -1,6 +1,6 @@
11b: *Build,
22step: *Step,
3optimize: std.builtin.OptimizeMode,
3optimize: std.builtin.Optimize,
44target: std.Build.ResolvedTarget,
55target_desc: []const u8,
66use_llvm: bool,
test/src/LlvmIr.zig+1-1
......@@ -27,7 +27,7 @@ const TestCase = struct {
2727 // For most cases, we want to test the LLVM IR that we output; we don't want to be in the
2828 // business of testing LLVM's optimization passes. `Debug` gets us the closest to that as it
2929 // disables the vast majority of passes in LLVM.
30 optimize: std.builtin.OptimizeMode = .Debug,
30 optimize: std.builtin.Optimize = .debug,
3131 pic: ?bool = null,
3232 pie: ?bool = null,
3333 red_zone: ?bool = null,
test/src/StackTrace.zig+1-1
......@@ -34,7 +34,7 @@ pub const Options = struct {
3434pub const CaseParameters = struct {
3535 linkage: ?std.builtin.LinkMode = null,
3636 target: std.Target.Query = .{},
37 optimize: std.builtin.OptimizeMode = .debug,
37 optimize: std.lang.Optimize = .debug,
3838 link_libc: ?bool = null,
3939 use_llvm: ?bool = null,
4040 use_lld: ?bool = null,
test/standalone/c_compiler/build.zig+5-5
......@@ -5,10 +5,10 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 add(b, test_step, "test_c_Debug", "test_cpp_Debug", .Debug);
9 add(b, test_step, "test_c_ReleaseFast", "test_cpp_ReleaseFast", .ReleaseFast);
10 add(b, test_step, "test_c_ReleaseSmall", "test_cpp_ReleaseSmall", .ReleaseSmall);
11 add(b, test_step, "test_c_ReleaseSafe", "test_cpp_ReleaseSafe", .ReleaseSafe);
8 add(b, test_step, "test_c_debug", "test_cpp_debug", .debug);
9 add(b, test_step, "test_c_fast", "test_cpp_fast", .fast);
10 add(b, test_step, "test_c_small", "test_cpp_small", .small);
11 add(b, test_step, "test_c_safe", "test_cpp_safe", .safe);
1212}
1313
1414fn add(
......@@ -16,7 +16,7 @@ fn add(
1616 test_step: *std.Build.Step,
1717 c_name: []const u8,
1818 cpp_name: []const u8,
19 optimize: std.builtin.OptimizeMode,
19 optimize: std.builtin.Optimize,
2020) void {
2121 const target = b.graph.host;
2222
test/standalone/c_embed_path/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const exe = b.addExecutable(.{
1010 .name = "test",
test/standalone/child_process/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag == .wasi) return;
test/standalone/coff_dwarf/build.zig+1-1
......@@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void {
1818 const test_step = b.step("test", "Test it");
1919 b.default_step = test_step;
2020
21 const optimize: std.builtin.OptimizeMode = .Debug;
21 const optimize: std.builtin.Optimize = .debug;
2222 const target = switch (host.result.os.tag) {
2323 .windows => host,
2424 else => b.resolveTargetQuery(.{ .os_tag = .windows }),
test/standalone/compile_asm/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.resolveTargetQuery(.{
99 .os_tag = .freestanding,
1010 .cpu_arch = .arm,
test/standalone/dep_diamond/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main_mod = b.createModule(.{
1010 .root_source_file = b.path("test.zig"),
test/standalone/dep_mutually_recursive/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main_mod = b.createModule(.{
1010 .root_source_file = b.path("test.zig"),
test/standalone/dep_recursive/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main_mod = b.createModule(.{
1010 .root_source_file = b.path("test.zig"),
test/standalone/dep_shared_builtin/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main_mod = b.createModule(.{
1010 .root_source_file = b.path("test.zig"),
test/standalone/dep_triangle/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main_mod = b.createModule(.{
1010 .root_source_file = b.path("test.zig"),
test/standalone/dependency_options/build.zig+3-3
......@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) !void {
1010
1111 const none_specified_mod = none_specified.module("dummy");
1212 if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed;
13 const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) {
13 const expected_optimize: std.builtin.Optimize = switch (b.graph.release_mode) {
1414 .off => .debug,
1515 .any => unreachable,
1616 .fast => .fast,
......@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {
4444
4545 const all_specified = b.dependency("other", .{
4646 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
47 .optimize = @as(std.builtin.OptimizeMode, .safe),
47 .optimize = @as(std.builtin.Optimize, .safe),
4848 .bool = @as(bool, true),
4949 .int = @as(i64, 123),
5050 .float = @as(f64, 0.5),
......@@ -70,7 +70,7 @@ pub fn build(b: *std.Build) !void {
7070
7171 const all_specified_optional = b.dependency("other", .{
7272 .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })),
73 .optimize = @as(?std.builtin.OptimizeMode, .safe),
73 .optimize = @as(?std.builtin.Optimize, .safe),
7474 .bool = @as(?bool, true),
7575 .int = @as(?i64, 123),
7676 .float = @as(?f64, 0.5),
test/standalone/dirname/build.zig+2-2
......@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
1212 .name = "touch",
1313 .root_module = b.createModule(.{
1414 .root_source_file = touch_src,
15 .optimize = .Debug,
15 .optimize = .debug,
1616 .target = target,
1717 }),
1818 });
......@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
2222 .name = "exists_in",
2323 .root_module = b.createModule(.{
2424 .root_source_file = b.path("exists_in.zig"),
25 .optimize = .Debug,
25 .optimize = .debug,
2626 .target = target,
2727 }),
2828 });
test/standalone/elf2/build.zig+1-1
......@@ -32,7 +32,7 @@ fn addOne(
3232 const mod = b.createModule(.{
3333 .root_source_file = b.path("hello.zig"),
3434 .target = target,
35 .optimize = .Debug,
35 .optimize = .debug,
3636 .link_libc = link_mode == .dynamic,
3737 });
3838 const exe = b.addExecutable(.{
test/standalone/embed_generated_file/build.zig+2-2
......@@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void {
1212 .cpu_arch = .x86,
1313 .os_tag = .freestanding,
1414 }),
15 .optimize = .ReleaseSmall,
15 .optimize = .small,
1616 }),
1717 });
1818
1919 const exe = b.addTest(.{ .root_module = b.createModule(.{
2020 .root_source_file = b.path("main.zig"),
2121 .target = b.graph.host,
22 .optimize = .Debug,
22 .optimize = .debug,
2323 }) });
2424 exe.root_module.addAnonymousImport("bootloader.elf", .{
2525 .root_source_file = bootloader.getEmittedBin(),
test/standalone/emit_asm_no_bin/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const obj = b.addObject(.{
1010 .name = "main",
test/standalone/emit_llvm_no_bin/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const obj = b.addObject(.{
1010 .name = "main",
test/standalone/empty_env/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99
1010 if (builtin.os.tag == .windows and b.graph.environ_map.contains("ConEmuHWND")) {
1111 // ConEmu injects environment variables into processes before they are executed
test/standalone/entry_point/build.zig+2-2
......@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void {
66 .target = b.resolveTargetQuery(try .parse(.{
77 .arch_os_abi = "x86_64-linux",
88 })),
9 .optimize = .ReleaseFast, // non-Debug build for reproducible output
9 .optimize = .fast, // non-Debug build for reproducible output
1010 .root_source_file = b.path("main.zig"),
1111 });
1212
......@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
2929 .name = "check_differ",
3030 .root_module = b.createModule(.{
3131 .target = b.graph.host,
32 .optimize = .Debug,
32 .optimize = .debug,
3333 .root_source_file = b.path("check_differ.zig"),
3434 }),
3535 });
test/standalone/env_vars/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99
1010 const main = b.addExecutable(.{
1111 .name = "main",
test/standalone/extern/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const obj = b.addObject(.{
1010 .name = "exports",
test/standalone/glibc_compat/build.zig+3-3
......@@ -122,19 +122,19 @@ pub fn build(b: *std.Build) void {
122122 const malloc_translation = b.addTranslateC(.{
123123 .root_source_file = b.path("include_malloc.h"),
124124 .target = target,
125 .optimize = .Debug,
125 .optimize = .debug,
126126 .link_libc = true,
127127 });
128128 const stdlib_translation = b.addTranslateC(.{
129129 .root_source_file = b.path("include_stdlib.h"),
130130 .target = target,
131 .optimize = .Debug,
131 .optimize = .debug,
132132 .link_libc = true,
133133 });
134134 const string_translation = b.addTranslateC(.{
135135 .root_source_file = b.path("include_string.h"),
136136 .target = target,
137 .optimize = .Debug,
137 .optimize = .debug,
138138 .link_libc = true,
139139 });
140140 const exe = b.addExecutable(.{
test/standalone/global_linkage/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test the program");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.graph.host;
99
1010 const obj1 = b.addLibrary(.{
test/standalone/install_headers/build.zig+4-4
......@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
1212 .root_module = b.createModule(.{
1313 .root_source_file = null,
1414 .target = b.resolveTargetQuery(.{}),
15 .optimize = .Debug,
15 .optimize = .debug,
1616 }),
1717 });
1818 libfoo.root_module.addCSourceFile(.{ .file = empty_c });
......@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
2222 .root_module = b.createModule(.{
2323 .root_source_file = null,
2424 .target = b.resolveTargetQuery(.{}),
25 .optimize = .Debug,
25 .optimize = .debug,
2626 .link_libc = true,
2727 }),
2828 });
......@@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void {
6868 .root_module = b.createModule(.{
6969 .root_source_file = null,
7070 .target = b.resolveTargetQuery(.{}),
71 .optimize = .Debug,
71 .optimize = .debug,
7272 }),
7373 });
7474 libbar.root_module.addCSourceFile(.{ .file = empty_c });
......@@ -93,7 +93,7 @@ pub fn build(b: *std.Build) void {
9393 .root_module = b.createModule(.{
9494 .root_source_file = b.path("check_exists.zig"),
9595 .target = b.resolveTargetQuery(.{}),
96 .optimize = .Debug,
96 .optimize = .debug,
9797 }),
9898 });
9999 const run_check_exists = b.addRunArtifact(check_exists);
test/standalone/install_raw_hex/build.zig+1-1
......@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
1212 .abi = .gnueabihf,
1313 });
1414
15 const optimize: std.builtin.OptimizeMode = .Debug;
15 const optimize: std.builtin.Optimize = .debug;
1616
1717 const elf = b.addExecutable(.{
1818 .name = "zig-nrf52-blink.elf",
test/standalone/ios/build.zig+1-1
......@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
1616 .name = "main",
1717 .root_module = b.createModule(.{
1818 .root_source_file = b.path("panic.zig"),
19 .optimize = .Debug,
19 .optimize = .debug,
2020 .target = target,
2121 .link_libc = true,
2222 }),
test/standalone/issue_11595/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag == .windows) {
test/standalone/issue_12706/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 const exe = b.addExecutable(.{
test/standalone/issue_339/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.graph.host;
99
1010 const obj = b.addObject(.{
test/standalone/issue_5825/build.zig+1-1
......@@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void {
1313 .os_tag = .windows,
1414 .abi = .msvc,
1515 });
16 const optimize: std.builtin.OptimizeMode = .Debug;
16 const optimize: std.builtin.Optimize = .debug;
1717 const obj = b.addObject(.{
1818 .name = "issue_5825",
1919 .root_module = b.createModule(.{
test/standalone/load_dynamic_library/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag == .wasi) return;
test/standalone/mix_c_files/build.zig+5-5
......@@ -9,13 +9,13 @@ pub fn build(b: *std.Build) void {
99 return;
1010 }
1111
12 add(b, test_step, .Debug);
13 add(b, test_step, .ReleaseFast);
14 add(b, test_step, .ReleaseSmall);
15 add(b, test_step, .ReleaseSafe);
12 add(b, test_step, .debug);
13 add(b, test_step, .fast);
14 add(b, test_step, .small);
15 add(b, test_step, .safe);
1616}
1717
18fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
18fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize) void {
1919 const exe = b.addExecutable(.{
2020 .name = "test",
2121 .root_module = b.createModule(.{
test/standalone/mix_o_files/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.graph.host;
99
1010 const obj = b.addObject(.{
test/standalone/pkg_import/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const exe = b.addExecutable(.{
1010 .name = "test",
test/standalone/posix/build.zig+1-1
......@@ -54,7 +54,7 @@ pub fn build(b: *std.Build) void {
5454 }
5555}
5656
57fn run_exe(b: *std.Build, optimize: std.builtin.OptimizeMode, case: *const Case, target: std.Build.ResolvedTarget, link_libc: bool) *std.Build.Step.Run {
57fn run_exe(b: *std.Build, optimize: std.builtin.Optimize, case: *const Case, target: std.Build.ResolvedTarget, link_libc: bool) *std.Build.Step.Run {
5858 const exe_name = b.fmt("test-posix-{s}{s}{s}", .{
5959 std.fs.path.stem(case.src_path),
6060 if (link_libc) "-libc" else "",
test/standalone/run_cwd/build.zig+1-1
......@@ -3,7 +3,7 @@ pub fn build(b: *Build) void {
33 .name = "check_file_exists",
44 .root_module = b.createModule(.{
55 .target = b.graph.host,
6 .optimize = .Debug,
6 .optimize = .debug,
77 .root_source_file = b.path("check_file_exists.zig"),
88 }),
99 });
test/standalone/self_exe_symlink/build.zig+1-1
......@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
66 const test_step = b.step("test", "Test it");
77 b.default_step = test_step;
88
9 const optimize: std.builtin.OptimizeMode = .Debug;
9 const optimize: std.builtin.Optimize = .debug;
1010 const target = b.graph.host;
1111
1212 if (target.result.os.tag == .netbsd) return; // F_GETPATH not reliable
test/standalone/shared_library/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.standardTargetOptions(.{});
99
1010 const exe_names: []const []const u8 = &.{
test/standalone/simple/build.zig+1-1
......@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
1010 const skip_release_fast = b.option(bool, "skip_release_fast", "Skip release-fast builds") orelse false;
1111 const skip_release_small = b.option(bool, "skip_release_small", "Skip release-small builds") orelse false;
1212
13 var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined;
13 var optimize_modes_buf: [4]std.builtin.Optimize = undefined;
1414 var optimize_modes_len: usize = 0;
1515 if (!skip_debug) {
1616 optimize_modes_buf[optimize_modes_len] = .debug;
test/standalone/static_c_lib/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88 const target = b.standardTargetOptions(.{});
99
1010 const exe_names: []const []const u8 = &.{
test/standalone/strip_empty_loop/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test the program");
55 b.default_step = test_step;
66
7 const optimize = std.builtin.OptimizeMode.Debug;
7 const optimize = std.builtin.Optimize.debug;
88 const target = b.graph.host;
99
1010 const main = b.addExecutable(.{
test/standalone/strip_struct_init/build.zig+1-1
......@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;
7 const optimize: std.builtin.Optimize = .debug;
88
99 const main = b.addTest(.{
1010 .root_module = b.createModule(.{
test/standalone/tsan/build.zig+2-2
......@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
2929 .root_module = b.createModule(.{
3030 .root_source_file = b.path("main.zig"),
3131 .target = target,
32 .optimize = .Debug,
32 .optimize = .debug,
3333 .sanitize_thread = true,
3434 }),
3535 });
......@@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void {
4646 .root_module = b.createModule(.{
4747 .root_source_file = b.path("main.zig"),
4848 .target = target,
49 .optimize = .Debug,
49 .optimize = .debug,
5050 .sanitize_thread = true,
5151 }),
5252 });
test/standalone/windows_argv/build.zig+1-1
......@@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
77
88 if (builtin.os.tag != .windows) return;
99
10 const optimize: std.builtin.OptimizeMode = .Debug;
10 const optimize: std.builtin.Optimize = .debug;
1111
1212 const lib_gnu = b.addLibrary(.{
1313 .linkage = .static,
test/standalone/windows_bat_args/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag != .windows) return;
test/standalone/windows_entry_points/build.zig+12-12
......@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
1616 .root_module = b.createModule(.{
1717 .root_source_file = null,
1818 .target = target,
19 .optimize = .Debug,
19 .optimize = .debug,
2020 .link_libc = true,
2121 }),
2222 });
......@@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void {
3232 .root_module = b.createModule(.{
3333 .root_source_file = null,
3434 .target = target,
35 .optimize = .Debug,
35 .optimize = .debug,
3636 .link_libc = true,
3737 }),
3838 });
......@@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {
4949 .root_module = b.createModule(.{
5050 .root_source_file = null,
5151 .target = target,
52 .optimize = .Debug,
52 .optimize = .debug,
5353 .link_libc = true,
5454 }),
5555 });
......@@ -66,7 +66,7 @@ pub fn build(b: *std.Build) void {
6666 .root_module = b.createModule(.{
6767 .root_source_file = null,
6868 .target = target,
69 .optimize = .Debug,
69 .optimize = .debug,
7070 .link_libc = true,
7171 }),
7272 });
......@@ -84,7 +84,7 @@ pub fn build(b: *std.Build) void {
8484 .root_module = b.createModule(.{
8585 .root_source_file = b.path("main.zig"),
8686 .target = target,
87 .optimize = .Debug,
87 .optimize = .debug,
8888 }),
8989 });
9090
......@@ -98,7 +98,7 @@ pub fn build(b: *std.Build) void {
9898 .root_module = b.createModule(.{
9999 .root_source_file = b.path("main.zig"),
100100 .target = target,
101 .optimize = .Debug,
101 .optimize = .debug,
102102 .link_libc = true,
103103 }),
104104 });
......@@ -113,7 +113,7 @@ pub fn build(b: *std.Build) void {
113113 .root_module = b.createModule(.{
114114 .root_source_file = b.path("wwinmain.zig"),
115115 .target = target,
116 .optimize = .Debug,
116 .optimize = .debug,
117117 }),
118118 });
119119 exe.mingw_unicode_entry_point = true;
......@@ -129,7 +129,7 @@ pub fn build(b: *std.Build) void {
129129 .root_module = b.createModule(.{
130130 .root_source_file = b.path("wwinmain.zig"),
131131 .target = target,
132 .optimize = .Debug,
132 .optimize = .debug,
133133 .link_libc = true,
134134 }),
135135 });
......@@ -143,7 +143,7 @@ pub fn build(b: *std.Build) void {
143143 const load_dll_exe = b.addExecutable(.{ .name = "load_dll", .root_module = b.createModule(.{
144144 .root_source_file = b.path("loaddll.zig"),
145145 .target = target,
146 .optimize = .Debug,
146 .optimize = .debug,
147147 }) });
148148
149149 {
......@@ -153,7 +153,7 @@ pub fn build(b: *std.Build) void {
153153 .root_module = b.createModule(.{
154154 .root_source_file = b.path("dllmain.zig"),
155155 .target = target,
156 .optimize = .Debug,
156 .optimize = .debug,
157157 }),
158158 });
159159
......@@ -174,7 +174,7 @@ pub fn build(b: *std.Build) void {
174174 .root_module = b.createModule(.{
175175 .root_source_file = b.path("dllmain.zig"),
176176 .target = target,
177 .optimize = .Debug,
177 .optimize = .debug,
178178 .link_libc = true,
179179 }),
180180 });
......@@ -195,7 +195,7 @@ pub fn build(b: *std.Build) void {
195195 .linkage = .dynamic,
196196 .root_module = b.createModule(.{
197197 .target = target,
198 .optimize = .Debug,
198 .optimize = .debug,
199199 .link_libc = true,
200200 }),
201201 });
test/standalone/windows_paths/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag != .windows) return;
test/standalone/windows_resources/build.zig+1-1
......@@ -31,7 +31,7 @@ fn add(
3131 .root_module = b.createModule(.{
3232 .root_source_file = b.path("main.zig"),
3333 .target = target,
34 .optimize = .Debug,
34 .optimize = .debug,
3535 }),
3636 });
3737 exe.root_module.addWin32ResourceFile(.{
test/standalone/windows_spawn/build.zig+1-1
......@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
55 const test_step = b.step("test", "Test it");
66 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;
8 const optimize: std.builtin.Optimize = .debug;
99 const target = b.graph.host;
1010
1111 if (builtin.os.tag != .windows) return;
test/standalone/zerolength_check/build.zig+5-5
......@@ -4,13 +4,13 @@ pub fn build(b: *std.Build) void {
44 const test_step = b.step("test", "Test it");
55 b.default_step = test_step;
66
7 add(b, test_step, .Debug);
8 add(b, test_step, .ReleaseFast);
9 add(b, test_step, .ReleaseSmall);
10 add(b, test_step, .ReleaseSafe);
7 add(b, test_step, .debug);
8 add(b, test_step, .fast);
9 add(b, test_step, .small);
10 add(b, test_step, .safe);
1111}
1212
13fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
13fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize) void {
1414 const unit_tests = b.addTest(.{ .root_module = b.createModule(.{
1515 .root_source_file = b.path("src/main.zig"),
1616 .target = b.resolveTargetQuery(.{
test/tests.zig+4-4
......@@ -2,7 +2,7 @@ const std = @import("std");
22const builtin = @import("builtin");
33const assert = std.debug.assert;
44const mem = std.mem;
5const OptimizeMode = std.builtin.OptimizeMode;
5const OptimizeMode = std.builtin.Optimize;
66const Step = std.Build.Step;
77
88// Cases
......@@ -21,7 +21,7 @@ pub const LinkContext = @import("src/Link.zig");
2121const ModuleTestTarget = struct {
2222 linkage: ?std.builtin.LinkMode = null,
2323 target: std.Target.Query = .{},
24 optimize_mode: std.builtin.OptimizeMode = .debug,
24 optimize_mode: std.builtin.Optimize = .debug,
2525 link_libc: ?bool = null,
2626 single_threaded: ?bool = null,
2727 use_llvm: ?bool = null,
......@@ -2162,7 +2162,7 @@ const c_abi_targets = blk: {
21622162
21632163const LinkTarget = struct {
21642164 target: std.Target.Query = .{},
2165 optimize_mode: std.builtin.OptimizeMode = .debug,
2165 optimize_mode: std.builtin.Optimize = .debug,
21662166 link_libc: bool = false,
21672167 use_llvm: bool = false,
21682168 use_lld: bool = false,
......@@ -2573,7 +2573,7 @@ pub fn addCliTests(b: *std.Build) *Step {
25732573 // This is intended to be the exact CLI usage used by godbolt.org.
25742574 const run = b.addSystemCommand(&.{ b.graph.zig_exe, "build-obj", "--cache-dir" });
25752575 run.addDirectoryArg(tmp_path);
2576 run.addArgs(&.{ "--name", "example", "-fno-emit-bin", "-fno-emit-h", "-fstrip", "-OReleaseFast" });
2576 run.addArgs(&.{ "--name", "example", "-fno-emit-bin", "-fno-emit-h", "-fstrip", "-Ofast" });
25772577 run.addFileArg(example_zig);
25782578 const example_s = run.addPrefixedOutputFileArg("-femit-asm=", "example.s");
25792579
tools/doctest.zig+17-17
......@@ -156,7 +156,7 @@ fn printOutput(
156156 try shell_out.print("$ zig build-exe {s}.zig ", .{code_name});
157157
158158 switch (code.mode) {
159 .Debug => {},
159 .debug => {},
160160 else => {
161161 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
162162 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
......@@ -291,7 +291,7 @@ fn printOutput(
291291 try shell_out.print("$ zig test {s}.zig ", .{code_name});
292292
293293 switch (code.mode) {
294 .Debug => {},
294 .debug => {},
295295 else => {
296296 try test_args.appendSlice(&[_][]const u8{
297297 "-O", @tagName(code.mode),
......@@ -354,7 +354,7 @@ fn printOutput(
354354 try shell_out.print("$ zig test {s}.zig ", .{code_name});
355355
356356 switch (code.mode) {
357 .Debug => {},
357 .debug => {},
358358 else => {
359359 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
360360 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
......@@ -404,18 +404,18 @@ fn printOutput(
404404 }
405405 var mode_arg: []const u8 = "";
406406 switch (code.mode) {
407 .Debug => {},
408 .ReleaseSafe => {
409 try test_args.append("-OReleaseSafe");
410 mode_arg = "-OReleaseSafe";
407 .debug => {},
408 .safe => {
409 try test_args.append("-Osafe");
410 mode_arg = "-Osafe";
411411 },
412 .ReleaseFast => {
413 try test_args.append("-OReleaseFast");
414 mode_arg = "-OReleaseFast";
412 .fast => {
413 try test_args.append("-Ofast");
414 mode_arg = "-Ofast";
415415 },
416 .ReleaseSmall => {
417 try test_args.append("-OReleaseSmall");
418 mode_arg = "-OReleaseSmall";
416 .small => {
417 try test_args.append("-Osmall");
418 mode_arg = "-Osmall";
419419 },
420420 }
421421
......@@ -468,7 +468,7 @@ fn printOutput(
468468 try shell_out.print("$ zig build-obj {s}.zig ", .{code_name});
469469
470470 switch (code.mode) {
471 .Debug => {},
471 .debug => {},
472472 else => {
473473 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
474474 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
......@@ -548,7 +548,7 @@ fn printOutput(
548548 try shell_out.print("$ zig build-lib {s}.zig ", .{code_name});
549549
550550 switch (code.mode) {
551 .Debug => {},
551 .debug => {},
552552 else => {
553553 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
554554 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
......@@ -843,7 +843,7 @@ fn writeEscapedLines(out: *Writer, text: []const u8) !void {
843843
844844const Code = struct {
845845 id: Id,
846 mode: std.builtin.OptimizeMode,
846 mode: std.builtin.Optimize,
847847 link_objects: []const []const u8,
848848 target_str: ?[]const u8,
849849 link_libc: bool,
......@@ -903,7 +903,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
903903 else
904904 fatal("unrecognized manifest id: '{s}'", .{first_line});
905905
906 var mode: std.builtin.OptimizeMode = .Debug;
906 var mode: std.builtin.Optimize = .debug;
907907 var link_mode: ?std.builtin.LinkMode = null;
908908 var link_objects: std.ArrayList([]const u8) = .empty;
909909 var additional_options: std.ArrayList([]const u8) = .empty;
tools/migrate_langref.zig+4-4
......@@ -243,7 +243,7 @@ const Code = struct {
243243 name: []const u8,
244244 source_token: Token,
245245 just_check_syntax: bool,
246 mode: std.builtin.OptimizeMode,
246 mode: std.builtin.Optimize,
247247 link_objects: []const []const u8,
248248 target_str: ?[]const u8,
249249 link_libc: bool,
......@@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
319319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
320320 }
321321
322 var mode: std.builtin.OptimizeMode = .debug;
322 var mode: std.builtin.Optimize = .debug;
323323 var link_objects = std.array_list.Managed([]const u8).init(arena);
324324 var target_str: ?[]const u8 = null;
325325 var link_libc = false;
......@@ -333,9 +333,9 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
333333 const end_code_tag = try eatToken(tokenizer, .tag_content);
334334 const end_tag_name = tokenizer.buffer[end_code_tag.start..end_code_tag.end];
335335 if (mem.eql(u8, end_tag_name, "code_release_fast")) {
336 mode = .ReleaseFast;
336 mode = .fast;
337337 } else if (mem.eql(u8, end_tag_name, "code_release_safe")) {
338 mode = .ReleaseSafe;
338 mode = .safe;
339339 } else if (mem.eql(u8, end_tag_name, "code_disable_cache")) {
340340 disable_cache = true;
341341 } else if (mem.eql(u8, end_tag_name, "code_link_object")) {