authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-26 17:44:57-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-28 02:47:36+02:00
log3de725074dcee2e224ab80fd254a4855cb6de21e
treea5105fdce086767fd7d8c91dc6269c2915965f76
parent2a07273224d0e81185c3ce22673e79d4438431af

CLI: replace uses of '{s}' in format strings with {q}

Example output: $ zig build-exe "-freference-trace=b\" 'ah" error: unable to parse reference_trace count "b\" 'ah": InvalidCharacter Before this change: error: unable to parse reference_trace count 'b" 'ah': InvalidCharacter Zig does not have single-quoted strings, plus it wasn't escaping the single quotes anyway. Better to use actual double quote string syntax than to fake a fake syntax.

2 files changed, 148 insertions(+), 163 deletions(-)

src/main.zig+146-162
......@@ -740,9 +740,9 @@ const Emit = union(enum) {
740740 .yes_default_path => if (output_to_cache != null) .yes_cache else .{ .yes_path = default_basename },
741741 .yes => |path| if (output_to_cache) |reason| {
742742 switch (reason) {
743 .listen => fatal("--listen incompatible with explicit output path '{s}'", .{path}),
743 .listen => fatal("--listen incompatible with explicit output path {q}", .{path}),
744744 .@"zig run", .@"zig test" => fatal(
745 "'{s}' with explicit output path '{s}' requires explicit '-femit-bin=path' or '-fno-emit-bin'",
745 "{q} with explicit output path {q} requires explicit '-femit-bin=path' or '-fno-emit-bin'",
746746 .{ @tagName(reason), path },
747747 ),
748748 }
......@@ -750,7 +750,7 @@ const Emit = union(enum) {
750750 // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would.
751751 if (fs.path.dirname(path)) |dir_path| {
752752 var dir = Io.Dir.cwd().openDir(io, dir_path, .{}) catch |err| {
753 fatal("unable to open output directory '{s}': {s}", .{ dir_path, @errorName(err) });
753 fatal("unable to open output directory {q}: {t}", .{ dir_path, err });
754754 };
755755 dir.close(io);
756756 }
......@@ -1064,7 +1064,7 @@ fn buildOutputType(
10641064 // This is a "compiler response file". We must parse the file and treat its
10651065 // contents as command line parameters.
10661066 args_iter.resp_file = initArgIteratorResponseFile(arena, io, resp_file_path) catch |err|
1067 fatal("unable to read response file '{s}': {t}", .{ resp_file_path, err });
1067 fatal("unable to read response file {q}: {t}", .{ resp_file_path, err });
10681068 } else if (mem.startsWith(u8, arg, "-")) {
10691069 if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
10701070 try Io.File.stdout().writeStreamingAll(io, usage_build_generic);
......@@ -1082,15 +1082,11 @@ fn buildOutputType(
10821082 const next_arg = args_iter.nextOrFatal();
10831083 const key, const value = mem.cutScalar(u8, next_arg, '=') orelse .{ next_arg, next_arg };
10841084 if (mem.eql(u8, key, "std") and !mem.eql(u8, value, "std")) {
1085 fatal("unable to import as '{s}': conflicts with builtin module", .{
1086 key,
1087 });
1085 fatal("unable to import as {q}: conflicts with builtin module", .{key});
10881086 }
10891087 for ([_][]const u8{ "root", "builtin" }) |name| {
10901088 if (mem.eql(u8, key, name)) {
1091 fatal("unable to import as '{s}': conflicts with builtin module", .{
1092 key,
1093 });
1089 fatal("unable to import as {q}: conflicts with builtin module", .{key});
10941090 }
10951091 }
10961092 try deps.append(arena, .{
......@@ -1116,7 +1112,7 @@ fn buildOutputType(
11161112 } else if (mem.eql(u8, arg, "--error-limit")) {
11171113 const next_arg = args_iter.nextOrFatal();
11181114 error_limit = std.fmt.parseUnsigned(Zcu.ErrorInt, next_arg, 0) catch |err| {
1119 fatal("unable to parse error limit '{s}': {s}", .{ next_arg, @errorName(err) });
1115 fatal("unable to parse error limit {q}: {t}", .{ next_arg, err });
11201116 };
11211117 } else if (mem.eql(u8, arg, "-cflags")) {
11221118 extra_cflags.shrinkRetainingCapacity(0);
......@@ -1149,16 +1145,14 @@ fn buildOutputType(
11491145 fatal("expected [auto|on|off] after --color", .{});
11501146 };
11511147 color = std.meta.stringToEnum(Color, next_arg) orelse {
1152 fatal("expected [auto|on|off] after --color, found '{s}'", .{next_arg});
1148 fatal("expected [auto|on|off] after --color, found {q}", .{next_arg});
11531149 };
11541150 } else if (mem.cutPrefix(u8, arg, "-j")) |str| {
11551151 const num = std.fmt.parseUnsigned(u32, str, 10) catch |err| {
1156 fatal("unable to parse jobs count '{s}': {s}", .{
1157 str, @errorName(err),
1158 });
1152 fatal("unable to parse jobs count {q}: {t}", .{ str, err });
11591153 };
11601154 if (num < 1) {
1161 fatal("number of jobs must be at least 1\n", .{});
1155 fatal("number of jobs must be at least 1", .{});
11621156 }
11631157 n_jobs = num;
11641158 } else if (mem.eql(u8, arg, "--subsystem")) {
......@@ -1178,7 +1172,7 @@ fn buildOutputType(
11781172 } else if (mem.eql(u8, arg, "--name")) {
11791173 provided_name = args_iter.nextOrFatal();
11801174 if (!mem.eql(u8, provided_name.?, fs.path.basename(provided_name.?)))
1181 fatal("invalid package name '{s}': cannot contain folder separators", .{provided_name.?});
1175 fatal("invalid package name {q}: cannot contain folder separators", .{provided_name.?});
11821176 } else if (mem.eql(u8, arg, "-rpath")) {
11831177 try create_module.rpath_list.append(arena, args_iter.nextOrFatal());
11841178 } else if (mem.eql(u8, arg, "--library-directory") or mem.eql(u8, arg, "-L")) {
......@@ -1195,14 +1189,14 @@ fn buildOutputType(
11951189 install_name = args_iter.nextOrFatal();
11961190 } else if (mem.cutPrefix(u8, arg, "--compress-debug-sections=")) |param| {
11971191 linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, param) orelse {
1198 fatal("expected --compress-debug-sections=[none|zlib|zstd], found '{s}'", .{param});
1192 fatal("expected --compress-debug-sections=[none|zlib|zstd], found: {s}", .{param});
11991193 };
12001194 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
12011195 linker_compress_debug_sections = .zlib;
12021196 } else if (mem.eql(u8, arg, "-pagezero_size")) {
12031197 const next_arg = args_iter.nextOrFatal();
12041198 pagezero_size = std.fmt.parseUnsigned(u64, eatIntPrefix(next_arg, 16), 16) catch |err| {
1205 fatal("unable to parse pagezero size'{s}': {s}", .{ next_arg, @errorName(err) });
1199 fatal("unable to parse pagezero size {q}: {t}", .{ next_arg, err });
12061200 };
12071201 } else if (mem.eql(u8, arg, "-search_paths_first")) {
12081202 lib_search_strategy = .paths_first;
......@@ -1225,7 +1219,7 @@ fn buildOutputType(
12251219 } else if (mem.eql(u8, arg, "-headerpad")) {
12261220 const next_arg = args_iter.nextOrFatal();
12271221 headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| {
1228 fatal("unable to parse headerpad size '{s}': {s}", .{ next_arg, @errorName(err) });
1222 fatal("unable to parse headerpad size {q}: {t}", .{ next_arg, err });
12291223 };
12301224 } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) {
12311225 headerpad_max_install_names = true;
......@@ -1310,7 +1304,7 @@ fn buildOutputType(
13101304 } else if (mem.eql(u8, arg, "--version")) {
13111305 const next_arg = args_iter.nextOrFatal();
13121306 version = std.SemanticVersion.parse(next_arg) catch |err| {
1313 fatal("unable to parse --version '{s}': {s}", .{ next_arg, @errorName(err) });
1307 fatal("unable to parse --version {q}: {t}", .{ next_arg, err });
13141308 };
13151309 have_version = true;
13161310 } else if (mem.eql(u8, arg, "-target")) {
......@@ -1361,9 +1355,9 @@ fn buildOutputType(
13611355 // example: --listen 127.0.0.1:9000
13621356 const host, const port_text = mem.cutScalar(u8, next_arg, ':') orelse .{ next_arg, "14735" };
13631357 const port = std.fmt.parseInt(u16, port_text, 10) catch |err|
1364 fatal("invalid port number: '{s}': {s}", .{ port_text, @errorName(err) });
1358 fatal("invalid port number: {q}: {t}", .{ port_text, err });
13651359 listen = .{ .ip4 = Io.net.Ip4Address.parse(host, port) catch |err|
1366 fatal("invalid host: '{s}': {s}", .{ host, @errorName(err) }) };
1360 fatal("invalid host: {q}: {t}", .{ host, err }) };
13671361 }
13681362 } else if (mem.eql(u8, arg, "--listen=-")) {
13691363 dev.check(.stdio_listen);
......@@ -1429,7 +1423,7 @@ fn buildOutputType(
14291423 } else if (mem.eql(u8, mode, "thin")) {
14301424 create_module.opts.lto = .thin;
14311425 } else {
1432 fatal("Invalid -flto mode: '{s}'. Must be 'full'or 'thin'.", .{mode});
1426 fatal("invalid -flto mode: {q}; must be \"full\" or \"thin\"", .{mode});
14331427 }
14341428 } else if (mem.eql(u8, arg, "-fno-lto")) {
14351429 create_module.opts.lto = .none;
......@@ -1463,7 +1457,7 @@ fn buildOutputType(
14631457 } else if (mem.eql(u8, mode, "full")) {
14641458 mod_opts.sanitize_c = .full;
14651459 } else {
1466 fatal("Invalid -fsanitize-c mode: '{s}'. Must be 'trap' or 'full'.", .{mode});
1460 fatal("invalid -fsanitize-c mode: {q}; must be \"trap\" or \"full\"", .{mode});
14671461 }
14681462 } else if (mem.eql(u8, arg, "-fno-sanitize-c")) {
14691463 mod_opts.sanitize_c = .off;
......@@ -1507,7 +1501,7 @@ fn buildOutputType(
15071501 reference_trace = 256;
15081502 } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| {
15091503 reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| {
1510 fatal("unable to parse reference_trace count '{s}': {s}", .{ num, @errorName(err) });
1504 fatal("unable to parse reference_trace count {q}: {t}", .{ num, err });
15111505 };
15121506 } else if (mem.eql(u8, arg, "-fno-reference-trace")) {
15131507 reference_trace = null;
......@@ -1616,7 +1610,7 @@ fn buildOutputType(
16161610 mod_opts.no_builtin = true;
16171611 } else if (mem.cutPrefix(u8, arg, "-fopt-bisect-limit=")) |next_arg| {
16181612 llvm_opt_bisect_limit = std.fmt.parseInt(c_int, next_arg, 0) catch |err|
1619 fatal("unable to parse '{s}': {s}", .{ arg, @errorName(err) });
1613 fatal("unable to parse {q}: {t}", .{ arg, err });
16201614 } else if (mem.eql(u8, arg, "--eh-frame-hdr")) {
16211615 link_eh_frame_hdr = true;
16221616 } else if (mem.eql(u8, arg, "--no-eh-frame-hdr")) {
......@@ -1701,9 +1695,7 @@ fn buildOutputType(
17011695 build_id = .fast;
17021696 } else if (mem.cutPrefix(u8, arg, "--build-id=")) |style| {
17031697 build_id = std.zig.BuildId.parse(style) catch |err| {
1704 fatal("unable to parse --build-id style '{s}': {s}", .{
1705 style, @errorName(err),
1706 });
1698 fatal("unable to parse --build-id style {q}: {t}", .{ style, err });
17071699 };
17081700 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {
17091701 if (build_options.enable_debug_extensions) {
......@@ -1782,14 +1774,14 @@ fn buildOutputType(
17821774 } else if (Compilation.LangToExt.get(lang)) |got_ext| {
17831775 file_ext = got_ext;
17841776 } else {
1785 fatal("language not recognized: '{s}'", .{lang});
1777 fatal("language not recognized: {s}", .{lang});
17861778 }
17871779 } else if (mem.cutPrefix(u8, arg, "-mexec-model=")) |rest| {
17881780 create_module.opts.wasi_exec_model = parseWasiExecModel(rest);
17891781 } else if (mem.eql(u8, arg, "-municode")) {
17901782 mingw_unicode_entry_point = true;
17911783 } else {
1792 fatal("unrecognized parameter: '{s}'", .{arg});
1784 fatal("unrecognized parameter: {s}", .{arg});
17931785 }
17941786 } else switch (file_ext orelse Compilation.classifyFileExt(arg)) {
17951787 .shared_library, .object, .static_library => {
......@@ -1818,7 +1810,7 @@ fn buildOutputType(
18181810 },
18191811 .manifest => {
18201812 if (manifest_file) |other| {
1821 fatal("only one manifest file can be specified, found '{s}' after '{s}'", .{ arg, other });
1813 fatal("only one manifest file can be specified, found {q} after {q}", .{ arg, other });
18221814 } else manifest_file = arg;
18231815 },
18241816 .def => {
......@@ -1846,14 +1838,14 @@ fn buildOutputType(
18461838 },
18471839 .zig => {
18481840 if (root_src_file) |other| {
1849 fatal("found another zig file '{s}' after root source file '{s}'", .{ arg, other });
1841 fatal("found another zig file {q} after root source file {q}", .{ arg, other });
18501842 } else root_src_file = arg;
18511843 },
18521844 .unknown => {
18531845 if (std.ascii.eqlIgnoreCase(".xml", fs.path.extension(arg))) {
18541846 warn("embedded manifest files must have the extension '.manifest'", .{});
18551847 }
1856 fatal("unrecognized file extension of parameter '{s}'", .{arg});
1848 fatal("unrecognized file extension of parameter {q}", .{arg});
18571849 },
18581850 }
18591851 }
......@@ -1919,7 +1911,7 @@ fn buildOutputType(
19191911 } else if (Compilation.LangToExt.get(lang)) |got_ext| {
19201912 file_ext = got_ext;
19211913 } else {
1922 fatal("language not recognized: '{s}'", .{lang});
1914 fatal("language not recognized: {q}", .{lang});
19231915 }
19241916 },
19251917 .other => {
......@@ -1964,7 +1956,7 @@ fn buildOutputType(
19641956 },
19651957 .manifest => {
19661958 if (manifest_file) |other| {
1967 fatal("only one manifest file can be specified, found '{s}' after previously specified manifest '{s}'", .{ it.only_arg, other });
1959 fatal("only one manifest file can be specified, found {q} after previously specified manifest {q}", .{ it.only_arg, other });
19681960 } else manifest_file = it.only_arg;
19691961 },
19701962 .def => {
......@@ -1979,7 +1971,7 @@ fn buildOutputType(
19791971 },
19801972 .zig => {
19811973 if (root_src_file) |other| {
1982 fatal("found another zig file '{s}' after root source file '{s}'", .{ it.only_arg, other });
1974 fatal("found another zig file {q} after root source file {q}", .{ it.only_arg, other });
19831975 } else root_src_file = it.only_arg;
19841976 },
19851977 },
......@@ -2042,7 +2034,7 @@ fn buildOutputType(
20422034 } else if (mem.eql(u8, it.only_arg, "thin")) {
20432035 create_module.opts.lto = .thin;
20442036 } else {
2045 fatal("Invalid -flto mode: '{s}'. Must be 'auto', 'full', 'thin', or 'jobserver'.", .{it.only_arg});
2037 fatal("invalid -flto mode {q}; must be \"auto\", \"full\", \"thin\", or \"jobserver\"", .{it.only_arg});
20462038 }
20472039 },
20482040 .no_lto => create_module.opts.lto = .none,
......@@ -2137,9 +2129,7 @@ fn buildOutputType(
21372129 // variants of them.
21382130 if (mem.eql(u8, key, "--build-id")) {
21392131 build_id = std.zig.BuildId.parse(value) catch |err| {
2140 fatal("unable to parse --build-id style '{s}': {s}", .{
2141 value, @errorName(err),
2142 });
2132 fatal("unable to parse --build-id style {q}: {t}", .{ value, err });
21432133 };
21442134 continue;
21452135 } else if (mem.eql(u8, key, "--sort-common")) {
......@@ -2347,9 +2337,7 @@ fn buildOutputType(
23472337 // variants of them.
23482338 if (mem.eql(u8, key, "--build-id")) {
23492339 build_id = std.zig.BuildId.parse(value) catch |err| {
2350 fatal("unable to parse --build-id style '{s}': {s}", .{
2351 value, @errorName(err),
2352 });
2340 fatal("unable to parse --build-id style {q}: {t}", .{ value, err });
23532341 };
23542342 continue;
23552343 } else if (mem.eql(u8, key, "--sort-common")) {
......@@ -2453,7 +2441,7 @@ fn buildOutputType(
24532441 linker_compress_debug_sections = .zlib;
24542442 } else {
24552443 linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, it.only_arg) orelse {
2456 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{it.only_arg});
2444 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found {q}", .{it.only_arg});
24572445 };
24582446 }
24592447 },
......@@ -2466,7 +2454,7 @@ fn buildOutputType(
24662454 } else if (mem.eql(u8, "error", it.only_arg)) {
24672455 linker_allow_shlib_undefined = false;
24682456 } else {
2469 fatal("unsupported -undefined option '{s}'", .{it.only_arg});
2457 fatal("unsupported -undefined option {q}", .{it.only_arg});
24702458 }
24712459 },
24722460 .rtlib => {
......@@ -2479,7 +2467,7 @@ fn buildOutputType(
24792467 want_compiler_rt = true;
24802468 } else {
24812469 // Note that we don't support `platform`.
2482 fatal("unsupported -rtlib option '{s}'", .{it.only_arg});
2470 fatal("unsupported -rtlib option {q}", .{it.only_arg});
24832471 }
24842472 },
24852473 .static => {
......@@ -2575,12 +2563,12 @@ fn buildOutputType(
25752563 } else if (mem.eql(u8, arg, "-pagezero_size")) {
25762564 const next_arg = linker_args_it.nextOrFatal();
25772565 pagezero_size = std.fmt.parseUnsigned(u64, eatIntPrefix(next_arg, 16), 16) catch |err| {
2578 fatal("unable to parse pagezero size '{s}': {s}", .{ next_arg, @errorName(err) });
2566 fatal("unable to parse pagezero size {q}: {t}", .{ next_arg, err });
25792567 };
25802568 } else if (mem.eql(u8, arg, "-headerpad")) {
25812569 const next_arg = linker_args_it.nextOrFatal();
25822570 headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| {
2583 fatal("unable to parse headerpad size '{s}': {s}", .{ next_arg, @errorName(err) });
2571 fatal("unable to parse headerpad size {q}: {t}", .{ next_arg, err });
25842572 };
25852573 } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) {
25862574 headerpad_max_install_names = true;
......@@ -2605,7 +2593,7 @@ fn buildOutputType(
26052593 } else if (mem.eql(u8, arg, "--sort-section")) {
26062594 const arg1 = linker_args_it.nextOrFatal();
26072595 linker_sort_section = std.meta.stringToEnum(link.File.Lld.Elf.SortSection, arg1) orelse {
2608 fatal("expected [name|alignment] after --sort-section, found '{s}'", .{arg1});
2596 fatal("expected [name|alignment] after --sort-section, found {q}", .{arg1});
26092597 };
26102598 } else if (mem.eql(u8, arg, "--allow-shlib-undefined") or
26112599 mem.eql(u8, arg, "-allow-shlib-undefined"))
......@@ -2632,26 +2620,26 @@ fn buildOutputType(
26322620 } else if (mem.eql(u8, arg, "--initial-memory")) {
26332621 const next_arg = linker_args_it.nextOrFatal();
26342622 linker_initial_memory = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| {
2635 fatal("unable to parse initial memory size '{s}': {s}", .{ next_arg, @errorName(err) });
2623 fatal("unable to parse initial memory size {q}: {t}", .{ next_arg, err });
26362624 };
26372625 } else if (mem.eql(u8, arg, "--max-memory")) {
26382626 const next_arg = linker_args_it.nextOrFatal();
26392627 linker_max_memory = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| {
2640 fatal("unable to parse max memory size '{s}': {s}", .{ next_arg, @errorName(err) });
2628 fatal("unable to parse max memory size {q}: {t}", .{ next_arg, err });
26412629 };
26422630 } else if (mem.eql(u8, arg, "--shared-memory")) {
26432631 create_module.opts.shared_memory = true;
26442632 } else if (mem.eql(u8, arg, "--global-base")) {
26452633 const next_arg = linker_args_it.nextOrFatal();
26462634 linker_global_base = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| {
2647 fatal("unable to parse global base '{s}': {s}", .{ next_arg, @errorName(err) });
2635 fatal("unable to parse global base {q}: {t}", .{ next_arg, err });
26482636 };
26492637 } else if (mem.eql(u8, arg, "--export")) {
26502638 try linker_export_symbol_names.append(arena, linker_args_it.nextOrFatal());
26512639 } else if (mem.eql(u8, arg, "-exported_symbols_list")) {
26522640 const exported_symbols_list = linker_args_it.nextOrFatal();
26532641 const content = Io.Dir.cwd().readFileAlloc(io, exported_symbols_list, arena, .limited(10 * 1024 * 1024)) catch |err| {
2654 fatal("unable to read exported symbols list '{s}': {s}", .{ exported_symbols_list, @errorName(err) });
2642 fatal("unable to read exported symbols list {q}: {t}", .{ exported_symbols_list, err });
26552643 };
26562644 var symbols_it = mem.splitScalar(u8, content, '\n');
26572645 while (symbols_it.next()) |line| {
......@@ -2661,7 +2649,7 @@ fn buildOutputType(
26612649 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
26622650 const arg1 = linker_args_it.nextOrFatal();
26632651 linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, arg1) orelse {
2664 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{arg1});
2652 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found {q}", .{arg1});
26652653 };
26662654 } else if (mem.cutPrefix(u8, arg, "-z")) |z_rest| {
26672655 const z_arg = if (z_rest.len == 0) linker_args_it.nextOrFatal() else z_rest;
......@@ -2699,13 +2687,13 @@ fn buildOutputType(
26992687 } else if (mem.eql(u8, arg, "--major-image-version")) {
27002688 const major = linker_args_it.nextOrFatal();
27012689 version.major = std.fmt.parseUnsigned(u32, major, 10) catch |err| {
2702 fatal("unable to parse major image version '{s}': {s}", .{ major, @errorName(err) });
2690 fatal("unable to parse major image version {q}: {t}", .{ major, err });
27032691 };
27042692 have_version = true;
27052693 } else if (mem.eql(u8, arg, "--minor-image-version")) {
27062694 const minor = linker_args_it.nextOrFatal();
27072695 version.minor = std.fmt.parseUnsigned(u32, minor, 10) catch |err| {
2708 fatal("unable to parse minor image version '{s}': {s}", .{ minor, @errorName(err) });
2696 fatal("unable to parse minor image version {q}: {t}", .{ minor, err });
27092697 };
27102698 have_version = true;
27112699 } else if (mem.eql(u8, arg, "-e") or mem.eql(u8, arg, "--entry")) {
......@@ -2781,16 +2769,12 @@ fn buildOutputType(
27812769 } else if (mem.eql(u8, arg, "--major-subsystem-version")) {
27822770 const major = linker_args_it.nextOrFatal();
27832771 major_subsystem_version = std.fmt.parseUnsigned(u16, major, 10) catch |err| {
2784 fatal("unable to parse major subsystem version '{s}': {s}", .{
2785 major, @errorName(err),
2786 });
2772 fatal("unable to parse major subsystem version {q}: {t}", .{ major, err });
27872773 };
27882774 } else if (mem.eql(u8, arg, "--minor-subsystem-version")) {
27892775 const minor = linker_args_it.nextOrFatal();
27902776 minor_subsystem_version = std.fmt.parseUnsigned(u16, minor, 10) catch |err| {
2791 fatal("unable to parse minor subsystem version '{s}': {s}", .{
2792 minor, @errorName(err),
2793 });
2777 fatal("unable to parse minor subsystem version {q}: {t}", .{ minor, err });
27942778 };
27952779 } else if (mem.eql(u8, arg, "-framework")) {
27962780 try create_module.frameworks.put(arena, linker_args_it.nextOrFatal(), .{});
......@@ -2834,12 +2818,12 @@ fn buildOutputType(
28342818 } else if (mem.eql(u8, arg, "-compatibility_version")) {
28352819 const compat_version = linker_args_it.nextOrFatal();
28362820 compatibility_version = std.SemanticVersion.parse(compat_version) catch |err| {
2837 fatal("unable to parse -compatibility_version '{s}': {s}", .{ compat_version, @errorName(err) });
2821 fatal("unable to parse -compatibility_version {q}: {t}", .{ compat_version, err });
28382822 };
28392823 } else if (mem.eql(u8, arg, "-current_version")) {
28402824 const curr_version = linker_args_it.nextOrFatal();
28412825 version = std.SemanticVersion.parse(curr_version) catch |err| {
2842 fatal("unable to parse -current_version '{s}': {s}", .{ curr_version, @errorName(err) });
2826 fatal("unable to parse -current_version {q}: {t}", .{ curr_version, err });
28432827 };
28442828 have_version = true;
28452829 } else if (mem.eql(u8, arg, "--out-implib") or
......@@ -2858,7 +2842,7 @@ fn buildOutputType(
28582842 } else if (mem.eql(u8, "error", lookup_type)) {
28592843 linker_allow_shlib_undefined = false;
28602844 } else {
2861 fatal("unsupported -undefined option '{s}'", .{lookup_type});
2845 fatal("unsupported -undefined option {q}", .{lookup_type});
28622846 }
28632847 } else if (mem.eql(u8, arg, "-install_name")) {
28642848 install_name = linker_args_it.nextOrFatal();
......@@ -2876,9 +2860,7 @@ fn buildOutputType(
28762860 {
28772861 const next_arg = linker_args_it.nextOrFatal();
28782862 hash_style = std.meta.stringToEnum(link.File.Lld.Elf.HashStyle, next_arg) orelse {
2879 fatal("expected [sysv|gnu|both] after --hash-style, found '{s}'", .{
2880 next_arg,
2881 });
2863 fatal("expected [sysv|gnu|both] after --hash-style, found {q}", .{next_arg});
28822864 };
28832865 } else if (mem.eql(u8, arg, "-wrap")) {
28842866 const next_arg = linker_args_it.nextOrFatal();
......@@ -2897,7 +2879,7 @@ fn buildOutputType(
28972879 var split_it = mem.splitBackwardsScalar(u8, arg, ':');
28982880 const version_arg = split_it.first();
28992881 version = std.SemanticVersion.parse(version_arg) catch |err| {
2900 fatal("unable to parse /version '{s}': {s}", .{ arg, @errorName(err) });
2882 fatal("unable to parse /version {q}: {t}", .{ arg, err });
29012883 };
29022884 have_version = true;
29032885 } else if (mem.eql(u8, arg, "-V")) {
......@@ -3054,7 +3036,7 @@ fn buildOutputType(
30543036 const src_path = b: {
30553037 if (root_src_file) |src_path| {
30563038 if (create_module.modules.count() != 0) {
3057 fatal("main module provided both by '-M{s}={s}{c}{s}' and by positional argument '{s}'", .{
3039 fatal("main module provided both by '-M{s}={s}{c}{s}' and by positional argument {q}", .{
30583040 create_module.modules.keys()[0],
30593041 create_module.modules.values()[0].root_path,
30603042 fs.path.sep,
......@@ -3147,13 +3129,13 @@ fn buildOutputType(
31473129 }
31483130
31493131 if (c_source_files_owner_index != create_module.c_source_files.items.len) {
3150 fatal("C source file '{s}' has no parent module", .{
3132 fatal("C source file {q} has no parent module", .{
31513133 create_module.c_source_files.items[c_source_files_owner_index].src_path,
31523134 });
31533135 }
31543136
31553137 if (rc_source_files_owner_index != create_module.rc_source_files.items.len) {
3156 fatal("resource file '{s}' has no parent module", .{
3138 fatal("resource file {q} has no parent module", .{
31573139 create_module.rc_source_files.items[rc_source_files_owner_index].src_path,
31583140 });
31593141 }
......@@ -3185,7 +3167,7 @@ fn buildOutputType(
31853167 );
31863168 defer dirs.deinit(io);
31873169
3188 if (linker_optimization) |o| warn("ignoring deprecated linker optimization setting '{s}'", .{o});
3170 if (linker_optimization) |o| warn("ignoring deprecated linker optimization setting {q}", .{o});
31893171
31903172 create_module.dirs = dirs;
31913173 create_module.opts.emit_llvm_ir = emit_llvm_ir != .no;
......@@ -3196,7 +3178,7 @@ fn buildOutputType(
31963178 const main_mod = try createModule(gpa, arena, io, &create_module, 0, null, color, environ_map);
31973179 for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| {
31983180 if (cli_mod.resolved == null)
3199 fatal("module '{s}' declared but not used", .{key});
3181 fatal("module {q} declared but not used", .{key});
32003182 }
32013183
32023184 // When you're testing std, the main module is std, and we need to avoid duplicating the module.
......@@ -3319,7 +3301,7 @@ fn buildOutputType(
33193301 if (failed_frameworks.items.len > 0) {
33203302 for (failed_frameworks.items) |f| {
33213303 const searched_paths = if (f.checked_paths.len == 0) " none" else f.checked_paths;
3322 std.log.err("unable to find framework '{s}'. searched paths: {s}", .{
3304 std.log.err("unable to find framework {q}. searched paths: {s}", .{
33233305 f.name, searched_paths,
33243306 });
33253307 }
......@@ -3390,12 +3372,12 @@ fn buildOutputType(
33903372 },
33913373 .yes => |path| if (output_to_cache != null) {
33923374 assert(output_to_cache == .listen); // there was an explicit bin path
3393 fatal("--listen incompatible with explicit output path '{s}'", .{path});
3375 fatal("--listen incompatible with explicit output path {q}", .{path});
33943376 } else emit: {
33953377 // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would.
33963378 if (fs.path.dirname(path)) |dir_path| {
33973379 var dir = Io.Dir.cwd().openDir(io, dir_path, .{}) catch |err| {
3398 fatal("unable to open output directory '{s}': {s}", .{ dir_path, @errorName(err) });
3380 fatal("unable to open output directory {q}: {t}", .{ dir_path, err });
33993381 };
34003382 dir.close(io);
34013383 }
......@@ -3672,7 +3654,7 @@ fn buildOutputType(
36723654 .cross_libc_unavailable => {
36733655 // We can emit a more informative error for this.
36743656 const triple_name = try target.zigTriple(arena);
3675 std.log.err("unable to provide libc for target '{s}'", .{triple_name});
3657 std.log.err("unable to provide libc for target {q}", .{triple_name});
36763658
36773659 for (std.zig.target.available_libcs) |t| {
36783660 if (t.arch == target.cpu.arch and t.os == target.os.tag) {
......@@ -3929,16 +3911,16 @@ fn createModule(
39293911 for (create_module.llvm_m_args.items) |llvm_m_arg| {
39303912 if (mem.cutPrefix(u8, llvm_m_arg, "mno-")) |llvm_name| {
39313913 const zig_name = llvm_to_zig_name.get(llvm_name) orelse {
3932 fatal("target architecture {s} has no LLVM CPU feature named '{s}'", .{
3933 @tagName(cpu_arch), llvm_name,
3914 fatal("target architecture {t} has no LLVM CPU feature named {q}", .{
3915 cpu_arch, llvm_name,
39343916 });
39353917 };
39363918 try mcpu_buffer.append('-');
39373919 try mcpu_buffer.appendSlice(zig_name);
39383920 } else if (mem.cutPrefix(u8, llvm_m_arg, "m")) |llvm_name| {
39393921 const zig_name = llvm_to_zig_name.get(llvm_name) orelse {
3940 fatal("target architecture {s} has no LLVM CPU feature named '{s}'", .{
3941 @tagName(cpu_arch), llvm_name,
3922 fatal("target architecture {t} has no LLVM CPU feature named {q}", .{
3923 cpu_arch, llvm_name,
39423924 });
39433925 };
39443926 try mcpu_buffer.append('+');
......@@ -4173,16 +4155,16 @@ fn createModule(
41734155 .global = create_module.resolved_options,
41744156 .parent = parent,
41754157 }) catch |err| switch (err) {
4176 error.ValgrindUnsupportedOnTarget => fatal("unable to create module '{s}': valgrind does not support the selected target CPU architecture", .{name}),
4177 error.TargetRequiresSingleThreaded => fatal("unable to create module '{s}': the selected target does not support multithreading", .{name}),
4178 error.BackendRequiresSingleThreaded => fatal("unable to create module '{s}': the selected machine code backend is limited to single-threaded applications", .{name}),
4179 error.TargetRequiresPic => fatal("unable to create module '{s}': the selected target requires position independent code", .{name}),
4180 error.PieRequiresPic => fatal("unable to create module '{s}': making a Position Independent Executable requires enabling Position Independent Code", .{name}),
4181 error.DynamicLinkingRequiresPic => fatal("unable to create module '{s}': dynamic linking requires enabling Position Independent Code", .{name}),
4182 error.TargetHasNoRedZone => fatal("unable to create module '{s}': the selected target does not have a red zone", .{name}),
4183 error.StackCheckUnsupportedByTarget => fatal("unable to create module '{s}': the selected target does not support stack checking", .{name}),
4184 error.StackProtectorUnsupportedByTarget => fatal("unable to create module '{s}': the selected target does not support stack protection", .{name}),
4185 error.StackProtectorUnavailableWithoutLibC => fatal("unable to create module '{s}': enabling stack protection requires libc", .{name}),
4158 error.ValgrindUnsupportedOnTarget => fatal("unable to create module {q}: valgrind does not support the selected target CPU architecture", .{name}),
4159 error.TargetRequiresSingleThreaded => fatal("unable to create module {q}: the selected target does not support multithreading", .{name}),
4160 error.BackendRequiresSingleThreaded => fatal("unable to create module {q}: the selected machine code backend is limited to single-threaded applications", .{name}),
4161 error.TargetRequiresPic => fatal("unable to create module {q}: the selected target requires position independent code", .{name}),
4162 error.PieRequiresPic => fatal("unable to create module {q}: making a Position Independent Executable requires enabling Position Independent Code", .{name}),
4163 error.DynamicLinkingRequiresPic => fatal("unable to create module {q}: dynamic linking requires enabling Position Independent Code", .{name}),
4164 error.TargetHasNoRedZone => fatal("unable to create module {q}: the selected target does not have a red zone", .{name}),
4165 error.StackCheckUnsupportedByTarget => fatal("unable to create module {q}: the selected target does not support stack checking", .{name}),
4166 error.StackProtectorUnsupportedByTarget => fatal("unable to create module {q}: the selected target does not support stack protection", .{name}),
4167 error.StackProtectorUnavailableWithoutLibC => fatal("unable to create module {q}: enabling stack protection requires libc", .{name}),
41864168 error.OutOfMemory => |e| return e,
41874169 };
41884170 cli_mod.resolved = mod;
......@@ -4193,7 +4175,7 @@ fn createModule(
41934175
41944176 for (cli_mod.deps) |dep| {
41954177 const dep_index = create_module.modules.getIndex(dep.value) orelse
4196 fatal("module '{s}' depends on non-existent module '{s}'", .{ name, dep.key });
4178 fatal("module {q} depends on non-existent module {q}", .{ name, dep.key });
41974179 const dep_mod = try createModule(gpa, arena, io, create_module, dep_index, mod, color, environ_map);
41984180 try mod.deps.put(arena, dep.key, dep_mod);
41994181 }
......@@ -4707,7 +4689,7 @@ fn cmdTranslateC(
47074689
47084690 man.hash.add(@as(u16, 0xb945)); // Random number to distinguish translate-c from compiling C objects
47094691 Compilation.cache_helpers.hashCSource(&man, c_source_file) catch |err|
4710 fatal("unable to process '{s}': {t}", .{ c_source_file.src_path, err });
4692 fatal("unable to process {q}: {t}", .{ c_source_file.src_path, err });
47114693
47124694 const result: Compilation.TranslateCResult = if (try man.hit()) .{
47134695 .digest = man.finalBin(),
......@@ -4809,10 +4791,10 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !
48094791 try Io.File.stdout().writeStreamingAll(io, usage_init);
48104792 return cleanExit(io);
48114793 } else {
4812 fatal("unrecognized parameter: '{s}'", .{arg});
4794 fatal("unrecognized parameter: {q}", .{arg});
48134795 }
48144796 } else {
4815 fatal("unexpected extra parameter: '{s}'", .{arg});
4797 fatal("unexpected extra parameter: {q}", .{arg});
48164798 }
48174799 }
48184800 }
......@@ -4870,8 +4852,8 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !
48704852 build_options.version,
48714853 fingerprint.int(),
48724854 }) catch |err| switch (err) {
4873 else => fatal("failed to create '{s}': {s}", .{ Package.Manifest.basename, @errorName(err) }),
4874 error.PathAlreadyExists => fatal("refusing to overwrite '{s}'", .{Package.Manifest.basename}),
4855 else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }),
4856 error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}),
48754857 };
48764858 writeSimpleTemplateFile(io, Package.build_zig_basename,
48774859 \\const std = @import("std");
......@@ -4881,15 +4863,17 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !
48814863 \\}}
48824864 \\
48834865 , .{}) catch |err| switch (err) {
4884 else => fatal("failed to create '{s}': {s}", .{ Package.build_zig_basename, @errorName(err) }),
4866 else => fatal("failed to create {q}: {t}", .{ Package.build_zig_basename, err }),
48854867 // `build.zig` already existing is okay: the user has just used `zig init` to set up
48864868 // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal.
48874869 error.PathAlreadyExists => {
4888 std.log.info("successfully populated '{s}', preserving existing '{s}'", .{ Package.Manifest.basename, Package.build_zig_basename });
4870 std.log.info("successfully populated {q}, preserving existing {q}", .{
4871 Package.Manifest.basename, Package.build_zig_basename,
4872 });
48894873 return cleanExit(io);
48904874 },
48914875 };
4892 std.log.info("successfully populated '{s}' and '{s}'", .{ Package.Manifest.basename, Package.build_zig_basename });
4876 std.log.info("successfully populated {q} and {q}", .{ Package.Manifest.basename, Package.build_zig_basename });
48934877 return cleanExit(io);
48944878 },
48954879 }
......@@ -5023,7 +5007,7 @@ fn cmdBuild(
50235007 configure_argv.appendAssumeCapacity(arg);
50245008 continue;
50255009 } else if (mem.eql(u8, arg, "--system")) {
5026 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5010 if (i + 1 >= args.len) fatal("expected argument after {q}", .{arg});
50275011 i += 1;
50285012 system_pkg_dir_path = args[i];
50295013
......@@ -5032,7 +5016,7 @@ fn cmdBuild(
50325016 continue;
50335017 } else if (mem.cutPrefix(u8, arg, "--color=")) |rest| {
50345018 color = std.meta.stringToEnum(Color, rest) orelse
5035 fatal("expected --color=[auto|on|off]; found: {s}", .{arg});
5019 fatal("expected --color=[auto|on|off]; found {q}", .{arg});
50365020
50375021 try cached_passthru_configure.append(arena, @intCast(configure_argv.items.len));
50385022 configure_argv.appendAssumeCapacity(arg);
......@@ -5053,7 +5037,7 @@ fn cmdBuild(
50535037 // does not go into the cache hash.
50545038 configure_argv.appendAssumeCapacity(arg);
50555039 } else if (mem.eql(u8, arg, "--search-prefix")) {
5056 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5040 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50575041 i += 1;
50585042 // This argument is cache poisonous: it does not go into
50595043 // the cache and configurer must set the poison bit when
......@@ -5062,27 +5046,27 @@ fn cmdBuild(
50625046 (try make_argv.addManyAsArray(arena, 2)).* = .{ arg, args[i] };
50635047 continue;
50645048 } else if (mem.eql(u8, arg, "--build-file")) {
5065 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5049 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50665050 i += 1;
50675051 build_file = args[i];
50685052 continue;
50695053 } else if (mem.eql(u8, arg, "--zig-lib-dir")) {
5070 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5054 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50715055 i += 1;
50725056 override_lib_dir = args[i];
50735057 continue;
50745058 } else if (mem.eql(u8, arg, "--cache-dir")) {
5075 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5059 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50765060 i += 1;
50775061 override_local_cache_dir = args[i];
50785062 continue;
50795063 } else if (mem.eql(u8, arg, "--pkg-dir")) {
5080 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5064 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50815065 i += 1;
50825066 override_pkg_dir = args[i];
50835067 continue;
50845068 } else if (mem.eql(u8, arg, "--global-cache-dir")) {
5085 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5069 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
50865070 i += 1;
50875071 override_global_cache_dir = args[i];
50885072 continue;
......@@ -5093,7 +5077,7 @@ fn cmdBuild(
50935077 } else if (mem.cutPrefix(u8, arg, "--fetch=")) |sub_arg| {
50945078 fetch_only = true;
50955079 fetch_mode = std.meta.stringToEnum(Package.Fetch.JobQueue.Mode, sub_arg) orelse
5096 fatal("expected [needed|all] after '--fetch=', found '{s}'", .{sub_arg});
5080 fatal("expected [needed|all] after \"--fetch=\", found: {s}", .{sub_arg});
50975081 } else if (mem.cutPrefix(u8, arg, "--fork=")) |sub_arg| {
50985082 try forks.append(arena, .init(sub_arg));
50995083 continue;
......@@ -5104,7 +5088,7 @@ fn cmdBuild(
51045088 continue;
51055089 } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| {
51065090 reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| {
5107 fatal("unable to parse reference_trace count '{s}': {t}", .{ num, err });
5091 fatal("unable to parse reference_trace count {q}: {t}", .{ num, err });
51085092 };
51095093 } else if (mem.eql(u8, arg, "-fno-reference-trace")) {
51105094 reference_trace = null;
......@@ -5112,7 +5096,7 @@ fn cmdBuild(
51125096 maker_optimize_mode = parseOptimizeMode(rest);
51135097 continue;
51145098 } else if (mem.eql(u8, arg, "--debug-log")) {
5115 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5099 if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg});
51165100 try make_argv.appendSlice(arena, args[i .. i + 2]);
51175101 i += 1;
51185102 try addDebugLog(arena, args[i]);
......@@ -5124,7 +5108,7 @@ fn cmdBuild(
51245108 warn("Zig was compiled without debug extensions. --debug-compile-errors has no effect.", .{});
51255109 }
51265110 } else if (mem.eql(u8, arg, "--debug-target")) {
5127 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5111 if (i + 1 >= args.len) fatal("expected argument after {q}", .{arg});
51285112 i += 1;
51295113 if (build_options.enable_debug_extensions) {
51305114 debug_target = args[i];
......@@ -5133,7 +5117,7 @@ fn cmdBuild(
51335117 }
51345118 continue;
51355119 } else if (mem.eql(u8, arg, "--debug-libc")) {
5136 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5120 if (i + 1 >= args.len) fatal("expected argument after {q}", .{arg});
51375121 i += 1;
51385122 if (build_options.enable_debug_extensions) {
51395123 debug_libc_paths_file = args[i];
......@@ -5167,7 +5151,7 @@ fn cmdBuild(
51675151 }
51685152 n_jobs = num;
51695153 } else if (mem.eql(u8, arg, "--seed")) {
5170 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
5154 if (i + 1 >= args.len) fatal("expected argument after {q}", .{arg});
51715155 i += 1;
51725156 make_argv.items[argv_index_seed] = args[i];
51735157 continue;
......@@ -5689,7 +5673,7 @@ fn cmdBuild(
56895673 const hash = hash_string.slice(&configuration);
56905674 assert(hash.len != 0);
56915675 if (hash.len > Package.Hash.max_len) {
5692 std.log.err("invalid digest (length {d} exceeds maximum): '{s}'", .{ hash.len, hash });
5676 std.log.err("invalid digest (length {d} exceeds maximum): {q}", .{ hash.len, hash });
56935677 any_errors = true;
56945678 continue;
56955679 }
......@@ -5808,7 +5792,7 @@ const MakeRunner = struct {
58085792};
58095793
58105794fn compileMakeRunner(gpa: Allocator, arena: Allocator, io: Io, options: MakeRunner.Options) !MakeRunner {
5811 const compile_prog_node = options.parent_prog_node.start("Compiling maker (first time setup)", 0);
5795 const compile_prog_node = options.parent_prog_node.start("Compiling Maker (first time setup)", 0);
58125796 defer compile_prog_node.end();
58135797
58145798 const strip = options.optimize_mode != .Debug;
......@@ -6367,7 +6351,7 @@ pub const ClangArgIterator = struct {
63676351 const resp_file_path = arg[1..];
63686352
63696353 self.arg_iterator_response_file = initArgIteratorResponseFile(arena, io, resp_file_path) catch |err|
6370 fatal("unable to read response file '{s}': {t}", .{ resp_file_path, err });
6354 fatal("unable to read response file {q}: {t}", .{ resp_file_path, err });
63716355 // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an
63726356 // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here.
63736357
......@@ -6435,7 +6419,7 @@ pub const ClangArgIterator = struct {
64356419 const prefix_len = clang_arg.matchStartsWith(arg);
64366420 if (prefix_len == arg.len) {
64376421 if (self.next_index >= self.argv.len) {
6438 fatal("Expected parameter after '{s}'", .{arg});
6422 fatal("Expected parameter after {q}", .{arg});
64396423 }
64406424 self.only_arg = self.argv[self.next_index];
64416425 self.incrementArgIndex();
......@@ -6456,7 +6440,7 @@ pub const ClangArgIterator = struct {
64566440 if (prefix_len != 0) {
64576441 self.only_arg = arg[prefix_len..];
64586442 if (self.next_index >= self.argv.len) {
6459 fatal("Expected parameter after '{s}'", .{arg});
6443 fatal("Expected parameter after {q}", .{arg});
64606444 }
64616445 self.second_arg = self.argv[self.next_index];
64626446 self.incrementArgIndex();
......@@ -6467,7 +6451,7 @@ pub const ClangArgIterator = struct {
64676451 },
64686452 .separate => if (clang_arg.matchEql(arg) > 0) {
64696453 if (self.next_index >= self.argv.len) {
6470 fatal("Expected parameter after '{s}'", .{arg});
6454 fatal("expected parameter after {q}", .{arg});
64716455 }
64726456 self.only_arg = self.argv[self.next_index];
64736457 self.incrementArgIndex();
......@@ -6492,7 +6476,7 @@ pub const ClangArgIterator = struct {
64926476 break :find_clang_arg;
64936477 },
64946478 } else {
6495 fatal("Unknown Clang option: '{s}'", .{arg});
6479 fatal("unknown clang option: {q}", .{arg});
64966480 }
64976481 }
64986482
......@@ -6520,7 +6504,7 @@ pub const ClangArgIterator = struct {
65206504
65216505fn parseCodeModel(arg: []const u8) std.lang.CodeModel {
65226506 return std.meta.stringToEnum(std.lang.CodeModel, arg) orelse
6523 fatal("unsupported machine code model: '{s}'", .{arg});
6507 fatal("unsupported machine code model: {q}", .{arg});
65246508}
65256509
65266510const usage_ast_check =
......@@ -6569,15 +6553,15 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map:
65696553 i += 1;
65706554 const next_arg = args[i];
65716555 color = std.meta.stringToEnum(Color, next_arg) orelse {
6572 fatal("expected [auto|on|off] after --color, found '{s}'", .{next_arg});
6556 fatal("expected [auto|on|off] after --color, found {q}", .{next_arg});
65736557 };
65746558 } else {
6575 fatal("unrecognized parameter: '{s}'", .{arg});
6559 fatal("unrecognized parameter: {q}", .{arg});
65766560 }
65776561 } else if (zig_source_path == null) {
65786562 zig_source_path = arg;
65796563 } else {
6580 fatal("extra positional parameter: '{s}'", .{arg});
6564 fatal("extra positional parameter: {q}", .{arg});
65816565 }
65826566 }
65836567
......@@ -6585,13 +6569,13 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map:
65856569 const source: [:0]const u8 = s: {
65866570 var f = if (zig_source_path) |p| file: {
65876571 break :file Io.Dir.cwd().openFile(io, p, .{}) catch |err| {
6588 fatal("unable to open file '{s}' for ast-check: {s}", .{ display_path, @errorName(err) });
6572 fatal("unable to open file {q} for ast-check: {t}", .{ display_path, err });
65896573 };
65906574 } else Io.File.stdin();
65916575 defer if (zig_source_path != null) f.close(io);
65926576 var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer);
65936577 break :s std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err| {
6594 fatal("unable to load file '{s}' for ast-check: {s}", .{ display_path, @errorName(err) });
6578 fatal("unable to load file {q} for ast-check: {t}", .{ display_path, err });
65956579 };
65966580 };
65976581
......@@ -6717,7 +6701,7 @@ fn cmdDumpZir(arena: Allocator, io: Io, args: []const []const u8) !void {
67176701 const cache_file = args[0];
67186702
67196703 var f = Io.Dir.cwd().openFile(io, cache_file, .{}) catch |err| {
6720 fatal("unable to open zir cache file for dumping '{s}': {s}", .{ cache_file, @errorName(err) });
6704 fatal("unable to open zir cache file for dumping {q}: {t}", .{ cache_file, err });
67216705 };
67226706 defer f.close(io);
67236707
......@@ -6764,19 +6748,19 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map
67646748
67656749 const old_source = source: {
67666750 var f = Io.Dir.cwd().openFile(io, old_source_path, .{}) catch |err|
6767 fatal("unable to open old source file '{s}': {s}", .{ old_source_path, @errorName(err) });
6751 fatal("unable to open old source file {q}: {t}", .{ old_source_path, err });
67686752 defer f.close(io);
67696753 var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer);
67706754 break :source std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err|
6771 fatal("unable to read old source file '{s}': {s}", .{ old_source_path, @errorName(err) });
6755 fatal("unable to read old source file {q}: {t}", .{ old_source_path, err });
67726756 };
67736757 const new_source = source: {
67746758 var f = Io.Dir.cwd().openFile(io, new_source_path, .{}) catch |err|
6775 fatal("unable to open new source file '{s}': {s}", .{ new_source_path, @errorName(err) });
6759 fatal("unable to open new source file {q}: {t}", .{ new_source_path, err });
67766760 defer f.close(io);
67776761 var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer);
67786762 break :source std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err|
6779 fatal("unable to read new source file '{s}': {s}", .{ new_source_path, @errorName(err) });
6763 fatal("unable to read new source file {q}: {t}", .{ new_source_path, err });
67806764 };
67816765
67826766 const old_tree = try Ast.parse(arena, old_source, .zig);
......@@ -6835,7 +6819,7 @@ fn eatIntPrefix(arg: []const u8, base: u8) []const u8 {
68356819
68366820fn prefixedIntArg(arg: []const u8, prefix: []const u8) ?u64 {
68376821 const number = mem.cutPrefix(u8, arg, prefix) orelse return null;
6838 return std.fmt.parseUnsigned(u64, number, 0) catch |err| fatal("unable to parse '{s}': {t}", .{ arg, err });
6822 return std.fmt.parseUnsigned(u64, number, 0) catch |err| fatal("unable to parse {q}: {t}", .{ arg, err });
68396823}
68406824
68416825fn warnAboutForeignBinaries(
......@@ -6873,7 +6857,7 @@ fn warnAboutForeignBinaries(
68736857 ),
68746858 else => warn(
68756859 "the host system ({s}) does not appear to be capable of executing binaries " ++
6876 "from the target ({s}). Consider using '{s}' to run the binary",
6860 "from the target ({s}). Consider using {q} to run the binary",
68776861 .{ host_name, foreign_name, qemu },
68786862 ),
68796863 }
......@@ -6890,7 +6874,7 @@ fn warnAboutForeignBinaries(
68906874 ),
68916875 else => warn(
68926876 "the host system ({s}) does not appear to be capable of executing binaries " ++
6893 "from the target ({s}). Consider using '{s}' to run the binary",
6877 "from the target ({s}). Consider using {q} to run the binary",
68946878 .{ host_name, foreign_name, wine },
68956879 ),
68966880 }
......@@ -6907,7 +6891,7 @@ fn warnAboutForeignBinaries(
69076891 ),
69086892 else => warn(
69096893 "the host system ({s}) does not appear to be capable of executing binaries " ++
6910 "from the target ({s}). Consider using '{s}' to run the binary",
6894 "from the target ({s}). Consider using {q} to run the binary",
69116895 .{ host_name, foreign_name, wasmtime },
69126896 ),
69136897 }
......@@ -6924,7 +6908,7 @@ fn warnAboutForeignBinaries(
69246908 ),
69256909 else => warn(
69266910 "the host system ({s}) does not appear to be capable of executing binaries " ++
6927 "from the target ({s}). Consider using '{s}' to run the binary",
6911 "from the target ({s}). Consider using {q} to run the binary",
69286912 .{ host_name, foreign_name, darling },
69296913 ),
69306914 }
......@@ -6935,7 +6919,7 @@ fn warnAboutForeignBinaries(
69356919 .zig_test => ", '--test-no-exec', or '--test-cmd'",
69366920 else => "",
69376921 };
6938 warn("the host system does not appear to be capable of executing binaries from the target because the host dynamic linker is '{s}', while the target dynamic linker is '{s}'. Consider using '--dynamic-linker'{s}", .{
6922 warn("the host system does not appear to be capable of executing binaries from the target because the host dynamic linker is {q}, while the target dynamic linker is {q}. Consider using '--dynamic-linker'{s}", .{
69396923 host_dl, foreign_dl, tip_suffix,
69406924 });
69416925 },
......@@ -6955,7 +6939,7 @@ fn warnAboutForeignBinaries(
69556939
69566940fn parseSubsystem(arg: []const u8) !std.zig.Subsystem {
69576941 return std.meta.stringToEnum(std.zig.Subsystem, arg) orelse
6958 fatal("invalid: --subsystem: '{s}'. Options are:\n{s}", .{
6942 fatal("invalid: --subsystem: {q}. Options are:\n{s}", .{
69596943 arg,
69606944 \\ console
69616945 \\ windows
......@@ -6994,7 +6978,7 @@ const ClangSearchSanitizer = struct {
69946978 // init empty membership
69956979 m.* = .{};
69966980 }
6997 const wtxt = "add '{s}' to header searchlist '-{s}' conflicts with '-{s}'";
6981 const wtxt = "add {q} to header searchlist '-{s}' conflicts with '-{s}'";
69986982 switch (group) {
69996983 .I => {
70006984 if (m.I) return;
......@@ -7074,8 +7058,8 @@ fn accessFrameworkPath(
70747058 try checked_paths.print("\n {s}", .{test_path.items});
70757059 Io.Dir.cwd().access(io, test_path.items, .{}) catch |err| switch (err) {
70767060 error.FileNotFound => continue,
7077 else => |e| fatal("unable to search for {s} framework '{s}': {s}", .{
7078 ext, test_path.items, @errorName(e),
7061 else => |e| fatal("unable to search for {s} framework {q}: {t}", .{
7062 ext, test_path.items, e,
70797063 }),
70807064 };
70817065 return true;
......@@ -7086,7 +7070,7 @@ fn accessFrameworkPath(
70867070
70877071fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes {
70887072 return std.meta.stringToEnum(std.zig.RcIncludes, arg) orelse
7089 fatal("unsupported rc includes type: '{s}'", .{arg});
7073 fatal("unsupported rc includes type: {q}", .{arg});
70907074}
70917075
70927076const usage_fetch =
......@@ -7175,10 +7159,10 @@ fn cmdFetch(
71757159 } else if (mem.cutPrefix(u8, arg, "--save-exact=")) |rest| {
71767160 save = .{ .exact = rest };
71777161 } else {
7178 fatal("unrecognized parameter: '{s}'", .{arg});
7162 fatal("unrecognized parameter: {q}", .{arg});
71797163 }
71807164 } else if (opt_path_or_url != null) {
7181 fatal("unexpected extra parameter: '{s}'", .{arg});
7165 fatal("unexpected extra parameter: {q}", .{arg});
71827166 } else {
71837167 opt_path_or_url = arg;
71847168 }
......@@ -7339,7 +7323,7 @@ fn cmdFetch(
73397323 // the refspec may already be fully resolved
73407324 if (std.mem.eql(u8, target_ref, latest_commit_hex)) break :resolved;
73417325
7342 std.log.info("resolved ref '{s}' to commit {s}", .{ target_ref, latest_commit_hex });
7326 std.log.info("resolved ref {q} to commit {s}", .{ target_ref, latest_commit_hex });
73437327
73447328 // include the original refspec in a query parameter, could be used to check for updates
73457329 uri.query = .{ .percent_encoded = try std.fmt.allocPrint(arena, "ref={f}", .{
......@@ -7385,7 +7369,7 @@ fn cmdFetch(
73857369 switch (dep.location) {
73867370 .url => |u| {
73877371 if (mem.eql(u8, h, package_hash_slice) and mem.eql(u8, u, saved_path_or_url)) {
7388 std.log.info("existing dependency named '{s}' is up-to-date", .{name});
7372 std.log.info("existing dependency named {q} is up-to-date", .{name});
73897373 process.exit(0);
73907374 }
73917375 },
......@@ -7404,7 +7388,7 @@ fn cmdFetch(
74047388 .{std.zig.fmtString(package_hash_slice)},
74057389 );
74067390
7407 warn("overwriting existing dependency named '{s}'", .{name});
7391 warn("overwriting existing dependency named {q}", .{name});
74087392 try fixups.replace_nodes_with_string.put(gpa, dep.location_node, location_replace);
74097393 if (dep.hash_node.unwrap()) |hash_node| {
74107394 try fixups.replace_nodes_with_string.put(gpa, hash_node, hash_replace);
......@@ -7531,7 +7515,7 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build
75317515 if (options.build_file) |bf| {
75327516 if (fs.path.dirname(bf)) |dirname| {
75337517 const dir = Io.Dir.cwd().openDir(io, dirname, .{}) catch |err| {
7534 fatal("unable to open directory to build file from argument 'build-file', '{s}': {s}", .{ dirname, @errorName(err) });
7518 fatal("unable to open directory to build file from argument 'build-file', {q}: {t}", .{ dirname, err });
75357519 };
75367520 return .{
75377521 .build_zig_basename = build_zig_basename,
......@@ -7552,7 +7536,7 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build
75527536 const joined_path = try fs.path.join(arena, &[_][]const u8{ dirname, build_zig_basename });
75537537 if (Io.Dir.cwd().access(io, joined_path, .{})) |_| {
75547538 const dir = Io.Dir.cwd().openDir(io, dirname, .{}) catch |err| {
7555 fatal("unable to open directory while searching for build.zig file, '{s}': {s}", .{ dirname, @errorName(err) });
7539 fatal("unable to open directory while searching for build.zig file, {q}: {t}", .{ dirname, err });
75567540 };
75577541 return .{
75587542 .build_zig_basename = build_zig_basename,
......@@ -7673,13 +7657,13 @@ const Templates = struct {
76737657 ) !void {
76747658 if (fs.path.dirname(template_path)) |dirname| {
76757659 out_dir.createDirPath(io, dirname) catch |err| {
7676 fatal("unable to make path '{s}': {t}", .{ dirname, err });
7660 fatal("unable to make path {q}: {t}", .{ dirname, err });
76777661 };
76787662 }
76797663
76807664 const max_bytes = 10 * 1024 * 1024;
76817665 const contents = templates.dir.readFileAlloc(io, template_path, arena, .limited(max_bytes)) catch |err| {
7682 fatal("unable to read template file '{s}': {t}", .{ template_path, err });
7666 fatal("unable to read template file {q}: {t}", .{ template_path, err });
76837667 };
76847668 templates.buffer.clearRetainingCapacity();
76857669 try templates.buffer.ensureUnusedCapacity(contents.len);
......@@ -7731,7 +7715,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates {
77317715 fatal("unable to find self exe path: {t}", .{err});
77327716 };
77337717 var zig_lib_directory = introspect.findZigLibDirFromSelfExe(arena, io, cwd_path, self_exe_path) catch |err| {
7734 fatal("unable to find zig installation directory '{s}': {t}", .{ self_exe_path, err });
7718 fatal("unable to find zig installation directory {q}: {t}", .{ self_exe_path, err });
77357719 };
77367720
77377721 const s = fs.path.sep_str;
......@@ -7752,22 +7736,22 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates {
77527736
77537737fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode {
77547738 return std.meta.stringToEnum(std.lang.OptimizeMode, s) orelse
7755 fatal("unrecognized optimization mode: '{s}'", .{s});
7739 fatal("unrecognized optimization mode: {q}", .{s});
77567740}
77577741
77587742fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel {
77597743 return std.meta.stringToEnum(std.lang.WasiExecModel, s) orelse
7760 fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{s});
7744 fatal("expected [command|reactor] for -mexec-mode=[value], found {q}", .{s});
77617745}
77627746
77637747fn parseStackSize(s: []const u8) u64 {
77647748 return std.fmt.parseUnsigned(u64, s, 0) catch |err|
7765 fatal("unable to parse stack size '{s}': {s}", .{ s, @errorName(err) });
7749 fatal("unable to parse stack size {q}: {t}", .{ s, err });
77667750}
77677751
77687752fn parseImageBase(s: []const u8) u64 {
77697753 return std.fmt.parseUnsigned(u64, s, 0) catch |err|
7770 fatal("unable to parse image base '{s}': {s}", .{ s, @errorName(err) });
7754 fatal("unable to parse image base {q}: {t}", .{ s, err });
77717755}
77727756
77737757fn handleModArg(
......@@ -7787,7 +7771,7 @@ fn handleModArg(
77877771 const gop = try create_module.modules.getOrPut(arena, mod_name);
77887772
77897773 if (gop.found_existing) {
7790 fatal("unable to add module '{s}': already exists as '{s}{c}{s}'", .{
7774 fatal("unable to add module {q}: already exists as '{s}{c}{s}'", .{
77917775 mod_name, gop.value_ptr.root_path, fs.path.sep, gop.value_ptr.root_src_path,
77927776 });
77937777 }
......@@ -7866,7 +7850,7 @@ fn addLibDirectoryWarn2(
78667850 lib_directories.appendAssumeCapacity(.{
78677851 .handle = Io.Dir.cwd().openDir(io, path, .{}) catch |err| {
78687852 if (err == error.FileNotFound and ignore_not_found) return;
7869 warn("unable to open library directory '{s}': {s}", .{ path, @errorName(err) });
7853 warn("unable to open library directory {q}: {t}", .{ path, err });
78707854 return;
78717855 },
78727856 .path = path,
test/tests.zig+2-1
......@@ -2278,7 +2278,8 @@ pub fn addCliTests(b: *std.Build) *Step {
22782278 // Test missing output path.
22792279 const bad_out_arg = "-femit-bin=does" ++ s ++ "not" ++ s ++ "exist" ++ s ++ "foo.exe";
22802280 const ok_src_arg = "src" ++ s ++ "main.zig";
2281 const expected = "error: unable to open output directory 'does" ++ s ++ "not" ++ s ++ "exist': FileNotFound\n";
2281 const es = if (builtin.os.tag == .windows) "\\\\" else "/";
2282 const expected = "error: unable to open output directory \"does" ++ es ++ "not" ++ es ++ "exist\": FileNotFound\n";
22822283 const run_bad = b.addSystemCommand(&.{ b.graph.zig_exe, "build-exe", ok_src_arg, bad_out_arg });
22832284 run_bad.setName("zig build-exe error message for bad -femit-bin arg");
22842285 run_bad.expectExitCode(1);