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 {...@@ -57,7 +57,7 @@ pub fn build(b: *std.Build) !void {
57 .root_module = b.createModule(.{57 .root_module = b.createModule(.{
58 .root_source_file = b.path("lib/std/std.zig"),58 .root_source_file = b.path("lib/std/std.zig"),
59 .target = target,59 .target = target,
60 .optimize = .Debug,60 .optimize = .debug,
61 }),61 }),
62 });62 });
63 const install_std_docs = b.addInstallDirectory(.{63 const install_std_docs = b.addInstallDirectory(.{
...@@ -431,7 +431,7 @@ pub fn build(b: *std.Build) !void {...@@ -431,7 +431,7 @@ pub fn build(b: *std.Build) !void {
431 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{};431 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{};
432 const test_extra_targets = b.option(bool, "test-extra-targets", "Enable running module tests for additional targets") orelse false;432 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;
435 var chosen_mode_index: usize = 0;435 var chosen_mode_index: usize = 0;
436 if (!skip_debug) {436 if (!skip_debug) {
437 chosen_opt_modes_buf[chosen_mode_index] = .debug;437 chosen_opt_modes_buf[chosen_mode_index] = .debug;
...@@ -788,7 +788,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {...@@ -788,7 +788,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
788 const semver = try std.SemanticVersion.parse(version);788 const semver = try std.SemanticVersion.parse(version);
789789
790 const exe = addCompilerStep(b, .{790 const exe = addCompilerStep(b, .{
791 .optimize = .ReleaseSmall,791 .optimize = .small,
792 .target = b.resolveTargetQuery(std.Target.Query.parse(.{792 .target = b.resolveTargetQuery(std.Target.Query.parse(.{
793 .arch_os_abi = "wasm32-wasi",793 .arch_os_abi = "wasm32-wasi",
794 // * `nontrapping_bulk_memory_len0` is supported by `wasm2c`.794 // * `nontrapping_bulk_memory_len0` is supported by `wasm2c`.
...@@ -853,7 +853,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {...@@ -853,7 +853,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
853}853}
854854
855const AddCompilerModOptions = struct {855const AddCompilerModOptions = struct {
856 optimize: std.lang.OptimizeMode,856 optimize: std.lang.Optimize,
857 target: std.Build.ResolvedTarget,857 target: std.Build.ResolvedTarget,
858 strip: ?bool = null,858 strip: ?bool = null,
859 valgrind: ?bool = null,859 valgrind: ?bool = null,
...@@ -1606,7 +1606,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {...@@ -1606,7 +1606,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {
1606 .root_module = b.createModule(.{1606 .root_module = b.createModule(.{
1607 .root_source_file = b.path("tools/doctest.zig"),1607 .root_source_file = b.path("tools/doctest.zig"),
1608 .target = b.graph.host,1608 .target = b.graph.host,
1609 .optimize = .Debug,1609 .optimize = .debug,
1610 }),1610 }),
1611 });1611 });
16121612
...@@ -1649,7 +1649,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {...@@ -1649,7 +1649,7 @@ fn generateLangRef(b: *std.Build) !std.Build.LazyPath {
1649 .root_module = b.createModule(.{1649 .root_module = b.createModule(.{
1650 .root_source_file = b.path("tools/docgen.zig"),1650 .root_source_file = b.path("tools/docgen.zig"),
1651 .target = b.graph.host,1651 .target = b.graph.host,
1652 .optimize = .Debug,1652 .optimize = .debug,
1653 }),1653 }),
1654 });1654 });
16551655
lib/compiler/Maker.zig+2-2
...@@ -440,9 +440,9 @@ pub fn main(init: process.Init.Minimal) !void {...@@ -440,9 +440,9 @@ pub fn main(init: process.Init.Minimal) !void {
440 } else if (mem.eql(u8, arg, "--debug-pkg-config")) {440 } else if (mem.eql(u8, arg, "--debug-pkg-config")) {
441 debug_pkg_config = true;441 debug_pkg_config = true;
442 } else if (mem.eql(u8, arg, "--debug-rt")) {442 } else if (mem.eql(u8, arg, "--debug-rt")) {
443 graph.debug_compiler_runtime_libs = .Debug;443 graph.debug_compiler_runtime_libs = .debug;
444 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {444 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {
445 graph.debug_compiler_runtime_libs = stringToEnum(std.lang.OptimizeMode, rest) orelse445 graph.debug_compiler_runtime_libs = stringToEnum(std.lang.Optimize, rest) orelse
446 fatal("unrecognized optimization mode: {s}", .{rest});446 fatal("unrecognized optimization mode: {s}", .{rest});
447 } else if (is_debug_mode and mem.eql(u8, arg, "--debug-maker-leaks")) {447 } else if (is_debug_mode and mem.eql(u8, arg, "--debug-maker-leaks")) {
448 debug_maker_leaks = true;448 debug_maker_leaks = true;
lib/compiler/Maker/Graph.zig+1-1
...@@ -18,7 +18,7 @@ local_cache_root: Directory,...@@ -18,7 +18,7 @@ local_cache_root: Directory,
18zig_lib_directory: Directory,18zig_lib_directory: Directory,
19build_root_directory: Directory,19build_root_directory: Directory,
2020
21debug_compiler_runtime_libs: ?std.builtin.OptimizeMode = null,21debug_compiler_runtime_libs: ?std.builtin.Optimize = null,
22incremental: ?bool = null,22incremental: ?bool = null,
23random_seed: u32 = 0,23random_seed: u32 = 0,
24allow_so_scripts: ?bool = null,24allow_so_scripts: ?bool = null,
lib/compiler/Maker/Step/Compile.zig+5-5
...@@ -666,7 +666,7 @@ fn lowerZigArgs(...@@ -666,7 +666,7 @@ fn lowerZigArgs(
666666
667 try zig_args.ensureUnusedCapacity(gpa, 1);667 try zig_args.ensureUnusedCapacity(gpa, 1);
668 if (graph.debug_compiler_runtime_libs) |mode| switch (mode) {668 if (graph.debug_compiler_runtime_libs) |mode| switch (mode) {
669 .Debug => zig_args.appendAssumeCapacity("--debug-rt"),669 .debug => zig_args.appendAssumeCapacity("--debug-rt"),
670 else => zig_args.appendAssumeCapacity(try arena.print("--debug-rt={t}", .{mode})),670 else => zig_args.appendAssumeCapacity(try arena.print("--debug-rt={t}", .{mode})),
671 };671 };
672672
...@@ -1266,10 +1266,10 @@ fn appendModuleFlags(...@@ -1266,10 +1266,10 @@ fn appendModuleFlags(
1266 }1266 }
12671267
1268 switch (m.flags.optimize) {1268 switch (m.flags.optimize) {
1269 .debug => zig_args.appendAssumeCapacity("-ODebug"),1269 .debug => zig_args.appendAssumeCapacity("-Odebug"),
1270 .safe => zig_args.appendAssumeCapacity("-OReleaseSafe"),1270 .safe => zig_args.appendAssumeCapacity("-Osafe"),
1271 .fast => zig_args.appendAssumeCapacity("-OReleaseFast"),1271 .fast => zig_args.appendAssumeCapacity("-Ofast"),
1272 .small => zig_args.appendAssumeCapacity("-OReleaseSmall"),1272 .small => zig_args.appendAssumeCapacity("-Osmall"),
1273 .default => {},1273 .default => {},
1274 }1274 }
12751275
lib/compiler/Maker/Step/TranslateC.zig+1-1
...@@ -4,7 +4,7 @@ const std = @import("std");...@@ -4,7 +4,7 @@ const std = @import("std");
4const Io = std.Io;4const Io = std.Io;
5const Configuration = std.Build.Configuration;5const Configuration = std.Build.Configuration;
6const assert = std.debug.assert;6const assert = std.debug.assert;
7const OptimizeMode = std.lang.OptimizeMode;7const OptimizeMode = std.lang.Optimize;
88
9const Step = @import("../Step.zig");9const Step = @import("../Step.zig");
10const Maker = @import("../../Maker.zig");10const Maker = @import("../../Maker.zig");
lib/compiler/Maker/WebServer.zig+2-2
...@@ -531,7 +531,7 @@ fn serveLibFile(...@@ -531,7 +531,7 @@ fn serveLibFile(
531fn serveClientWasm(531fn serveClientWasm(
532 ws: *WebServer,532 ws: *WebServer,
533 req: *http.Server.Request,533 req: *http.Server.Request,
534 optimize_mode: std.builtin.OptimizeMode,534 optimize_mode: std.builtin.Optimize,
535) !void {535) !void {
536 const gpa = ws.graph.cache.gpa;536 const gpa = ws.graph.cache.gpa;
537537
...@@ -603,7 +603,7 @@ pub fn serveTarFile(ws: *WebServer, request: *http.Server.Request, paths: []cons...@@ -603,7 +603,7 @@ pub fn serveTarFile(ws: *WebServer, request: *http.Server.Request, paths: []cons
603 try response.end();603 try response.end();
604}604}
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 {
607 const root_name = "build-web";607 const root_name = "build-web";
608 const arch_os_abi = "wasm32-freestanding";608 const arch_os_abi = "wasm32-freestanding";
609 const cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_globals+nontrapping_fptoint+reference_types+sign_ext";609 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 {...@@ -259,7 +259,7 @@ fn serveSourcesTar(request: *std.http.Server.Request, context: *Context) !void {
259fn serveWasm(259fn serveWasm(
260 request: *std.http.Server.Request,260 request: *std.http.Server.Request,
261 context: *Context,261 context: *Context,
262 optimize_mode: std.builtin.OptimizeMode,262 optimize_mode: std.builtin.Optimize,
263) !void {263) !void {
264 const gpa = context.gpa;264 const gpa = context.gpa;
265 const io = context.io;265 const io = context.io;
...@@ -302,7 +302,7 @@ const autodoc_cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_gl...@@ -302,7 +302,7 @@ const autodoc_cpu_features = "baseline+atomics+bulk_memory+multivalue+mutable_gl
302fn buildWasmBinary(302fn buildWasmBinary(
303 arena: Allocator,303 arena: Allocator,
304 context: *Context,304 context: *Context,
305 optimize_mode: std.builtin.OptimizeMode,305 optimize_mode: std.builtin.Optimize,
306) !Cache.Path {306) !Cache.Path {
307 const gpa = context.gpa;307 const gpa = context.gpa;
308 const io = context.io;308 const io = context.io;
lib/std/Build.zig+5-5
...@@ -691,7 +691,7 @@ pub const AssemblyOptions = struct {...@@ -691,7 +691,7 @@ pub const AssemblyOptions = struct {
691 /// To choose the same computer as the one building the package, pass the691 /// To choose the same computer as the one building the package, pass the
692 /// `host` field of the package's `Build` instance.692 /// `host` field of the package's `Build` instance.
693 target: ResolvedTarget,693 target: ResolvedTarget,
694 optimize: std.builtin.OptimizeMode,694 optimize: std.builtin.Optimize,
695 max_rss: u64 = 0,695 max_rss: u64 = 0,
696 zig_lib_dir: ?LazyPath = null,696 zig_lib_dir: ?LazyPath = null,
697};697};
...@@ -1188,22 +1188,22 @@ pub fn step(b: *Build, name: []const u8, description: []const u8) *Step {...@@ -1188,22 +1188,22 @@ pub fn step(b: *Build, name: []const u8, description: []const u8) *Step {
1188}1188}
11891189
1190pub const StandardOptimizeOptionOptions = struct {1190pub const StandardOptimizeOptionOptions = struct {
1191 preferred_optimize_mode: ?std.builtin.OptimizeMode = null,1191 preferred_optimize_mode: ?std.builtin.Optimize = null,
1192};1192};
11931193
1194pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.OptimizeMode {1194pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) std.builtin.Optimize {
1195 const graph = b.graph;1195 const graph = b.graph;
11961196
1197 if (options.preferred_optimize_mode) |mode| {1197 if (options.preferred_optimize_mode) |mode| {
1198 if (b.option(bool, "release", "optimize for end users") orelse (graph.release_mode != .off)) {1198 if (b.option(bool, "release", "optimize for end users") orelse (graph.release_mode != .off)) {
1199 return mode;1199 return mode;
1200 } else {1200 } else {
1201 return .Debug;1201 return .debug;
1202 }1202 }
1203 }1203 }
12041204
1205 if (b.option(1205 if (b.option(
1206 std.builtin.OptimizeMode,1206 std.builtin.Optimize,
1207 "optimize",1207 "optimize",
1208 "Prioritize performance, safety, or binary size",1208 "Prioritize performance, safety, or binary size",
1209 )) |mode| {1209 )) |mode| {
lib/std/Build/Configuration.zig+1-1
...@@ -1660,7 +1660,7 @@ pub const Module = struct {...@@ -1660,7 +1660,7 @@ pub const Module = struct {
1660 small,1660 small,
1661 default,1661 default,
16621662
1663 pub fn init(o: ?std.builtin.OptimizeMode) Optimize {1663 pub fn init(o: ?std.builtin.Optimize) Optimize {
1664 return switch (o orelse return .default) {1664 return switch (o orelse return .default) {
1665 .debug => .debug,1665 .debug => .debug,
1666 .safe => .safe,1666 .safe => .safe,
lib/std/Build/Module.zig+2-2
...@@ -15,7 +15,7 @@ root_source_file: ?LazyPath,...@@ -15,7 +15,7 @@ root_source_file: ?LazyPath,
15import_table: std.array_hash_map.String(*Module),15import_table: std.array_hash_map.String(*Module),
1616
17resolved_target: ?std.Build.ResolvedTarget = null,17resolved_target: ?std.Build.ResolvedTarget = null,
18optimize: ?std.builtin.OptimizeMode = null,18optimize: ?std.builtin.Optimize = null,
19dwarf_format: ?std.dwarf.Format,19dwarf_format: ?std.dwarf.Format,
2020
21c_macros: ArrayList([]const u8),21c_macros: ArrayList([]const u8),
...@@ -200,7 +200,7 @@ pub const CreateOptions = struct {...@@ -200,7 +200,7 @@ pub const CreateOptions = struct {
200 imports: []const Import = &.{},200 imports: []const Import = &.{},
201201
202 target: ?std.Build.ResolvedTarget = null,202 target: ?std.Build.ResolvedTarget = null,
203 optimize: ?std.builtin.OptimizeMode = null,203 optimize: ?std.builtin.Optimize = null,
204204
205 /// `true` requires a compilation that includes this Module to link libc.205 /// `true` requires a compilation that includes this Module to link libc.
206 /// `false` causes a build failure if a compilation that includes this Module would link libc.206 /// `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,...@@ -13,7 +13,7 @@ include_dirs: std.ArrayList(std.Build.Module.IncludeDir) = .empty,
13system_libs: std.ArrayList(std.Build.Module.SystemLib) = .empty,13system_libs: std.ArrayList(std.Build.Module.SystemLib) = .empty,
14c_macros: std.ArrayList(Configuration.String) = .empty,14c_macros: std.ArrayList(Configuration.String) = .empty,
15target: std.Build.ResolvedTarget,15target: std.Build.ResolvedTarget,
16optimize: std.builtin.OptimizeMode,16optimize: std.builtin.Optimize,
17output_file: Configuration.GeneratedFileIndex,17output_file: Configuration.GeneratedFileIndex,
18link_libc: bool,18link_libc: bool,
1919
...@@ -22,7 +22,7 @@ pub const base_tag: Step.Tag = .translate_c;...@@ -22,7 +22,7 @@ pub const base_tag: Step.Tag = .translate_c;
22pub const Options = struct {22pub const Options = struct {
23 root_source_file: std.Build.LazyPath,23 root_source_file: std.Build.LazyPath,
24 target: std.Build.ResolvedTarget,24 target: std.Build.ResolvedTarget,
25 optimize: std.builtin.OptimizeMode,25 optimize: std.builtin.Optimize,
26 link_libc: bool = true,26 link_libc: bool = true,
27};27};
2828
...@@ -50,7 +50,7 @@ pub const AddExecutableOptions = struct {...@@ -50,7 +50,7 @@ pub const AddExecutableOptions = struct {
50 name: ?[]const u8 = null,50 name: ?[]const u8 = null,
51 version: ?std.SemanticVersion = null,51 version: ?std.SemanticVersion = null,
52 target: ?std.Build.ResolvedTarget = null,52 target: ?std.Build.ResolvedTarget = null,
53 optimize: ?std.builtin.OptimizeMode = null,53 optimize: ?std.builtin.Optimize = null,
54 linkage: ?std.builtin.LinkMode = null,54 linkage: ?std.builtin.LinkMode = null,
55};55};
5656
lib/std/Io/Threaded.zig+2-2
...@@ -16972,7 +16972,7 @@ test argvToCommandLineWindows {...@@ -16972,7 +16972,7 @@ test argvToCommandLineWindows {
16972 ,16972 ,
16973 \\-O16973 \\-O
16974 ,16974 ,
16975 \\ReleaseSafe16975 \\safe
16976 ,16976 ,
16977 \\--16977 \\--
16978 ,16978 ,
...@@ -16981,7 +16981,7 @@ test argvToCommandLineWindows {...@@ -16981,7 +16981,7 @@ test argvToCommandLineWindows {
16981 \\--eval=new Regex("Dwayne \"The Rock\" Johnson")16981 \\--eval=new Regex("Dwayne \"The Rock\" Johnson")
16982 ,16982 ,
16983 },16983 },
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\")"
16985 );16985 );
1698616986
16987 try t(&.{}, "");16987 try t(&.{}, "");
lib/std/heap/debug_allocator.zig+1-1
...@@ -105,7 +105,7 @@ const Log2USize = std.math.Log2Int(usize);...@@ -105,7 +105,7 @@ const Log2USize = std.math.Log2Int(usize);
105105
106const default_sys_stack_trace_frames: usize = if (std.debug.sys_can_stack_trace) 6 else 0;106const default_sys_stack_trace_frames: usize = if (std.debug.sys_can_stack_trace) 6 else 0;
107const default_stack_trace_frames: usize = switch (builtin.mode) {107const default_stack_trace_frames: usize = switch (builtin.mode) {
108 .Debug => default_sys_stack_trace_frames,108 .debug => default_sys_stack_trace_frames,
109 else => 0,109 else => 0,
110};110};
111111
lib/std/log.zig+1-1
...@@ -52,7 +52,7 @@ pub const Level = enum {...@@ -52,7 +52,7 @@ pub const Level = enum {
5252
53/// The default log level is based on build mode.53/// The default log level is based on build mode.
54pub const default_level: Level = switch (builtin.mode) {54pub const default_level: Level = switch (builtin.mode) {
55 .Debug => .debug,55 .debug => .debug,
56 .safe, .fast, .small => .info,56 .safe, .fast, .small => .info,
57};57};
5858
lib/std/os/windows.zig+2-2
...@@ -3955,7 +3955,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError {...@@ -3955,7 +3955,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError {
39553955
3956pub fn statusBug(status: NTSTATUS) UnexpectedError {3956pub fn statusBug(status: NTSTATUS) UnexpectedError {
3957 switch (builtin.mode) {3957 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})", .{
3959 @backingInt(status),3959 @backingInt(status),
3960 std.enums.tagName(NTSTATUS, status) orelse "<unnamed>",3960 std.enums.tagName(NTSTATUS, status) orelse "<unnamed>",
3961 }),3961 }),
...@@ -3965,7 +3965,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError {...@@ -3965,7 +3965,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError {
39653965
3966pub fn errorBug(err: Win32Error) UnexpectedError {3966pub fn errorBug(err: Win32Error) UnexpectedError {
3967 switch (builtin.mode) {3967 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})", .{
3969 @backingInt(err),3969 @backingInt(err),
3970 std.enums.tagName(Win32Error, err) orelse "<unnamed>",3970 std.enums.tagName(Win32Error, err) orelse "<unnamed>",
3971 }),3971 }),
lib/std/process/Args.zig+2-2
...@@ -537,7 +537,7 @@ test "Iterator.Windows" {...@@ -537,7 +537,7 @@ test "Iterator.Windows" {
537 const t = testIteratorWindows;537 const t = testIteratorWindows;
538538
539 try t(539 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\")"
541 , &.{541 , &.{
542 \\C:\Program Files\zig\zig.exe542 \\C:\Program Files\zig\zig.exe
543 ,543 ,
...@@ -551,7 +551,7 @@ test "Iterator.Windows" {...@@ -551,7 +551,7 @@ test "Iterator.Windows" {
551 ,551 ,
552 \\-O552 \\-O
553 ,553 ,
554 \\ReleaseSafe554 \\safe
555 ,555 ,
556 \\--556 \\--
557 ,557 ,
src/codegen/riscv64/CodeGen.zig+1-1
...@@ -8341,7 +8341,7 @@ fn resolveCallingConventionValues(...@@ -8341,7 +8341,7 @@ fn resolveCallingConventionValues(
83418341
8342fn wantSafety(func: *Func) bool {8342fn wantSafety(func: *Func) bool {
8343 return switch (func.mod.optimize_mode) {8343 return switch (func.mod.optimize_mode) {
8344 .Debug => true,8344 .debug => true,
8345 .safe => true,8345 .safe => true,
8346 .fast => false,8346 .fast => false,
8347 .small => false,8347 .small => false,
src/codegen/sparc64/CodeGen.zig+1-1
...@@ -4766,7 +4766,7 @@ fn truncRegister(...@@ -4766,7 +4766,7 @@ fn truncRegister(
4766/// TODO support scope overrides. Also note this logic is duplicated with `Zcu.wantSafety`.4766/// TODO support scope overrides. Also note this logic is duplicated with `Zcu.wantSafety`.
4767fn wantSafety(self: *Self) bool {4767fn wantSafety(self: *Self) bool {
4768 return switch (self.bin_file.comp.root_mod.optimize_mode) {4768 return switch (self.bin_file.comp.root_mod.optimize_mode) {
4769 .Debug => true,4769 .debug => true,
4770 .safe => true,4770 .safe => true,
4771 .fast => false,4771 .fast => false,
4772 .small => false,4772 .small => false,
src/main.zig+1-1
...@@ -805,7 +805,7 @@ const compile_usage =...@@ -805,7 +805,7 @@ const compile_usage =
805 \\ --debug-compile-errors Crash with helpful diagnostics at the first compile error805 \\ --debug-compile-errors Crash with helpful diagnostics at the first compile error
806 \\ --debug-link-snapshot Enable dumping of the linker's state in JSON format806 \\ --debug-link-snapshot Enable dumping of the linker's state in JSON format
807 \\ --debug-rt[=mode] Build compiler runtime libraries with [mode] optimization807 \\ --debug-rt[=mode] Build compiler runtime libraries with [mode] optimization
808 \\ (Debug if [=mode] is omitted)808 \\ (debug if [=mode] is omitted)
809 \\ --debug-incremental Enable incremental compilation debug features809 \\ --debug-incremental Enable incremental compilation debug features
810 \\810 \\
811;811;
test/cases/compile_errors/invalid_member_of_builtin_enum.zig+2-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1const lang = @import("std").lang;1const lang = @import("std").lang;
2export fn entry() void {2export fn entry() void {
3 const foo = lang.OptimizeMode.x86;3 const foo = lang.Optimize.x86;
4 _ = foo;4 _ = foo;
5}5}
66
7// error7// error
8//8//
9// :3:35: error: enum 'lang.Optimize' has no member named 'x86'9// :3:31: error: enum 'lang.Optimize' has no member named 'x86'
10// : note: enum declared here10// : note: enum declared here
test/cli/options/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const main = b.addTest(.{ .root_module = b.createModule(.{4 const main = b.addTest(.{ .root_module = b.createModule(.{
5 .root_source_file = b.path("src/main.zig"),5 .root_source_file = b.path("src/main.zig"),
6 .target = b.graph.host,6 .target = b.graph.host,
7 .optimize = .Debug,7 .optimize = .debug,
8 }) });8 }) });
99
10 const options = b.addOptions();10 const options = b.addOptions();
test/src/Cases.zig+1-1
...@@ -49,7 +49,7 @@ pub const Case = struct {...@@ -49,7 +49,7 @@ pub const Case = struct {
49 /// In order to be able to run e.g. Execution updates, this must be set49 /// In order to be able to run e.g. Execution updates, this must be set
50 /// to Executable.50 /// to Executable.
51 output_mode: std.builtin.OutputMode,51 output_mode: std.builtin.OutputMode,
52 optimize_mode: std.builtin.OptimizeMode = .Debug,52 optimize_mode: std.builtin.Optimize = .debug,
5353
54 files: std.array_list.Managed(File),54 files: std.array_list.Managed(File),
55 case: ?union(enum) {55 case: ?union(enum) {
test/src/Debugger.zig+2-2
...@@ -7,14 +7,14 @@ pub const Options = struct {...@@ -7,14 +7,14 @@ pub const Options = struct {
7 test_target_filters: []const []const u8,7 test_target_filters: []const []const u8,
8 gdb: ?[]const u8,8 gdb: ?[]const u8,
9 lldb: ?[]const u8,9 lldb: ?[]const u8,
10 optimize_modes: []const std.builtin.OptimizeMode,10 optimize_modes: []const std.builtin.Optimize,
11 skip_single_threaded: bool,11 skip_single_threaded: bool,
12 skip_libc: bool,12 skip_libc: bool,
13};13};
1414
15pub const Target = struct {15pub const Target = struct {
16 resolved: std.Build.ResolvedTarget,16 resolved: std.Build.ResolvedTarget,
17 optimize_mode: std.builtin.OptimizeMode = .Debug,17 optimize_mode: std.builtin.Optimize = .debug,
18 link_libc: ?bool = null,18 link_libc: ?bool = null,
19 single_threaded: ?bool = null,19 single_threaded: ?bool = null,
20 pic: ?bool = null,20 pic: ?bool = null,
test/src/ErrorTrace.zig+1-1
...@@ -33,7 +33,7 @@ pub const Options = struct {...@@ -33,7 +33,7 @@ pub const Options = struct {
3333
34pub const CaseParameters = struct {34pub const CaseParameters = struct {
35 target: std.Target.Query = .{},35 target: std.Target.Query = .{},
36 optimize: std.builtin.OptimizeMode = .debug,36 optimize: OptimizeMode = .debug,
37 use_llvm: ?bool = null,37 use_llvm: ?bool = null,
38 use_lld: ?bool = null,38 use_lld: ?bool = null,
3939
test/src/Libc.zig+1-1
...@@ -7,7 +7,7 @@ libc_test_src_path: std.Build.LazyPath,...@@ -7,7 +7,7 @@ libc_test_src_path: std.Build.LazyPath,
7test_cases: std.ArrayList(TestCase) = .empty,7test_cases: std.ArrayList(TestCase) = .empty,
88
9pub const Options = struct {9pub const Options = struct {
10 optimize_modes: []const std.builtin.OptimizeMode,10 optimize_modes: []const std.builtin.Optimize,
11 test_filters: []const []const u8,11 test_filters: []const []const u8,
12 test_target_filters: []const []const u8,12 test_target_filters: []const []const u8,
13 skip_wasm: bool,13 skip_wasm: bool,
test/src/Link.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1b: *Build,1b: *Build,
2step: *Step,2step: *Step,
3optimize: std.builtin.OptimizeMode,3optimize: std.builtin.Optimize,
4target: std.Build.ResolvedTarget,4target: std.Build.ResolvedTarget,
5target_desc: []const u8,5target_desc: []const u8,
6use_llvm: bool,6use_llvm: bool,
test/src/LlvmIr.zig+1-1
...@@ -27,7 +27,7 @@ const TestCase = struct {...@@ -27,7 +27,7 @@ const TestCase = struct {
27 // For most cases, we want to test the LLVM IR that we output; we don't want to be in the27 // For most cases, we want to test the LLVM IR that we output; we don't want to be in the
28 // business of testing LLVM's optimization passes. `Debug` gets us the closest to that as it28 // business of testing LLVM's optimization passes. `Debug` gets us the closest to that as it
29 // disables the vast majority of passes in LLVM.29 // disables the vast majority of passes in LLVM.
30 optimize: std.builtin.OptimizeMode = .Debug,30 optimize: std.builtin.Optimize = .debug,
31 pic: ?bool = null,31 pic: ?bool = null,
32 pie: ?bool = null,32 pie: ?bool = null,
33 red_zone: ?bool = null,33 red_zone: ?bool = null,
test/src/StackTrace.zig+1-1
...@@ -34,7 +34,7 @@ pub const Options = struct {...@@ -34,7 +34,7 @@ pub const Options = struct {
34pub const CaseParameters = struct {34pub const CaseParameters = struct {
35 linkage: ?std.builtin.LinkMode = null,35 linkage: ?std.builtin.LinkMode = null,
36 target: std.Target.Query = .{},36 target: std.Target.Query = .{},
37 optimize: std.builtin.OptimizeMode = .debug,37 optimize: std.lang.Optimize = .debug,
38 link_libc: ?bool = null,38 link_libc: ?bool = null,
39 use_llvm: ?bool = null,39 use_llvm: ?bool = null,
40 use_lld: ?bool = null,40 use_lld: ?bool = null,
test/standalone/c_compiler/build.zig+5-5
...@@ -5,10 +5,10 @@ pub fn build(b: *std.Build) void {...@@ -5,10 +5,10 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 add(b, test_step, "test_c_Debug", "test_cpp_Debug", .Debug);8 add(b, test_step, "test_c_debug", "test_cpp_debug", .debug);
9 add(b, test_step, "test_c_ReleaseFast", "test_cpp_ReleaseFast", .ReleaseFast);9 add(b, test_step, "test_c_fast", "test_cpp_fast", .fast);
10 add(b, test_step, "test_c_ReleaseSmall", "test_cpp_ReleaseSmall", .ReleaseSmall);10 add(b, test_step, "test_c_small", "test_cpp_small", .small);
11 add(b, test_step, "test_c_ReleaseSafe", "test_cpp_ReleaseSafe", .ReleaseSafe);11 add(b, test_step, "test_c_safe", "test_cpp_safe", .safe);
12}12}
1313
14fn add(14fn add(
...@@ -16,7 +16,7 @@ fn add(...@@ -16,7 +16,7 @@ fn add(
16 test_step: *std.Build.Step,16 test_step: *std.Build.Step,
17 c_name: []const u8,17 c_name: []const u8,
18 cpp_name: []const u8,18 cpp_name: []const u8,
19 optimize: std.builtin.OptimizeMode,19 optimize: std.builtin.Optimize,
20) void {20) void {
21 const target = b.graph.host;21 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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const exe = b.addExecutable(.{9 const exe = b.addExecutable(.{
10 .name = "test",10 .name = "test",
test/standalone/child_process/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag == .wasi) return;11 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 {...@@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void {
18 const test_step = b.step("test", "Test it");18 const test_step = b.step("test", "Test it");
19 b.default_step = test_step;19 b.default_step = test_step;
2020
21 const optimize: std.builtin.OptimizeMode = .Debug;21 const optimize: std.builtin.Optimize = .debug;
22 const target = switch (host.result.os.tag) {22 const target = switch (host.result.os.tag) {
23 .windows => host,23 .windows => host,
24 else => b.resolveTargetQuery(.{ .os_tag = .windows }),24 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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.resolveTargetQuery(.{8 const target = b.resolveTargetQuery(.{
9 .os_tag = .freestanding,9 .os_tag = .freestanding,
10 .cpu_arch = .arm,10 .cpu_arch = .arm,
test/standalone/dep_diamond/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main_mod = b.createModule(.{9 const main_mod = b.createModule(.{
10 .root_source_file = b.path("test.zig"),10 .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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main_mod = b.createModule(.{9 const main_mod = b.createModule(.{
10 .root_source_file = b.path("test.zig"),10 .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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main_mod = b.createModule(.{9 const main_mod = b.createModule(.{
10 .root_source_file = b.path("test.zig"),10 .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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main_mod = b.createModule(.{9 const main_mod = b.createModule(.{
10 .root_source_file = b.path("test.zig"),10 .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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main_mod = b.createModule(.{9 const main_mod = b.createModule(.{
10 .root_source_file = b.path("test.zig"),10 .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 {...@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) !void {
1010
11 const none_specified_mod = none_specified.module("dummy");11 const none_specified_mod = none_specified.module("dummy");
12 if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed;12 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) {
14 .off => .debug,14 .off => .debug,
15 .any => unreachable,15 .any => unreachable,
16 .fast => .fast,16 .fast => .fast,
...@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {...@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {
4444
45 const all_specified = b.dependency("other", .{45 const all_specified = b.dependency("other", .{
46 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),46 .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),
48 .bool = @as(bool, true),48 .bool = @as(bool, true),
49 .int = @as(i64, 123),49 .int = @as(i64, 123),
50 .float = @as(f64, 0.5),50 .float = @as(f64, 0.5),
...@@ -70,7 +70,7 @@ pub fn build(b: *std.Build) !void {...@@ -70,7 +70,7 @@ pub fn build(b: *std.Build) !void {
7070
71 const all_specified_optional = b.dependency("other", .{71 const all_specified_optional = b.dependency("other", .{
72 .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })),72 .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),
74 .bool = @as(?bool, true),74 .bool = @as(?bool, true),
75 .int = @as(?i64, 123),75 .int = @as(?i64, 123),
76 .float = @as(?f64, 0.5),76 .float = @as(?f64, 0.5),
test/standalone/dirname/build.zig+2-2
...@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {...@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
12 .name = "touch",12 .name = "touch",
13 .root_module = b.createModule(.{13 .root_module = b.createModule(.{
14 .root_source_file = touch_src,14 .root_source_file = touch_src,
15 .optimize = .Debug,15 .optimize = .debug,
16 .target = target,16 .target = target,
17 }),17 }),
18 });18 });
...@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {...@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
22 .name = "exists_in",22 .name = "exists_in",
23 .root_module = b.createModule(.{23 .root_module = b.createModule(.{
24 .root_source_file = b.path("exists_in.zig"),24 .root_source_file = b.path("exists_in.zig"),
25 .optimize = .Debug,25 .optimize = .debug,
26 .target = target,26 .target = target,
27 }),27 }),
28 });28 });
test/standalone/elf2/build.zig+1-1
...@@ -32,7 +32,7 @@ fn addOne(...@@ -32,7 +32,7 @@ fn addOne(
32 const mod = b.createModule(.{32 const mod = b.createModule(.{
33 .root_source_file = b.path("hello.zig"),33 .root_source_file = b.path("hello.zig"),
34 .target = target,34 .target = target,
35 .optimize = .Debug,35 .optimize = .debug,
36 .link_libc = link_mode == .dynamic,36 .link_libc = link_mode == .dynamic,
37 });37 });
38 const exe = b.addExecutable(.{38 const exe = b.addExecutable(.{
test/standalone/embed_generated_file/build.zig+2-2
...@@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void {...@@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void {
12 .cpu_arch = .x86,12 .cpu_arch = .x86,
13 .os_tag = .freestanding,13 .os_tag = .freestanding,
14 }),14 }),
15 .optimize = .ReleaseSmall,15 .optimize = .small,
16 }),16 }),
17 });17 });
1818
19 const exe = b.addTest(.{ .root_module = b.createModule(.{19 const exe = b.addTest(.{ .root_module = b.createModule(.{
20 .root_source_file = b.path("main.zig"),20 .root_source_file = b.path("main.zig"),
21 .target = b.graph.host,21 .target = b.graph.host,
22 .optimize = .Debug,22 .optimize = .debug,
23 }) });23 }) });
24 exe.root_module.addAnonymousImport("bootloader.elf", .{24 exe.root_module.addAnonymousImport("bootloader.elf", .{
25 .root_source_file = bootloader.getEmittedBin(),25 .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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const obj = b.addObject(.{9 const obj = b.addObject(.{
10 .name = "main",10 .name = "main",
test/standalone/emit_llvm_no_bin/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const obj = b.addObject(.{9 const obj = b.addObject(.{
10 .name = "main",10 .name = "main",
test/standalone/empty_env/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
99
10 if (builtin.os.tag == .windows and b.graph.environ_map.contains("ConEmuHWND")) {10 if (builtin.os.tag == .windows and b.graph.environ_map.contains("ConEmuHWND")) {
11 // ConEmu injects environment variables into processes before they are executed11 // 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 {...@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void {
6 .target = b.resolveTargetQuery(try .parse(.{6 .target = b.resolveTargetQuery(try .parse(.{
7 .arch_os_abi = "x86_64-linux",7 .arch_os_abi = "x86_64-linux",
8 })),8 })),
9 .optimize = .ReleaseFast, // non-Debug build for reproducible output9 .optimize = .fast, // non-Debug build for reproducible output
10 .root_source_file = b.path("main.zig"),10 .root_source_file = b.path("main.zig"),
11 });11 });
1212
...@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {...@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
29 .name = "check_differ",29 .name = "check_differ",
30 .root_module = b.createModule(.{30 .root_module = b.createModule(.{
31 .target = b.graph.host,31 .target = b.graph.host,
32 .optimize = .Debug,32 .optimize = .debug,
33 .root_source_file = b.path("check_differ.zig"),33 .root_source_file = b.path("check_differ.zig"),
34 }),34 }),
35 });35 });
test/standalone/env_vars/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
99
10 const main = b.addExecutable(.{10 const main = b.addExecutable(.{
11 .name = "main",11 .name = "main",
test/standalone/extern/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const obj = b.addObject(.{9 const obj = b.addObject(.{
10 .name = "exports",10 .name = "exports",
test/standalone/glibc_compat/build.zig+3-3
...@@ -122,19 +122,19 @@ pub fn build(b: *std.Build) void {...@@ -122,19 +122,19 @@ pub fn build(b: *std.Build) void {
122 const malloc_translation = b.addTranslateC(.{122 const malloc_translation = b.addTranslateC(.{
123 .root_source_file = b.path("include_malloc.h"),123 .root_source_file = b.path("include_malloc.h"),
124 .target = target,124 .target = target,
125 .optimize = .Debug,125 .optimize = .debug,
126 .link_libc = true,126 .link_libc = true,
127 });127 });
128 const stdlib_translation = b.addTranslateC(.{128 const stdlib_translation = b.addTranslateC(.{
129 .root_source_file = b.path("include_stdlib.h"),129 .root_source_file = b.path("include_stdlib.h"),
130 .target = target,130 .target = target,
131 .optimize = .Debug,131 .optimize = .debug,
132 .link_libc = true,132 .link_libc = true,
133 });133 });
134 const string_translation = b.addTranslateC(.{134 const string_translation = b.addTranslateC(.{
135 .root_source_file = b.path("include_string.h"),135 .root_source_file = b.path("include_string.h"),
136 .target = target,136 .target = target,
137 .optimize = .Debug,137 .optimize = .debug,
138 .link_libc = true,138 .link_libc = true,
139 });139 });
140 const exe = b.addExecutable(.{140 const exe = b.addExecutable(.{
test/standalone/global_linkage/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test the program");4 const test_step = b.step("test", "Test the program");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.graph.host;8 const target = b.graph.host;
99
10 const obj1 = b.addLibrary(.{10 const obj1 = b.addLibrary(.{
test/standalone/install_headers/build.zig+4-4
...@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {...@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
12 .root_module = b.createModule(.{12 .root_module = b.createModule(.{
13 .root_source_file = null,13 .root_source_file = null,
14 .target = b.resolveTargetQuery(.{}),14 .target = b.resolveTargetQuery(.{}),
15 .optimize = .Debug,15 .optimize = .debug,
16 }),16 }),
17 });17 });
18 libfoo.root_module.addCSourceFile(.{ .file = empty_c });18 libfoo.root_module.addCSourceFile(.{ .file = empty_c });
...@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {...@@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
22 .root_module = b.createModule(.{22 .root_module = b.createModule(.{
23 .root_source_file = null,23 .root_source_file = null,
24 .target = b.resolveTargetQuery(.{}),24 .target = b.resolveTargetQuery(.{}),
25 .optimize = .Debug,25 .optimize = .debug,
26 .link_libc = true,26 .link_libc = true,
27 }),27 }),
28 });28 });
...@@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void {...@@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void {
68 .root_module = b.createModule(.{68 .root_module = b.createModule(.{
69 .root_source_file = null,69 .root_source_file = null,
70 .target = b.resolveTargetQuery(.{}),70 .target = b.resolveTargetQuery(.{}),
71 .optimize = .Debug,71 .optimize = .debug,
72 }),72 }),
73 });73 });
74 libbar.root_module.addCSourceFile(.{ .file = empty_c });74 libbar.root_module.addCSourceFile(.{ .file = empty_c });
...@@ -93,7 +93,7 @@ pub fn build(b: *std.Build) void {...@@ -93,7 +93,7 @@ pub fn build(b: *std.Build) void {
93 .root_module = b.createModule(.{93 .root_module = b.createModule(.{
94 .root_source_file = b.path("check_exists.zig"),94 .root_source_file = b.path("check_exists.zig"),
95 .target = b.resolveTargetQuery(.{}),95 .target = b.resolveTargetQuery(.{}),
96 .optimize = .Debug,96 .optimize = .debug,
97 }),97 }),
98 });98 });
99 const run_check_exists = b.addRunArtifact(check_exists);99 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 {...@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
12 .abi = .gnueabihf,12 .abi = .gnueabihf,
13 });13 });
1414
15 const optimize: std.builtin.OptimizeMode = .Debug;15 const optimize: std.builtin.Optimize = .debug;
1616
17 const elf = b.addExecutable(.{17 const elf = b.addExecutable(.{
18 .name = "zig-nrf52-blink.elf",18 .name = "zig-nrf52-blink.elf",
test/standalone/ios/build.zig+1-1
...@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {...@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
16 .name = "main",16 .name = "main",
17 .root_module = b.createModule(.{17 .root_module = b.createModule(.{
18 .root_source_file = b.path("panic.zig"),18 .root_source_file = b.path("panic.zig"),
19 .optimize = .Debug,19 .optimize = .debug,
20 .target = target,20 .target = target,
21 .link_libc = true,21 .link_libc = true,
22 }),22 }),
test/standalone/issue_11595/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag == .windows) {11 if (builtin.os.tag == .windows) {
test/standalone/issue_12706/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 const exe = b.addExecutable(.{11 const exe = b.addExecutable(.{
test/standalone/issue_339/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.graph.host;8 const target = b.graph.host;
99
10 const obj = b.addObject(.{10 const obj = b.addObject(.{
test/standalone/issue_5825/build.zig+1-1
...@@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void {...@@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void {
13 .os_tag = .windows,13 .os_tag = .windows,
14 .abi = .msvc,14 .abi = .msvc,
15 });15 });
16 const optimize: std.builtin.OptimizeMode = .Debug;16 const optimize: std.builtin.Optimize = .debug;
17 const obj = b.addObject(.{17 const obj = b.addObject(.{
18 .name = "issue_5825",18 .name = "issue_5825",
19 .root_module = b.createModule(.{19 .root_module = b.createModule(.{
test/standalone/load_dynamic_library/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag == .wasi) return;11 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 {...@@ -9,13 +9,13 @@ pub fn build(b: *std.Build) void {
9 return;9 return;
10 }10 }
1111
12 add(b, test_step, .Debug);12 add(b, test_step, .debug);
13 add(b, test_step, .ReleaseFast);13 add(b, test_step, .fast);
14 add(b, test_step, .ReleaseSmall);14 add(b, test_step, .small);
15 add(b, test_step, .ReleaseSafe);15 add(b, test_step, .safe);
16}16}
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 {
19 const exe = b.addExecutable(.{19 const exe = b.addExecutable(.{
20 .name = "test",20 .name = "test",
21 .root_module = b.createModule(.{21 .root_module = b.createModule(.{
test/standalone/mix_o_files/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.graph.host;8 const target = b.graph.host;
99
10 const obj = b.addObject(.{10 const obj = b.addObject(.{
test/standalone/pkg_import/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const exe = b.addExecutable(.{9 const exe = b.addExecutable(.{
10 .name = "test",10 .name = "test",
test/standalone/posix/build.zig+1-1
...@@ -54,7 +54,7 @@ pub fn build(b: *std.Build) void {...@@ -54,7 +54,7 @@ pub fn build(b: *std.Build) void {
54 }54 }
55}55}
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 {
58 const exe_name = b.fmt("test-posix-{s}{s}{s}", .{58 const exe_name = b.fmt("test-posix-{s}{s}{s}", .{
59 std.fs.path.stem(case.src_path),59 std.fs.path.stem(case.src_path),
60 if (link_libc) "-libc" else "",60 if (link_libc) "-libc" else "",
test/standalone/run_cwd/build.zig+1-1
...@@ -3,7 +3,7 @@ pub fn build(b: *Build) void {...@@ -3,7 +3,7 @@ pub fn build(b: *Build) void {
3 .name = "check_file_exists",3 .name = "check_file_exists",
4 .root_module = b.createModule(.{4 .root_module = b.createModule(.{
5 .target = b.graph.host,5 .target = b.graph.host,
6 .optimize = .Debug,6 .optimize = .debug,
7 .root_source_file = b.path("check_file_exists.zig"),7 .root_source_file = b.path("check_file_exists.zig"),
8 }),8 }),
9 });9 });
test/standalone/self_exe_symlink/build.zig+1-1
...@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {...@@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
6 const test_step = b.step("test", "Test it");6 const test_step = b.step("test", "Test it");
7 b.default_step = test_step;7 b.default_step = test_step;
88
9 const optimize: std.builtin.OptimizeMode = .Debug;9 const optimize: std.builtin.Optimize = .debug;
10 const target = b.graph.host;10 const target = b.graph.host;
1111
12 if (target.result.os.tag == .netbsd) return; // F_GETPATH not reliable12 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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.standardTargetOptions(.{});8 const target = b.standardTargetOptions(.{});
99
10 const exe_names: []const []const u8 = &.{10 const exe_names: []const []const u8 = &.{
test/standalone/simple/build.zig+1-1
...@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {...@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
10 const skip_release_fast = b.option(bool, "skip_release_fast", "Skip release-fast builds") orelse false;10 const skip_release_fast = b.option(bool, "skip_release_fast", "Skip release-fast builds") orelse false;
11 const skip_release_small = b.option(bool, "skip_release_small", "Skip release-small builds") orelse false;11 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;
14 var optimize_modes_len: usize = 0;14 var optimize_modes_len: usize = 0;
15 if (!skip_debug) {15 if (!skip_debug) {
16 optimize_modes_buf[optimize_modes_len] = .debug;16 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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
8 const target = b.standardTargetOptions(.{});8 const target = b.standardTargetOptions(.{});
99
10 const exe_names: []const []const u8 = &.{10 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 {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test the program");4 const test_step = b.step("test", "Test the program");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize = std.builtin.OptimizeMode.Debug;7 const optimize = std.builtin.Optimize.debug;
8 const target = b.graph.host;8 const target = b.graph.host;
99
10 const main = b.addExecutable(.{10 const main = b.addExecutable(.{
test/standalone/strip_struct_init/build.zig+1-1
...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {...@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.Optimize = .debug;
88
9 const main = b.addTest(.{9 const main = b.addTest(.{
10 .root_module = b.createModule(.{10 .root_module = b.createModule(.{
test/standalone/tsan/build.zig+2-2
...@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {...@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
29 .root_module = b.createModule(.{29 .root_module = b.createModule(.{
30 .root_source_file = b.path("main.zig"),30 .root_source_file = b.path("main.zig"),
31 .target = target,31 .target = target,
32 .optimize = .Debug,32 .optimize = .debug,
33 .sanitize_thread = true,33 .sanitize_thread = true,
34 }),34 }),
35 });35 });
...@@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void {...@@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void {
46 .root_module = b.createModule(.{46 .root_module = b.createModule(.{
47 .root_source_file = b.path("main.zig"),47 .root_source_file = b.path("main.zig"),
48 .target = target,48 .target = target,
49 .optimize = .Debug,49 .optimize = .debug,
50 .sanitize_thread = true,50 .sanitize_thread = true,
51 }),51 }),
52 });52 });
test/standalone/windows_argv/build.zig+1-1
...@@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {...@@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
77
8 if (builtin.os.tag != .windows) return;8 if (builtin.os.tag != .windows) return;
99
10 const optimize: std.builtin.OptimizeMode = .Debug;10 const optimize: std.builtin.Optimize = .debug;
1111
12 const lib_gnu = b.addLibrary(.{12 const lib_gnu = b.addLibrary(.{
13 .linkage = .static,13 .linkage = .static,
test/standalone/windows_bat_args/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag != .windows) return;11 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 {...@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
16 .root_module = b.createModule(.{16 .root_module = b.createModule(.{
17 .root_source_file = null,17 .root_source_file = null,
18 .target = target,18 .target = target,
19 .optimize = .Debug,19 .optimize = .debug,
20 .link_libc = true,20 .link_libc = true,
21 }),21 }),
22 });22 });
...@@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void {...@@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void {
32 .root_module = b.createModule(.{32 .root_module = b.createModule(.{
33 .root_source_file = null,33 .root_source_file = null,
34 .target = target,34 .target = target,
35 .optimize = .Debug,35 .optimize = .debug,
36 .link_libc = true,36 .link_libc = true,
37 }),37 }),
38 });38 });
...@@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {...@@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {
49 .root_module = b.createModule(.{49 .root_module = b.createModule(.{
50 .root_source_file = null,50 .root_source_file = null,
51 .target = target,51 .target = target,
52 .optimize = .Debug,52 .optimize = .debug,
53 .link_libc = true,53 .link_libc = true,
54 }),54 }),
55 });55 });
...@@ -66,7 +66,7 @@ pub fn build(b: *std.Build) void {...@@ -66,7 +66,7 @@ pub fn build(b: *std.Build) void {
66 .root_module = b.createModule(.{66 .root_module = b.createModule(.{
67 .root_source_file = null,67 .root_source_file = null,
68 .target = target,68 .target = target,
69 .optimize = .Debug,69 .optimize = .debug,
70 .link_libc = true,70 .link_libc = true,
71 }),71 }),
72 });72 });
...@@ -84,7 +84,7 @@ pub fn build(b: *std.Build) void {...@@ -84,7 +84,7 @@ pub fn build(b: *std.Build) void {
84 .root_module = b.createModule(.{84 .root_module = b.createModule(.{
85 .root_source_file = b.path("main.zig"),85 .root_source_file = b.path("main.zig"),
86 .target = target,86 .target = target,
87 .optimize = .Debug,87 .optimize = .debug,
88 }),88 }),
89 });89 });
9090
...@@ -98,7 +98,7 @@ pub fn build(b: *std.Build) void {...@@ -98,7 +98,7 @@ pub fn build(b: *std.Build) void {
98 .root_module = b.createModule(.{98 .root_module = b.createModule(.{
99 .root_source_file = b.path("main.zig"),99 .root_source_file = b.path("main.zig"),
100 .target = target,100 .target = target,
101 .optimize = .Debug,101 .optimize = .debug,
102 .link_libc = true,102 .link_libc = true,
103 }),103 }),
104 });104 });
...@@ -113,7 +113,7 @@ pub fn build(b: *std.Build) void {...@@ -113,7 +113,7 @@ pub fn build(b: *std.Build) void {
113 .root_module = b.createModule(.{113 .root_module = b.createModule(.{
114 .root_source_file = b.path("wwinmain.zig"),114 .root_source_file = b.path("wwinmain.zig"),
115 .target = target,115 .target = target,
116 .optimize = .Debug,116 .optimize = .debug,
117 }),117 }),
118 });118 });
119 exe.mingw_unicode_entry_point = true;119 exe.mingw_unicode_entry_point = true;
...@@ -129,7 +129,7 @@ pub fn build(b: *std.Build) void {...@@ -129,7 +129,7 @@ pub fn build(b: *std.Build) void {
129 .root_module = b.createModule(.{129 .root_module = b.createModule(.{
130 .root_source_file = b.path("wwinmain.zig"),130 .root_source_file = b.path("wwinmain.zig"),
131 .target = target,131 .target = target,
132 .optimize = .Debug,132 .optimize = .debug,
133 .link_libc = true,133 .link_libc = true,
134 }),134 }),
135 });135 });
...@@ -143,7 +143,7 @@ pub fn build(b: *std.Build) void {...@@ -143,7 +143,7 @@ pub fn build(b: *std.Build) void {
143 const load_dll_exe = b.addExecutable(.{ .name = "load_dll", .root_module = b.createModule(.{143 const load_dll_exe = b.addExecutable(.{ .name = "load_dll", .root_module = b.createModule(.{
144 .root_source_file = b.path("loaddll.zig"),144 .root_source_file = b.path("loaddll.zig"),
145 .target = target,145 .target = target,
146 .optimize = .Debug,146 .optimize = .debug,
147 }) });147 }) });
148148
149 {149 {
...@@ -153,7 +153,7 @@ pub fn build(b: *std.Build) void {...@@ -153,7 +153,7 @@ pub fn build(b: *std.Build) void {
153 .root_module = b.createModule(.{153 .root_module = b.createModule(.{
154 .root_source_file = b.path("dllmain.zig"),154 .root_source_file = b.path("dllmain.zig"),
155 .target = target,155 .target = target,
156 .optimize = .Debug,156 .optimize = .debug,
157 }),157 }),
158 });158 });
159159
...@@ -174,7 +174,7 @@ pub fn build(b: *std.Build) void {...@@ -174,7 +174,7 @@ pub fn build(b: *std.Build) void {
174 .root_module = b.createModule(.{174 .root_module = b.createModule(.{
175 .root_source_file = b.path("dllmain.zig"),175 .root_source_file = b.path("dllmain.zig"),
176 .target = target,176 .target = target,
177 .optimize = .Debug,177 .optimize = .debug,
178 .link_libc = true,178 .link_libc = true,
179 }),179 }),
180 });180 });
...@@ -195,7 +195,7 @@ pub fn build(b: *std.Build) void {...@@ -195,7 +195,7 @@ pub fn build(b: *std.Build) void {
195 .linkage = .dynamic,195 .linkage = .dynamic,
196 .root_module = b.createModule(.{196 .root_module = b.createModule(.{
197 .target = target,197 .target = target,
198 .optimize = .Debug,198 .optimize = .debug,
199 .link_libc = true,199 .link_libc = true,
200 }),200 }),
201 });201 });
test/standalone/windows_paths/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag != .windows) return;11 if (builtin.os.tag != .windows) return;
test/standalone/windows_resources/build.zig+1-1
...@@ -31,7 +31,7 @@ fn add(...@@ -31,7 +31,7 @@ fn add(
31 .root_module = b.createModule(.{31 .root_module = b.createModule(.{
32 .root_source_file = b.path("main.zig"),32 .root_source_file = b.path("main.zig"),
33 .target = target,33 .target = target,
34 .optimize = .Debug,34 .optimize = .debug,
35 }),35 }),
36 });36 });
37 exe.root_module.addWin32ResourceFile(.{37 exe.root_module.addWin32ResourceFile(.{
test/standalone/windows_spawn/build.zig+1-1
...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;6 b.default_step = test_step;
77
8 const optimize: std.builtin.OptimizeMode = .Debug;8 const optimize: std.builtin.Optimize = .debug;
9 const target = b.graph.host;9 const target = b.graph.host;
1010
11 if (builtin.os.tag != .windows) return;11 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 {...@@ -4,13 +4,13 @@ pub fn build(b: *std.Build) void {
4 const test_step = b.step("test", "Test it");4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 add(b, test_step, .Debug);7 add(b, test_step, .debug);
8 add(b, test_step, .ReleaseFast);8 add(b, test_step, .fast);
9 add(b, test_step, .ReleaseSmall);9 add(b, test_step, .small);
10 add(b, test_step, .ReleaseSafe);10 add(b, test_step, .safe);
11}11}
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 {
14 const unit_tests = b.addTest(.{ .root_module = b.createModule(.{14 const unit_tests = b.addTest(.{ .root_module = b.createModule(.{
15 .root_source_file = b.path("src/main.zig"),15 .root_source_file = b.path("src/main.zig"),
16 .target = b.resolveTargetQuery(.{16 .target = b.resolveTargetQuery(.{
test/tests.zig+4-4
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const assert = std.debug.assert;3const assert = std.debug.assert;
4const mem = std.mem;4const mem = std.mem;
5const OptimizeMode = std.builtin.OptimizeMode;5const OptimizeMode = std.builtin.Optimize;
6const Step = std.Build.Step;6const Step = std.Build.Step;
77
8// Cases8// Cases
...@@ -21,7 +21,7 @@ pub const LinkContext = @import("src/Link.zig");...@@ -21,7 +21,7 @@ pub const LinkContext = @import("src/Link.zig");
21const ModuleTestTarget = struct {21const ModuleTestTarget = struct {
22 linkage: ?std.builtin.LinkMode = null,22 linkage: ?std.builtin.LinkMode = null,
23 target: std.Target.Query = .{},23 target: std.Target.Query = .{},
24 optimize_mode: std.builtin.OptimizeMode = .debug,24 optimize_mode: std.builtin.Optimize = .debug,
25 link_libc: ?bool = null,25 link_libc: ?bool = null,
26 single_threaded: ?bool = null,26 single_threaded: ?bool = null,
27 use_llvm: ?bool = null,27 use_llvm: ?bool = null,
...@@ -2162,7 +2162,7 @@ const c_abi_targets = blk: {...@@ -2162,7 +2162,7 @@ const c_abi_targets = blk: {
21622162
2163const LinkTarget = struct {2163const LinkTarget = struct {
2164 target: std.Target.Query = .{},2164 target: std.Target.Query = .{},
2165 optimize_mode: std.builtin.OptimizeMode = .debug,2165 optimize_mode: std.builtin.Optimize = .debug,
2166 link_libc: bool = false,2166 link_libc: bool = false,
2167 use_llvm: bool = false,2167 use_llvm: bool = false,
2168 use_lld: bool = false,2168 use_lld: bool = false,
...@@ -2573,7 +2573,7 @@ pub fn addCliTests(b: *std.Build) *Step {...@@ -2573,7 +2573,7 @@ pub fn addCliTests(b: *std.Build) *Step {
2573 // This is intended to be the exact CLI usage used by godbolt.org.2573 // This is intended to be the exact CLI usage used by godbolt.org.
2574 const run = b.addSystemCommand(&.{ b.graph.zig_exe, "build-obj", "--cache-dir" });2574 const run = b.addSystemCommand(&.{ b.graph.zig_exe, "build-obj", "--cache-dir" });
2575 run.addDirectoryArg(tmp_path);2575 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" });
2577 run.addFileArg(example_zig);2577 run.addFileArg(example_zig);
2578 const example_s = run.addPrefixedOutputFileArg("-femit-asm=", "example.s");2578 const example_s = run.addPrefixedOutputFileArg("-femit-asm=", "example.s");
25792579
tools/doctest.zig+17-17
...@@ -156,7 +156,7 @@ fn printOutput(...@@ -156,7 +156,7 @@ fn printOutput(
156 try shell_out.print("$ zig build-exe {s}.zig ", .{code_name});156 try shell_out.print("$ zig build-exe {s}.zig ", .{code_name});
157157
158 switch (code.mode) {158 switch (code.mode) {
159 .Debug => {},159 .debug => {},
160 else => {160 else => {
161 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });161 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
162 try shell_out.print("-O {s} ", .{@tagName(code.mode)});162 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
...@@ -291,7 +291,7 @@ fn printOutput(...@@ -291,7 +291,7 @@ fn printOutput(
291 try shell_out.print("$ zig test {s}.zig ", .{code_name});291 try shell_out.print("$ zig test {s}.zig ", .{code_name});
292292
293 switch (code.mode) {293 switch (code.mode) {
294 .Debug => {},294 .debug => {},
295 else => {295 else => {
296 try test_args.appendSlice(&[_][]const u8{296 try test_args.appendSlice(&[_][]const u8{
297 "-O", @tagName(code.mode),297 "-O", @tagName(code.mode),
...@@ -354,7 +354,7 @@ fn printOutput(...@@ -354,7 +354,7 @@ fn printOutput(
354 try shell_out.print("$ zig test {s}.zig ", .{code_name});354 try shell_out.print("$ zig test {s}.zig ", .{code_name});
355355
356 switch (code.mode) {356 switch (code.mode) {
357 .Debug => {},357 .debug => {},
358 else => {358 else => {
359 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });359 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
360 try shell_out.print("-O {s} ", .{@tagName(code.mode)});360 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
...@@ -404,18 +404,18 @@ fn printOutput(...@@ -404,18 +404,18 @@ fn printOutput(
404 }404 }
405 var mode_arg: []const u8 = "";405 var mode_arg: []const u8 = "";
406 switch (code.mode) {406 switch (code.mode) {
407 .Debug => {},407 .debug => {},
408 .ReleaseSafe => {408 .safe => {
409 try test_args.append("-OReleaseSafe");409 try test_args.append("-Osafe");
410 mode_arg = "-OReleaseSafe";410 mode_arg = "-Osafe";
411 },411 },
412 .ReleaseFast => {412 .fast => {
413 try test_args.append("-OReleaseFast");413 try test_args.append("-Ofast");
414 mode_arg = "-OReleaseFast";414 mode_arg = "-Ofast";
415 },415 },
416 .ReleaseSmall => {416 .small => {
417 try test_args.append("-OReleaseSmall");417 try test_args.append("-Osmall");
418 mode_arg = "-OReleaseSmall";418 mode_arg = "-Osmall";
419 },419 },
420 }420 }
421421
...@@ -468,7 +468,7 @@ fn printOutput(...@@ -468,7 +468,7 @@ fn printOutput(
468 try shell_out.print("$ zig build-obj {s}.zig ", .{code_name});468 try shell_out.print("$ zig build-obj {s}.zig ", .{code_name});
469469
470 switch (code.mode) {470 switch (code.mode) {
471 .Debug => {},471 .debug => {},
472 else => {472 else => {
473 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });473 try build_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
474 try shell_out.print("-O {s} ", .{@tagName(code.mode)});474 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
...@@ -548,7 +548,7 @@ fn printOutput(...@@ -548,7 +548,7 @@ fn printOutput(
548 try shell_out.print("$ zig build-lib {s}.zig ", .{code_name});548 try shell_out.print("$ zig build-lib {s}.zig ", .{code_name});
549549
550 switch (code.mode) {550 switch (code.mode) {
551 .Debug => {},551 .debug => {},
552 else => {552 else => {
553 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });553 try test_args.appendSlice(&[_][]const u8{ "-O", @tagName(code.mode) });
554 try shell_out.print("-O {s} ", .{@tagName(code.mode)});554 try shell_out.print("-O {s} ", .{@tagName(code.mode)});
...@@ -843,7 +843,7 @@ fn writeEscapedLines(out: *Writer, text: []const u8) !void {...@@ -843,7 +843,7 @@ fn writeEscapedLines(out: *Writer, text: []const u8) !void {
843843
844const Code = struct {844const Code = struct {
845 id: Id,845 id: Id,
846 mode: std.builtin.OptimizeMode,846 mode: std.builtin.Optimize,
847 link_objects: []const []const u8,847 link_objects: []const []const u8,
848 target_str: ?[]const u8,848 target_str: ?[]const u8,
849 link_libc: bool,849 link_libc: bool,
...@@ -903,7 +903,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {...@@ -903,7 +903,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
903 else903 else
904 fatal("unrecognized manifest id: '{s}'", .{first_line});904 fatal("unrecognized manifest id: '{s}'", .{first_line});
905905
906 var mode: std.builtin.OptimizeMode = .Debug;906 var mode: std.builtin.Optimize = .debug;
907 var link_mode: ?std.builtin.LinkMode = null;907 var link_mode: ?std.builtin.LinkMode = null;
908 var link_objects: std.ArrayList([]const u8) = .empty;908 var link_objects: std.ArrayList([]const u8) = .empty;
909 var additional_options: std.ArrayList([]const u8) = .empty;909 var additional_options: std.ArrayList([]const u8) = .empty;
tools/migrate_langref.zig+4-4
...@@ -243,7 +243,7 @@ const Code = struct {...@@ -243,7 +243,7 @@ const Code = struct {
243 name: []const u8,243 name: []const u8,
244 source_token: Token,244 source_token: Token,
245 just_check_syntax: bool,245 just_check_syntax: bool,
246 mode: std.builtin.OptimizeMode,246 mode: std.builtin.Optimize,
247 link_objects: []const []const u8,247 link_objects: []const []const u8,
248 target_str: ?[]const u8,248 target_str: ?[]const u8,
249 link_libc: bool,249 link_libc: bool,
...@@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp...@@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
320 }320 }
321321
322 var mode: std.builtin.OptimizeMode = .debug;322 var mode: std.builtin.Optimize = .debug;
323 var link_objects = std.array_list.Managed([]const u8).init(arena);323 var link_objects = std.array_list.Managed([]const u8).init(arena);
324 var target_str: ?[]const u8 = null;324 var target_str: ?[]const u8 = null;
325 var link_libc = false;325 var link_libc = false;
...@@ -333,9 +333,9 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp...@@ -333,9 +333,9 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
333 const end_code_tag = try eatToken(tokenizer, .tag_content);333 const end_code_tag = try eatToken(tokenizer, .tag_content);
334 const end_tag_name = tokenizer.buffer[end_code_tag.start..end_code_tag.end];334 const end_tag_name = tokenizer.buffer[end_code_tag.start..end_code_tag.end];
335 if (mem.eql(u8, end_tag_name, "code_release_fast")) {335 if (mem.eql(u8, end_tag_name, "code_release_fast")) {
336 mode = .ReleaseFast;336 mode = .fast;
337 } else if (mem.eql(u8, end_tag_name, "code_release_safe")) {337 } else if (mem.eql(u8, end_tag_name, "code_release_safe")) {
338 mode = .ReleaseSafe;338 mode = .safe;
339 } else if (mem.eql(u8, end_tag_name, "code_disable_cache")) {339 } else if (mem.eql(u8, end_tag_name, "code_disable_cache")) {
340 disable_cache = true;340 disable_cache = true;
341 } else if (mem.eql(u8, end_tag_name, "code_link_object")) {341 } else if (mem.eql(u8, end_tag_name, "code_link_object")) {