| ... | @@ -740,9 +740,9 @@ const Emit = union(enum) { | ... | @@ -740,9 +740,9 @@ const Emit = union(enum) { |
| 740 | .yes_default_path => if (output_to_cache != null) .yes_cache else .{ .yes_path = default_basename }, | 740 | .yes_default_path => if (output_to_cache != null) .yes_cache else .{ .yes_path = default_basename }, |
| 741 | .yes => |path| if (output_to_cache) |reason| { | 741 | .yes => |path| if (output_to_cache) |reason| { |
| 742 | switch (reason) { | 742 | switch (reason) { |
| 743 | .listen => fatal("--listen incompatible with explicit output path '{s}'", .{path}), | 743 | .listen => fatal("--listen incompatible with explicit output path {q}", .{path}), |
| 744 | .@"zig run", .@"zig test" => fatal( | 744 | .@"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'", |
| 746 | .{ @tagName(reason), path }, | 746 | .{ @tagName(reason), path }, |
| 747 | ), | 747 | ), |
| 748 | } | 748 | } |
| ... | @@ -750,7 +750,7 @@ const Emit = union(enum) { | ... | @@ -750,7 +750,7 @@ const Emit = union(enum) { |
| 750 | // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would. | 750 | // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would. |
| 751 | if (fs.path.dirname(path)) |dir_path| { | 751 | if (fs.path.dirname(path)) |dir_path| { |
| 752 | var dir = Io.Dir.cwd().openDir(io, dir_path, .{}) catch |err| { | 752 | 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 }); |
| 754 | }; | 754 | }; |
| 755 | dir.close(io); | 755 | dir.close(io); |
| 756 | } | 756 | } |
| ... | @@ -1064,7 +1064,7 @@ fn buildOutputType( | ... | @@ -1064,7 +1064,7 @@ fn buildOutputType( |
| 1064 | // This is a "compiler response file". We must parse the file and treat its | 1064 | // This is a "compiler response file". We must parse the file and treat its |
| 1065 | // contents as command line parameters. | 1065 | // contents as command line parameters. |
| 1066 | args_iter.resp_file = initArgIteratorResponseFile(arena, io, resp_file_path) catch |err| | 1066 | 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 }); |
| 1068 | } else if (mem.startsWith(u8, arg, "-")) { | 1068 | } else if (mem.startsWith(u8, arg, "-")) { |
| 1069 | if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) { | 1069 | if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) { |
| 1070 | try Io.File.stdout().writeStreamingAll(io, usage_build_generic); | 1070 | try Io.File.stdout().writeStreamingAll(io, usage_build_generic); |
| ... | @@ -1082,15 +1082,11 @@ fn buildOutputType( | ... | @@ -1082,15 +1082,11 @@ fn buildOutputType( |
| 1082 | const next_arg = args_iter.nextOrFatal(); | 1082 | const next_arg = args_iter.nextOrFatal(); |
| 1083 | const key, const value = mem.cutScalar(u8, next_arg, '=') orelse .{ next_arg, next_arg }; | 1083 | const key, const value = mem.cutScalar(u8, next_arg, '=') orelse .{ next_arg, next_arg }; |
| 1084 | if (mem.eql(u8, key, "std") and !mem.eql(u8, value, "std")) { | 1084 | if (mem.eql(u8, key, "std") and !mem.eql(u8, value, "std")) { |
| 1085 | fatal("unable to import as '{s}': conflicts with builtin module", .{ | 1085 | fatal("unable to import as {q}: conflicts with builtin module", .{key}); |
| 1086 | key, | | |
| 1087 | }); | | |
| 1088 | } | 1086 | } |
| 1089 | for ([_][]const u8{ "root", "builtin" }) |name| { | 1087 | for ([_][]const u8{ "root", "builtin" }) |name| { |
| 1090 | if (mem.eql(u8, key, name)) { | 1088 | if (mem.eql(u8, key, name)) { |
| 1091 | fatal("unable to import as '{s}': conflicts with builtin module", .{ | 1089 | fatal("unable to import as {q}: conflicts with builtin module", .{key}); |
| 1092 | key, | | |
| 1093 | }); | | |
| 1094 | } | 1090 | } |
| 1095 | } | 1091 | } |
| 1096 | try deps.append(arena, .{ | 1092 | try deps.append(arena, .{ |
| ... | @@ -1116,7 +1112,7 @@ fn buildOutputType( | ... | @@ -1116,7 +1112,7 @@ fn buildOutputType( |
| 1116 | } else if (mem.eql(u8, arg, "--error-limit")) { | 1112 | } else if (mem.eql(u8, arg, "--error-limit")) { |
| 1117 | const next_arg = args_iter.nextOrFatal(); | 1113 | const next_arg = args_iter.nextOrFatal(); |
| 1118 | error_limit = std.fmt.parseUnsigned(Zcu.ErrorInt, next_arg, 0) catch |err| { | 1114 | 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 }); |
| 1120 | }; | 1116 | }; |
| 1121 | } else if (mem.eql(u8, arg, "-cflags")) { | 1117 | } else if (mem.eql(u8, arg, "-cflags")) { |
| 1122 | extra_cflags.shrinkRetainingCapacity(0); | 1118 | extra_cflags.shrinkRetainingCapacity(0); |
| ... | @@ -1149,16 +1145,14 @@ fn buildOutputType( | ... | @@ -1149,16 +1145,14 @@ fn buildOutputType( |
| 1149 | fatal("expected [auto|on|off] after --color", .{}); | 1145 | fatal("expected [auto|on|off] after --color", .{}); |
| 1150 | }; | 1146 | }; |
| 1151 | color = std.meta.stringToEnum(Color, next_arg) orelse { | 1147 | 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}); |
| 1153 | }; | 1149 | }; |
| 1154 | } else if (mem.cutPrefix(u8, arg, "-j")) |str| { | 1150 | } else if (mem.cutPrefix(u8, arg, "-j")) |str| { |
| 1155 | const num = std.fmt.parseUnsigned(u32, str, 10) catch |err| { | 1151 | const num = std.fmt.parseUnsigned(u32, str, 10) catch |err| { |
| 1156 | fatal("unable to parse jobs count '{s}': {s}", .{ | 1152 | fatal("unable to parse jobs count {q}: {t}", .{ str, err }); |
| 1157 | str, @errorName(err), | | |
| 1158 | }); | | |
| 1159 | }; | 1153 | }; |
| 1160 | if (num < 1) { | 1154 | if (num < 1) { |
| 1161 | fatal("number of jobs must be at least 1\n", .{}); | 1155 | fatal("number of jobs must be at least 1", .{}); |
| 1162 | } | 1156 | } |
| 1163 | n_jobs = num; | 1157 | n_jobs = num; |
| 1164 | } else if (mem.eql(u8, arg, "--subsystem")) { | 1158 | } else if (mem.eql(u8, arg, "--subsystem")) { |
| ... | @@ -1178,7 +1172,7 @@ fn buildOutputType( | ... | @@ -1178,7 +1172,7 @@ fn buildOutputType( |
| 1178 | } else if (mem.eql(u8, arg, "--name")) { | 1172 | } else if (mem.eql(u8, arg, "--name")) { |
| 1179 | provided_name = args_iter.nextOrFatal(); | 1173 | provided_name = args_iter.nextOrFatal(); |
| 1180 | if (!mem.eql(u8, provided_name.?, fs.path.basename(provided_name.?))) | 1174 | 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.?}); |
| 1182 | } else if (mem.eql(u8, arg, "-rpath")) { | 1176 | } else if (mem.eql(u8, arg, "-rpath")) { |
| 1183 | try create_module.rpath_list.append(arena, args_iter.nextOrFatal()); | 1177 | try create_module.rpath_list.append(arena, args_iter.nextOrFatal()); |
| 1184 | } else if (mem.eql(u8, arg, "--library-directory") or mem.eql(u8, arg, "-L")) { | 1178 | } else if (mem.eql(u8, arg, "--library-directory") or mem.eql(u8, arg, "-L")) { |
| ... | @@ -1195,14 +1189,14 @@ fn buildOutputType( | ... | @@ -1195,14 +1189,14 @@ fn buildOutputType( |
| 1195 | install_name = args_iter.nextOrFatal(); | 1189 | install_name = args_iter.nextOrFatal(); |
| 1196 | } else if (mem.cutPrefix(u8, arg, "--compress-debug-sections=")) |param| { | 1190 | } else if (mem.cutPrefix(u8, arg, "--compress-debug-sections=")) |param| { |
| 1197 | linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, param) orelse { | 1191 | 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}); |
| 1199 | }; | 1193 | }; |
| 1200 | } else if (mem.eql(u8, arg, "--compress-debug-sections")) { | 1194 | } else if (mem.eql(u8, arg, "--compress-debug-sections")) { |
| 1201 | linker_compress_debug_sections = .zlib; | 1195 | linker_compress_debug_sections = .zlib; |
| 1202 | } else if (mem.eql(u8, arg, "-pagezero_size")) { | 1196 | } else if (mem.eql(u8, arg, "-pagezero_size")) { |
| 1203 | const next_arg = args_iter.nextOrFatal(); | 1197 | const next_arg = args_iter.nextOrFatal(); |
| 1204 | pagezero_size = std.fmt.parseUnsigned(u64, eatIntPrefix(next_arg, 16), 16) catch |err| { | 1198 | 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 }); |
| 1206 | }; | 1200 | }; |
| 1207 | } else if (mem.eql(u8, arg, "-search_paths_first")) { | 1201 | } else if (mem.eql(u8, arg, "-search_paths_first")) { |
| 1208 | lib_search_strategy = .paths_first; | 1202 | lib_search_strategy = .paths_first; |
| ... | @@ -1225,7 +1219,7 @@ fn buildOutputType( | ... | @@ -1225,7 +1219,7 @@ fn buildOutputType( |
| 1225 | } else if (mem.eql(u8, arg, "-headerpad")) { | 1219 | } else if (mem.eql(u8, arg, "-headerpad")) { |
| 1226 | const next_arg = args_iter.nextOrFatal(); | 1220 | const next_arg = args_iter.nextOrFatal(); |
| 1227 | headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| { | 1221 | 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 }); |
| 1229 | }; | 1223 | }; |
| 1230 | } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { | 1224 | } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { |
| 1231 | headerpad_max_install_names = true; | 1225 | headerpad_max_install_names = true; |
| ... | @@ -1310,7 +1304,7 @@ fn buildOutputType( | ... | @@ -1310,7 +1304,7 @@ fn buildOutputType( |
| 1310 | } else if (mem.eql(u8, arg, "--version")) { | 1304 | } else if (mem.eql(u8, arg, "--version")) { |
| 1311 | const next_arg = args_iter.nextOrFatal(); | 1305 | const next_arg = args_iter.nextOrFatal(); |
| 1312 | version = std.SemanticVersion.parse(next_arg) catch |err| { | 1306 | 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 }); |
| 1314 | }; | 1308 | }; |
| 1315 | have_version = true; | 1309 | have_version = true; |
| 1316 | } else if (mem.eql(u8, arg, "-target")) { | 1310 | } else if (mem.eql(u8, arg, "-target")) { |
| ... | @@ -1361,9 +1355,9 @@ fn buildOutputType( | ... | @@ -1361,9 +1355,9 @@ fn buildOutputType( |
| 1361 | // example: --listen 127.0.0.1:9000 | 1355 | // example: --listen 127.0.0.1:9000 |
| 1362 | const host, const port_text = mem.cutScalar(u8, next_arg, ':') orelse .{ next_arg, "14735" }; | 1356 | const host, const port_text = mem.cutScalar(u8, next_arg, ':') orelse .{ next_arg, "14735" }; |
| 1363 | const port = std.fmt.parseInt(u16, port_text, 10) catch |err| | 1357 | 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 }); |
| 1365 | listen = .{ .ip4 = Io.net.Ip4Address.parse(host, port) catch |err| | 1359 | 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 }) }; |
| 1367 | } | 1361 | } |
| 1368 | } else if (mem.eql(u8, arg, "--listen=-")) { | 1362 | } else if (mem.eql(u8, arg, "--listen=-")) { |
| 1369 | dev.check(.stdio_listen); | 1363 | dev.check(.stdio_listen); |
| ... | @@ -1429,7 +1423,7 @@ fn buildOutputType( | ... | @@ -1429,7 +1423,7 @@ fn buildOutputType( |
| 1429 | } else if (mem.eql(u8, mode, "thin")) { | 1423 | } else if (mem.eql(u8, mode, "thin")) { |
| 1430 | create_module.opts.lto = .thin; | 1424 | create_module.opts.lto = .thin; |
| 1431 | } else { | 1425 | } 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}); |
| 1433 | } | 1427 | } |
| 1434 | } else if (mem.eql(u8, arg, "-fno-lto")) { | 1428 | } else if (mem.eql(u8, arg, "-fno-lto")) { |
| 1435 | create_module.opts.lto = .none; | 1429 | create_module.opts.lto = .none; |
| ... | @@ -1463,7 +1457,7 @@ fn buildOutputType( | ... | @@ -1463,7 +1457,7 @@ fn buildOutputType( |
| 1463 | } else if (mem.eql(u8, mode, "full")) { | 1457 | } else if (mem.eql(u8, mode, "full")) { |
| 1464 | mod_opts.sanitize_c = .full; | 1458 | mod_opts.sanitize_c = .full; |
| 1465 | } else { | 1459 | } 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}); |
| 1467 | } | 1461 | } |
| 1468 | } else if (mem.eql(u8, arg, "-fno-sanitize-c")) { | 1462 | } else if (mem.eql(u8, arg, "-fno-sanitize-c")) { |
| 1469 | mod_opts.sanitize_c = .off; | 1463 | mod_opts.sanitize_c = .off; |
| ... | @@ -1507,7 +1501,7 @@ fn buildOutputType( | ... | @@ -1507,7 +1501,7 @@ fn buildOutputType( |
| 1507 | reference_trace = 256; | 1501 | reference_trace = 256; |
| 1508 | } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| { | 1502 | } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| { |
| 1509 | reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| { | 1503 | 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 }); |
| 1511 | }; | 1505 | }; |
| 1512 | } else if (mem.eql(u8, arg, "-fno-reference-trace")) { | 1506 | } else if (mem.eql(u8, arg, "-fno-reference-trace")) { |
| 1513 | reference_trace = null; | 1507 | reference_trace = null; |
| ... | @@ -1616,7 +1610,7 @@ fn buildOutputType( | ... | @@ -1616,7 +1610,7 @@ fn buildOutputType( |
| 1616 | mod_opts.no_builtin = true; | 1610 | mod_opts.no_builtin = true; |
| 1617 | } else if (mem.cutPrefix(u8, arg, "-fopt-bisect-limit=")) |next_arg| { | 1611 | } else if (mem.cutPrefix(u8, arg, "-fopt-bisect-limit=")) |next_arg| { |
| 1618 | llvm_opt_bisect_limit = std.fmt.parseInt(c_int, next_arg, 0) catch |err| | 1612 | 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 }); |
| 1620 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { | 1614 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { |
| 1621 | link_eh_frame_hdr = true; | 1615 | link_eh_frame_hdr = true; |
| 1622 | } else if (mem.eql(u8, arg, "--no-eh-frame-hdr")) { | 1616 | } else if (mem.eql(u8, arg, "--no-eh-frame-hdr")) { |
| ... | @@ -1701,9 +1695,7 @@ fn buildOutputType( | ... | @@ -1701,9 +1695,7 @@ fn buildOutputType( |
| 1701 | build_id = .fast; | 1695 | build_id = .fast; |
| 1702 | } else if (mem.cutPrefix(u8, arg, "--build-id=")) |style| { | 1696 | } else if (mem.cutPrefix(u8, arg, "--build-id=")) |style| { |
| 1703 | build_id = std.zig.BuildId.parse(style) catch |err| { | 1697 | build_id = std.zig.BuildId.parse(style) catch |err| { |
| 1704 | fatal("unable to parse --build-id style '{s}': {s}", .{ | 1698 | fatal("unable to parse --build-id style {q}: {t}", .{ style, err }); |
| 1705 | style, @errorName(err), | | |
| 1706 | }); | | |
| 1707 | }; | 1699 | }; |
| 1708 | } else if (mem.eql(u8, arg, "--debug-compile-errors")) { | 1700 | } else if (mem.eql(u8, arg, "--debug-compile-errors")) { |
| 1709 | if (build_options.enable_debug_extensions) { | 1701 | if (build_options.enable_debug_extensions) { |
| ... | @@ -1782,14 +1774,14 @@ fn buildOutputType( | ... | @@ -1782,14 +1774,14 @@ fn buildOutputType( |
| 1782 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { | 1774 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { |
| 1783 | file_ext = got_ext; | 1775 | file_ext = got_ext; |
| 1784 | } else { | 1776 | } else { |
| 1785 | fatal("language not recognized: '{s}'", .{lang}); | 1777 | fatal("language not recognized: {s}", .{lang}); |
| 1786 | } | 1778 | } |
| 1787 | } else if (mem.cutPrefix(u8, arg, "-mexec-model=")) |rest| { | 1779 | } else if (mem.cutPrefix(u8, arg, "-mexec-model=")) |rest| { |
| 1788 | create_module.opts.wasi_exec_model = parseWasiExecModel(rest); | 1780 | create_module.opts.wasi_exec_model = parseWasiExecModel(rest); |
| 1789 | } else if (mem.eql(u8, arg, "-municode")) { | 1781 | } else if (mem.eql(u8, arg, "-municode")) { |
| 1790 | mingw_unicode_entry_point = true; | 1782 | mingw_unicode_entry_point = true; |
| 1791 | } else { | 1783 | } else { |
| 1792 | fatal("unrecognized parameter: '{s}'", .{arg}); | 1784 | fatal("unrecognized parameter: {s}", .{arg}); |
| 1793 | } | 1785 | } |
| 1794 | } else switch (file_ext orelse Compilation.classifyFileExt(arg)) { | 1786 | } else switch (file_ext orelse Compilation.classifyFileExt(arg)) { |
| 1795 | .shared_library, .object, .static_library => { | 1787 | .shared_library, .object, .static_library => { |
| ... | @@ -1818,7 +1810,7 @@ fn buildOutputType( | ... | @@ -1818,7 +1810,7 @@ fn buildOutputType( |
| 1818 | }, | 1810 | }, |
| 1819 | .manifest => { | 1811 | .manifest => { |
| 1820 | if (manifest_file) |other| { | 1812 | 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 }); |
| 1822 | } else manifest_file = arg; | 1814 | } else manifest_file = arg; |
| 1823 | }, | 1815 | }, |
| 1824 | .def => { | 1816 | .def => { |
| ... | @@ -1846,14 +1838,14 @@ fn buildOutputType( | ... | @@ -1846,14 +1838,14 @@ fn buildOutputType( |
| 1846 | }, | 1838 | }, |
| 1847 | .zig => { | 1839 | .zig => { |
| 1848 | if (root_src_file) |other| { | 1840 | 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 }); |
| 1850 | } else root_src_file = arg; | 1842 | } else root_src_file = arg; |
| 1851 | }, | 1843 | }, |
| 1852 | .unknown => { | 1844 | .unknown => { |
| 1853 | if (std.ascii.eqlIgnoreCase(".xml", fs.path.extension(arg))) { | 1845 | if (std.ascii.eqlIgnoreCase(".xml", fs.path.extension(arg))) { |
| 1854 | warn("embedded manifest files must have the extension '.manifest'", .{}); | 1846 | warn("embedded manifest files must have the extension '.manifest'", .{}); |
| 1855 | } | 1847 | } |
| 1856 | fatal("unrecognized file extension of parameter '{s}'", .{arg}); | 1848 | fatal("unrecognized file extension of parameter {q}", .{arg}); |
| 1857 | }, | 1849 | }, |
| 1858 | } | 1850 | } |
| 1859 | } | 1851 | } |
| ... | @@ -1919,7 +1911,7 @@ fn buildOutputType( | ... | @@ -1919,7 +1911,7 @@ fn buildOutputType( |
| 1919 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { | 1911 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { |
| 1920 | file_ext = got_ext; | 1912 | file_ext = got_ext; |
| 1921 | } else { | 1913 | } else { |
| 1922 | fatal("language not recognized: '{s}'", .{lang}); | 1914 | fatal("language not recognized: {q}", .{lang}); |
| 1923 | } | 1915 | } |
| 1924 | }, | 1916 | }, |
| 1925 | .other => { | 1917 | .other => { |
| ... | @@ -1964,7 +1956,7 @@ fn buildOutputType( | ... | @@ -1964,7 +1956,7 @@ fn buildOutputType( |
| 1964 | }, | 1956 | }, |
| 1965 | .manifest => { | 1957 | .manifest => { |
| 1966 | if (manifest_file) |other| { | 1958 | 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 }); |
| 1968 | } else manifest_file = it.only_arg; | 1960 | } else manifest_file = it.only_arg; |
| 1969 | }, | 1961 | }, |
| 1970 | .def => { | 1962 | .def => { |
| ... | @@ -1979,7 +1971,7 @@ fn buildOutputType( | ... | @@ -1979,7 +1971,7 @@ fn buildOutputType( |
| 1979 | }, | 1971 | }, |
| 1980 | .zig => { | 1972 | .zig => { |
| 1981 | if (root_src_file) |other| { | 1973 | 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 }); |
| 1983 | } else root_src_file = it.only_arg; | 1975 | } else root_src_file = it.only_arg; |
| 1984 | }, | 1976 | }, |
| 1985 | }, | 1977 | }, |
| ... | @@ -2042,7 +2034,7 @@ fn buildOutputType( | ... | @@ -2042,7 +2034,7 @@ fn buildOutputType( |
| 2042 | } else if (mem.eql(u8, it.only_arg, "thin")) { | 2034 | } else if (mem.eql(u8, it.only_arg, "thin")) { |
| 2043 | create_module.opts.lto = .thin; | 2035 | create_module.opts.lto = .thin; |
| 2044 | } else { | 2036 | } 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}); |
| 2046 | } | 2038 | } |
| 2047 | }, | 2039 | }, |
| 2048 | .no_lto => create_module.opts.lto = .none, | 2040 | .no_lto => create_module.opts.lto = .none, |
| ... | @@ -2137,9 +2129,7 @@ fn buildOutputType( | ... | @@ -2137,9 +2129,7 @@ fn buildOutputType( |
| 2137 | // variants of them. | 2129 | // variants of them. |
| 2138 | if (mem.eql(u8, key, "--build-id")) { | 2130 | if (mem.eql(u8, key, "--build-id")) { |
| 2139 | build_id = std.zig.BuildId.parse(value) catch |err| { | 2131 | build_id = std.zig.BuildId.parse(value) catch |err| { |
| 2140 | fatal("unable to parse --build-id style '{s}': {s}", .{ | 2132 | fatal("unable to parse --build-id style {q}: {t}", .{ value, err }); |
| 2141 | value, @errorName(err), | | |
| 2142 | }); | | |
| 2143 | }; | 2133 | }; |
| 2144 | continue; | 2134 | continue; |
| 2145 | } else if (mem.eql(u8, key, "--sort-common")) { | 2135 | } else if (mem.eql(u8, key, "--sort-common")) { |
| ... | @@ -2347,9 +2337,7 @@ fn buildOutputType( | ... | @@ -2347,9 +2337,7 @@ fn buildOutputType( |
| 2347 | // variants of them. | 2337 | // variants of them. |
| 2348 | if (mem.eql(u8, key, "--build-id")) { | 2338 | if (mem.eql(u8, key, "--build-id")) { |
| 2349 | build_id = std.zig.BuildId.parse(value) catch |err| { | 2339 | build_id = std.zig.BuildId.parse(value) catch |err| { |
| 2350 | fatal("unable to parse --build-id style '{s}': {s}", .{ | 2340 | fatal("unable to parse --build-id style {q}: {t}", .{ value, err }); |
| 2351 | value, @errorName(err), | | |
| 2352 | }); | | |
| 2353 | }; | 2341 | }; |
| 2354 | continue; | 2342 | continue; |
| 2355 | } else if (mem.eql(u8, key, "--sort-common")) { | 2343 | } else if (mem.eql(u8, key, "--sort-common")) { |
| ... | @@ -2453,7 +2441,7 @@ fn buildOutputType( | ... | @@ -2453,7 +2441,7 @@ fn buildOutputType( |
| 2453 | linker_compress_debug_sections = .zlib; | 2441 | linker_compress_debug_sections = .zlib; |
| 2454 | } else { | 2442 | } else { |
| 2455 | linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, it.only_arg) orelse { | 2443 | 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}); |
| 2457 | }; | 2445 | }; |
| 2458 | } | 2446 | } |
| 2459 | }, | 2447 | }, |
| ... | @@ -2466,7 +2454,7 @@ fn buildOutputType( | ... | @@ -2466,7 +2454,7 @@ fn buildOutputType( |
| 2466 | } else if (mem.eql(u8, "error", it.only_arg)) { | 2454 | } else if (mem.eql(u8, "error", it.only_arg)) { |
| 2467 | linker_allow_shlib_undefined = false; | 2455 | linker_allow_shlib_undefined = false; |
| 2468 | } else { | 2456 | } else { |
| 2469 | fatal("unsupported -undefined option '{s}'", .{it.only_arg}); | 2457 | fatal("unsupported -undefined option {q}", .{it.only_arg}); |
| 2470 | } | 2458 | } |
| 2471 | }, | 2459 | }, |
| 2472 | .rtlib => { | 2460 | .rtlib => { |
| ... | @@ -2479,7 +2467,7 @@ fn buildOutputType( | ... | @@ -2479,7 +2467,7 @@ fn buildOutputType( |
| 2479 | want_compiler_rt = true; | 2467 | want_compiler_rt = true; |
| 2480 | } else { | 2468 | } else { |
| 2481 | // Note that we don't support `platform`. | 2469 | // 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}); |
| 2483 | } | 2471 | } |
| 2484 | }, | 2472 | }, |
| 2485 | .static => { | 2473 | .static => { |
| ... | @@ -2575,12 +2563,12 @@ fn buildOutputType( | ... | @@ -2575,12 +2563,12 @@ fn buildOutputType( |
| 2575 | } else if (mem.eql(u8, arg, "-pagezero_size")) { | 2563 | } else if (mem.eql(u8, arg, "-pagezero_size")) { |
| 2576 | const next_arg = linker_args_it.nextOrFatal(); | 2564 | const next_arg = linker_args_it.nextOrFatal(); |
| 2577 | pagezero_size = std.fmt.parseUnsigned(u64, eatIntPrefix(next_arg, 16), 16) catch |err| { | 2565 | 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 }); |
| 2579 | }; | 2567 | }; |
| 2580 | } else if (mem.eql(u8, arg, "-headerpad")) { | 2568 | } else if (mem.eql(u8, arg, "-headerpad")) { |
| 2581 | const next_arg = linker_args_it.nextOrFatal(); | 2569 | const next_arg = linker_args_it.nextOrFatal(); |
| 2582 | headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| { | 2570 | 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 }); |
| 2584 | }; | 2572 | }; |
| 2585 | } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { | 2573 | } else if (mem.eql(u8, arg, "-headerpad_max_install_names")) { |
| 2586 | headerpad_max_install_names = true; | 2574 | headerpad_max_install_names = true; |
| ... | @@ -2605,7 +2593,7 @@ fn buildOutputType( | ... | @@ -2605,7 +2593,7 @@ fn buildOutputType( |
| 2605 | } else if (mem.eql(u8, arg, "--sort-section")) { | 2593 | } else if (mem.eql(u8, arg, "--sort-section")) { |
| 2606 | const arg1 = linker_args_it.nextOrFatal(); | 2594 | const arg1 = linker_args_it.nextOrFatal(); |
| 2607 | linker_sort_section = std.meta.stringToEnum(link.File.Lld.Elf.SortSection, arg1) orelse { | 2595 | 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}); |
| 2609 | }; | 2597 | }; |
| 2610 | } else if (mem.eql(u8, arg, "--allow-shlib-undefined") or | 2598 | } else if (mem.eql(u8, arg, "--allow-shlib-undefined") or |
| 2611 | mem.eql(u8, arg, "-allow-shlib-undefined")) | 2599 | mem.eql(u8, arg, "-allow-shlib-undefined")) |
| ... | @@ -2632,26 +2620,26 @@ fn buildOutputType( | ... | @@ -2632,26 +2620,26 @@ fn buildOutputType( |
| 2632 | } else if (mem.eql(u8, arg, "--initial-memory")) { | 2620 | } else if (mem.eql(u8, arg, "--initial-memory")) { |
| 2633 | const next_arg = linker_args_it.nextOrFatal(); | 2621 | const next_arg = linker_args_it.nextOrFatal(); |
| 2634 | linker_initial_memory = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| { | 2622 | 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 }); |
| 2636 | }; | 2624 | }; |
| 2637 | } else if (mem.eql(u8, arg, "--max-memory")) { | 2625 | } else if (mem.eql(u8, arg, "--max-memory")) { |
| 2638 | const next_arg = linker_args_it.nextOrFatal(); | 2626 | const next_arg = linker_args_it.nextOrFatal(); |
| 2639 | linker_max_memory = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| { | 2627 | 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 }); |
| 2641 | }; | 2629 | }; |
| 2642 | } else if (mem.eql(u8, arg, "--shared-memory")) { | 2630 | } else if (mem.eql(u8, arg, "--shared-memory")) { |
| 2643 | create_module.opts.shared_memory = true; | 2631 | create_module.opts.shared_memory = true; |
| 2644 | } else if (mem.eql(u8, arg, "--global-base")) { | 2632 | } else if (mem.eql(u8, arg, "--global-base")) { |
| 2645 | const next_arg = linker_args_it.nextOrFatal(); | 2633 | const next_arg = linker_args_it.nextOrFatal(); |
| 2646 | linker_global_base = std.fmt.parseUnsigned(u32, next_arg, 10) catch |err| { | 2634 | 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 }); |
| 2648 | }; | 2636 | }; |
| 2649 | } else if (mem.eql(u8, arg, "--export")) { | 2637 | } else if (mem.eql(u8, arg, "--export")) { |
| 2650 | try linker_export_symbol_names.append(arena, linker_args_it.nextOrFatal()); | 2638 | try linker_export_symbol_names.append(arena, linker_args_it.nextOrFatal()); |
| 2651 | } else if (mem.eql(u8, arg, "-exported_symbols_list")) { | 2639 | } else if (mem.eql(u8, arg, "-exported_symbols_list")) { |
| 2652 | const exported_symbols_list = linker_args_it.nextOrFatal(); | 2640 | const exported_symbols_list = linker_args_it.nextOrFatal(); |
| 2653 | const content = Io.Dir.cwd().readFileAlloc(io, exported_symbols_list, arena, .limited(10 * 1024 * 1024)) catch |err| { | 2641 | 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 }); |
| 2655 | }; | 2643 | }; |
| 2656 | var symbols_it = mem.splitScalar(u8, content, '\n'); | 2644 | var symbols_it = mem.splitScalar(u8, content, '\n'); |
| 2657 | while (symbols_it.next()) |line| { | 2645 | while (symbols_it.next()) |line| { |
| ... | @@ -2661,7 +2649,7 @@ fn buildOutputType( | ... | @@ -2661,7 +2649,7 @@ fn buildOutputType( |
| 2661 | } else if (mem.eql(u8, arg, "--compress-debug-sections")) { | 2649 | } else if (mem.eql(u8, arg, "--compress-debug-sections")) { |
| 2662 | const arg1 = linker_args_it.nextOrFatal(); | 2650 | const arg1 = linker_args_it.nextOrFatal(); |
| 2663 | linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, arg1) orelse { | 2651 | 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}); |
| 2665 | }; | 2653 | }; |
| 2666 | } else if (mem.cutPrefix(u8, arg, "-z")) |z_rest| { | 2654 | } else if (mem.cutPrefix(u8, arg, "-z")) |z_rest| { |
| 2667 | const z_arg = if (z_rest.len == 0) linker_args_it.nextOrFatal() else z_rest; | 2655 | const z_arg = if (z_rest.len == 0) linker_args_it.nextOrFatal() else z_rest; |
| ... | @@ -2699,13 +2687,13 @@ fn buildOutputType( | ... | @@ -2699,13 +2687,13 @@ fn buildOutputType( |
| 2699 | } else if (mem.eql(u8, arg, "--major-image-version")) { | 2687 | } else if (mem.eql(u8, arg, "--major-image-version")) { |
| 2700 | const major = linker_args_it.nextOrFatal(); | 2688 | const major = linker_args_it.nextOrFatal(); |
| 2701 | version.major = std.fmt.parseUnsigned(u32, major, 10) catch |err| { | 2689 | 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 }); |
| 2703 | }; | 2691 | }; |
| 2704 | have_version = true; | 2692 | have_version = true; |
| 2705 | } else if (mem.eql(u8, arg, "--minor-image-version")) { | 2693 | } else if (mem.eql(u8, arg, "--minor-image-version")) { |
| 2706 | const minor = linker_args_it.nextOrFatal(); | 2694 | const minor = linker_args_it.nextOrFatal(); |
| 2707 | version.minor = std.fmt.parseUnsigned(u32, minor, 10) catch |err| { | 2695 | 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 }); |
| 2709 | }; | 2697 | }; |
| 2710 | have_version = true; | 2698 | have_version = true; |
| 2711 | } else if (mem.eql(u8, arg, "-e") or mem.eql(u8, arg, "--entry")) { | 2699 | } else if (mem.eql(u8, arg, "-e") or mem.eql(u8, arg, "--entry")) { |
| ... | @@ -2781,16 +2769,12 @@ fn buildOutputType( | ... | @@ -2781,16 +2769,12 @@ fn buildOutputType( |
| 2781 | } else if (mem.eql(u8, arg, "--major-subsystem-version")) { | 2769 | } else if (mem.eql(u8, arg, "--major-subsystem-version")) { |
| 2782 | const major = linker_args_it.nextOrFatal(); | 2770 | const major = linker_args_it.nextOrFatal(); |
| 2783 | major_subsystem_version = std.fmt.parseUnsigned(u16, major, 10) catch |err| { | 2771 | major_subsystem_version = std.fmt.parseUnsigned(u16, major, 10) catch |err| { |
| 2784 | fatal("unable to parse major subsystem version '{s}': {s}", .{ | 2772 | fatal("unable to parse major subsystem version {q}: {t}", .{ major, err }); |
| 2785 | major, @errorName(err), | | |
| 2786 | }); | | |
| 2787 | }; | 2773 | }; |
| 2788 | } else if (mem.eql(u8, arg, "--minor-subsystem-version")) { | 2774 | } else if (mem.eql(u8, arg, "--minor-subsystem-version")) { |
| 2789 | const minor = linker_args_it.nextOrFatal(); | 2775 | const minor = linker_args_it.nextOrFatal(); |
| 2790 | minor_subsystem_version = std.fmt.parseUnsigned(u16, minor, 10) catch |err| { | 2776 | minor_subsystem_version = std.fmt.parseUnsigned(u16, minor, 10) catch |err| { |
| 2791 | fatal("unable to parse minor subsystem version '{s}': {s}", .{ | 2777 | fatal("unable to parse minor subsystem version {q}: {t}", .{ minor, err }); |
| 2792 | minor, @errorName(err), | | |
| 2793 | }); | | |
| 2794 | }; | 2778 | }; |
| 2795 | } else if (mem.eql(u8, arg, "-framework")) { | 2779 | } else if (mem.eql(u8, arg, "-framework")) { |
| 2796 | try create_module.frameworks.put(arena, linker_args_it.nextOrFatal(), .{}); | 2780 | try create_module.frameworks.put(arena, linker_args_it.nextOrFatal(), .{}); |
| ... | @@ -2834,12 +2818,12 @@ fn buildOutputType( | ... | @@ -2834,12 +2818,12 @@ fn buildOutputType( |
| 2834 | } else if (mem.eql(u8, arg, "-compatibility_version")) { | 2818 | } else if (mem.eql(u8, arg, "-compatibility_version")) { |
| 2835 | const compat_version = linker_args_it.nextOrFatal(); | 2819 | const compat_version = linker_args_it.nextOrFatal(); |
| 2836 | compatibility_version = std.SemanticVersion.parse(compat_version) catch |err| { | 2820 | 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 }); |
| 2838 | }; | 2822 | }; |
| 2839 | } else if (mem.eql(u8, arg, "-current_version")) { | 2823 | } else if (mem.eql(u8, arg, "-current_version")) { |
| 2840 | const curr_version = linker_args_it.nextOrFatal(); | 2824 | const curr_version = linker_args_it.nextOrFatal(); |
| 2841 | version = std.SemanticVersion.parse(curr_version) catch |err| { | 2825 | 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 }); |
| 2843 | }; | 2827 | }; |
| 2844 | have_version = true; | 2828 | have_version = true; |
| 2845 | } else if (mem.eql(u8, arg, "--out-implib") or | 2829 | } else if (mem.eql(u8, arg, "--out-implib") or |
| ... | @@ -2858,7 +2842,7 @@ fn buildOutputType( | ... | @@ -2858,7 +2842,7 @@ fn buildOutputType( |
| 2858 | } else if (mem.eql(u8, "error", lookup_type)) { | 2842 | } else if (mem.eql(u8, "error", lookup_type)) { |
| 2859 | linker_allow_shlib_undefined = false; | 2843 | linker_allow_shlib_undefined = false; |
| 2860 | } else { | 2844 | } else { |
| 2861 | fatal("unsupported -undefined option '{s}'", .{lookup_type}); | 2845 | fatal("unsupported -undefined option {q}", .{lookup_type}); |
| 2862 | } | 2846 | } |
| 2863 | } else if (mem.eql(u8, arg, "-install_name")) { | 2847 | } else if (mem.eql(u8, arg, "-install_name")) { |
| 2864 | install_name = linker_args_it.nextOrFatal(); | 2848 | install_name = linker_args_it.nextOrFatal(); |
| ... | @@ -2876,9 +2860,7 @@ fn buildOutputType( | ... | @@ -2876,9 +2860,7 @@ fn buildOutputType( |
| 2876 | { | 2860 | { |
| 2877 | const next_arg = linker_args_it.nextOrFatal(); | 2861 | const next_arg = linker_args_it.nextOrFatal(); |
| 2878 | hash_style = std.meta.stringToEnum(link.File.Lld.Elf.HashStyle, next_arg) orelse { | 2862 | hash_style = std.meta.stringToEnum(link.File.Lld.Elf.HashStyle, next_arg) orelse { |
| 2879 | fatal("expected [sysv|gnu|both] after --hash-style, found '{s}'", .{ | 2863 | fatal("expected [sysv|gnu|both] after --hash-style, found {q}", .{next_arg}); |
| 2880 | next_arg, | | |
| 2881 | }); | | |
| 2882 | }; | 2864 | }; |
| 2883 | } else if (mem.eql(u8, arg, "-wrap")) { | 2865 | } else if (mem.eql(u8, arg, "-wrap")) { |
| 2884 | const next_arg = linker_args_it.nextOrFatal(); | 2866 | const next_arg = linker_args_it.nextOrFatal(); |
| ... | @@ -2897,7 +2879,7 @@ fn buildOutputType( | ... | @@ -2897,7 +2879,7 @@ fn buildOutputType( |
| 2897 | var split_it = mem.splitBackwardsScalar(u8, arg, ':'); | 2879 | var split_it = mem.splitBackwardsScalar(u8, arg, ':'); |
| 2898 | const version_arg = split_it.first(); | 2880 | const version_arg = split_it.first(); |
| 2899 | version = std.SemanticVersion.parse(version_arg) catch |err| { | 2881 | 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 }); |
| 2901 | }; | 2883 | }; |
| 2902 | have_version = true; | 2884 | have_version = true; |
| 2903 | } else if (mem.eql(u8, arg, "-V")) { | 2885 | } else if (mem.eql(u8, arg, "-V")) { |
| ... | @@ -3054,7 +3036,7 @@ fn buildOutputType( | ... | @@ -3054,7 +3036,7 @@ fn buildOutputType( |
| 3054 | const src_path = b: { | 3036 | const src_path = b: { |
| 3055 | if (root_src_file) |src_path| { | 3037 | if (root_src_file) |src_path| { |
| 3056 | if (create_module.modules.count() != 0) { | 3038 | 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}", .{ |
| 3058 | create_module.modules.keys()[0], | 3040 | create_module.modules.keys()[0], |
| 3059 | create_module.modules.values()[0].root_path, | 3041 | create_module.modules.values()[0].root_path, |
| 3060 | fs.path.sep, | 3042 | fs.path.sep, |
| ... | @@ -3147,13 +3129,13 @@ fn buildOutputType( | ... | @@ -3147,13 +3129,13 @@ fn buildOutputType( |
| 3147 | } | 3129 | } |
| 3148 | | 3130 | |
| 3149 | if (c_source_files_owner_index != create_module.c_source_files.items.len) { | 3131 | 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", .{ |
| 3151 | create_module.c_source_files.items[c_source_files_owner_index].src_path, | 3133 | create_module.c_source_files.items[c_source_files_owner_index].src_path, |
| 3152 | }); | 3134 | }); |
| 3153 | } | 3135 | } |
| 3154 | | 3136 | |
| 3155 | if (rc_source_files_owner_index != create_module.rc_source_files.items.len) { | 3137 | 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", .{ |
| 3157 | create_module.rc_source_files.items[rc_source_files_owner_index].src_path, | 3139 | create_module.rc_source_files.items[rc_source_files_owner_index].src_path, |
| 3158 | }); | 3140 | }); |
| 3159 | } | 3141 | } |
| ... | @@ -3185,7 +3167,7 @@ fn buildOutputType( | ... | @@ -3185,7 +3167,7 @@ fn buildOutputType( |
| 3185 | ); | 3167 | ); |
| 3186 | defer dirs.deinit(io); | 3168 | defer dirs.deinit(io); |
| 3187 | | 3169 | |
| 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}); |
| 3189 | | 3171 | |
| 3190 | create_module.dirs = dirs; | 3172 | create_module.dirs = dirs; |
| 3191 | create_module.opts.emit_llvm_ir = emit_llvm_ir != .no; | 3173 | create_module.opts.emit_llvm_ir = emit_llvm_ir != .no; |
| ... | @@ -3196,7 +3178,7 @@ fn buildOutputType( | ... | @@ -3196,7 +3178,7 @@ fn buildOutputType( |
| 3196 | const main_mod = try createModule(gpa, arena, io, &create_module, 0, null, color, environ_map); | 3178 | const main_mod = try createModule(gpa, arena, io, &create_module, 0, null, color, environ_map); |
| 3197 | for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { | 3179 | for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { |
| 3198 | if (cli_mod.resolved == null) | 3180 | if (cli_mod.resolved == null) |
| 3199 | fatal("module '{s}' declared but not used", .{key}); | 3181 | fatal("module {q} declared but not used", .{key}); |
| 3200 | } | 3182 | } |
| 3201 | | 3183 | |
| 3202 | // When you're testing std, the main module is std, and we need to avoid duplicating the module. | 3184 | // When you're testing std, the main module is std, and we need to avoid duplicating the module. |
| ... | @@ -3319,7 +3301,7 @@ fn buildOutputType( | ... | @@ -3319,7 +3301,7 @@ fn buildOutputType( |
| 3319 | if (failed_frameworks.items.len > 0) { | 3301 | if (failed_frameworks.items.len > 0) { |
| 3320 | for (failed_frameworks.items) |f| { | 3302 | for (failed_frameworks.items) |f| { |
| 3321 | const searched_paths = if (f.checked_paths.len == 0) " none" else f.checked_paths; | 3303 | 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}", .{ |
| 3323 | f.name, searched_paths, | 3305 | f.name, searched_paths, |
| 3324 | }); | 3306 | }); |
| 3325 | } | 3307 | } |
| ... | @@ -3390,12 +3372,12 @@ fn buildOutputType( | ... | @@ -3390,12 +3372,12 @@ fn buildOutputType( |
| 3390 | }, | 3372 | }, |
| 3391 | .yes => |path| if (output_to_cache != null) { | 3373 | .yes => |path| if (output_to_cache != null) { |
| 3392 | assert(output_to_cache == .listen); // there was an explicit bin path | 3374 | 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}); |
| 3394 | } else emit: { | 3376 | } else emit: { |
| 3395 | // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would. | 3377 | // If there's a dirname, check that dir exists. This will give a more descriptive error than `Compilation` otherwise would. |
| 3396 | if (fs.path.dirname(path)) |dir_path| { | 3378 | if (fs.path.dirname(path)) |dir_path| { |
| 3397 | var dir = Io.Dir.cwd().openDir(io, dir_path, .{}) catch |err| { | 3379 | 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 }); |
| 3399 | }; | 3381 | }; |
| 3400 | dir.close(io); | 3382 | dir.close(io); |
| 3401 | } | 3383 | } |
| ... | @@ -3672,7 +3654,7 @@ fn buildOutputType( | ... | @@ -3672,7 +3654,7 @@ fn buildOutputType( |
| 3672 | .cross_libc_unavailable => { | 3654 | .cross_libc_unavailable => { |
| 3673 | // We can emit a more informative error for this. | 3655 | // We can emit a more informative error for this. |
| 3674 | const triple_name = try target.zigTriple(arena); | 3656 | 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}); |
| 3676 | | 3658 | |
| 3677 | for (std.zig.target.available_libcs) |t| { | 3659 | for (std.zig.target.available_libcs) |t| { |
| 3678 | if (t.arch == target.cpu.arch and t.os == target.os.tag) { | 3660 | if (t.arch == target.cpu.arch and t.os == target.os.tag) { |
| ... | @@ -3929,16 +3911,16 @@ fn createModule( | ... | @@ -3929,16 +3911,16 @@ fn createModule( |
| 3929 | for (create_module.llvm_m_args.items) |llvm_m_arg| { | 3911 | for (create_module.llvm_m_args.items) |llvm_m_arg| { |
| 3930 | if (mem.cutPrefix(u8, llvm_m_arg, "mno-")) |llvm_name| { | 3912 | if (mem.cutPrefix(u8, llvm_m_arg, "mno-")) |llvm_name| { |
| 3931 | const zig_name = llvm_to_zig_name.get(llvm_name) orelse { | 3913 | const zig_name = llvm_to_zig_name.get(llvm_name) orelse { |
| 3932 | fatal("target architecture {s} has no LLVM CPU feature named '{s}'", .{ | 3914 | fatal("target architecture {t} has no LLVM CPU feature named {q}", .{ |
| 3933 | @tagName(cpu_arch), llvm_name, | 3915 | cpu_arch, llvm_name, |
| 3934 | }); | 3916 | }); |
| 3935 | }; | 3917 | }; |
| 3936 | try mcpu_buffer.append('-'); | 3918 | try mcpu_buffer.append('-'); |
| 3937 | try mcpu_buffer.appendSlice(zig_name); | 3919 | try mcpu_buffer.appendSlice(zig_name); |
| 3938 | } else if (mem.cutPrefix(u8, llvm_m_arg, "m")) |llvm_name| { | 3920 | } else if (mem.cutPrefix(u8, llvm_m_arg, "m")) |llvm_name| { |
| 3939 | const zig_name = llvm_to_zig_name.get(llvm_name) orelse { | 3921 | const zig_name = llvm_to_zig_name.get(llvm_name) orelse { |
| 3940 | fatal("target architecture {s} has no LLVM CPU feature named '{s}'", .{ | 3922 | fatal("target architecture {t} has no LLVM CPU feature named {q}", .{ |
| 3941 | @tagName(cpu_arch), llvm_name, | 3923 | cpu_arch, llvm_name, |
| 3942 | }); | 3924 | }); |
| 3943 | }; | 3925 | }; |
| 3944 | try mcpu_buffer.append('+'); | 3926 | try mcpu_buffer.append('+'); |
| ... | @@ -4173,16 +4155,16 @@ fn createModule( | ... | @@ -4173,16 +4155,16 @@ fn createModule( |
| 4173 | .global = create_module.resolved_options, | 4155 | .global = create_module.resolved_options, |
| 4174 | .parent = parent, | 4156 | .parent = parent, |
| 4175 | }) catch |err| switch (err) { | 4157 | }) catch |err| switch (err) { |
| 4176 | error.ValgrindUnsupportedOnTarget => fatal("unable to create module '{s}': valgrind does not support the selected target CPU architecture", .{name}), | 4158 | error.ValgrindUnsupportedOnTarget => fatal("unable to create module {q}: 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}), | 4159 | error.TargetRequiresSingleThreaded => fatal("unable to create module {q}: 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}), | 4160 | error.BackendRequiresSingleThreaded => fatal("unable to create module {q}: 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}), | 4161 | error.TargetRequiresPic => fatal("unable to create module {q}: 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}), | 4162 | error.PieRequiresPic => fatal("unable to create module {q}: 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}), | 4163 | error.DynamicLinkingRequiresPic => fatal("unable to create module {q}: 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}), | 4164 | error.TargetHasNoRedZone => fatal("unable to create module {q}: 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}), | 4165 | error.StackCheckUnsupportedByTarget => fatal("unable to create module {q}: 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}), | 4166 | error.StackProtectorUnsupportedByTarget => fatal("unable to create module {q}: the selected target does not support stack protection", .{name}), |
| 4185 | error.StackProtectorUnavailableWithoutLibC => fatal("unable to create module '{s}': enabling stack protection requires libc", .{name}), | 4167 | error.StackProtectorUnavailableWithoutLibC => fatal("unable to create module {q}: enabling stack protection requires libc", .{name}), |
| 4186 | error.OutOfMemory => |e| return e, | 4168 | error.OutOfMemory => |e| return e, |
| 4187 | }; | 4169 | }; |
| 4188 | cli_mod.resolved = mod; | 4170 | cli_mod.resolved = mod; |
| ... | @@ -4193,7 +4175,7 @@ fn createModule( | ... | @@ -4193,7 +4175,7 @@ fn createModule( |
| 4193 | | 4175 | |
| 4194 | for (cli_mod.deps) |dep| { | 4176 | for (cli_mod.deps) |dep| { |
| 4195 | const dep_index = create_module.modules.getIndex(dep.value) orelse | 4177 | 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 }); |
| 4197 | const dep_mod = try createModule(gpa, arena, io, create_module, dep_index, mod, color, environ_map); | 4179 | const dep_mod = try createModule(gpa, arena, io, create_module, dep_index, mod, color, environ_map); |
| 4198 | try mod.deps.put(arena, dep.key, dep_mod); | 4180 | try mod.deps.put(arena, dep.key, dep_mod); |
| 4199 | } | 4181 | } |
| ... | @@ -4707,7 +4689,7 @@ fn cmdTranslateC( | ... | @@ -4707,7 +4689,7 @@ fn cmdTranslateC( |
| 4707 | | 4689 | |
| 4708 | man.hash.add(@as(u16, 0xb945)); // Random number to distinguish translate-c from compiling C objects | 4690 | man.hash.add(@as(u16, 0xb945)); // Random number to distinguish translate-c from compiling C objects |
| 4709 | Compilation.cache_helpers.hashCSource(&man, c_source_file) catch |err| | 4691 | 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 }); |
| 4711 | | 4693 | |
| 4712 | const result: Compilation.TranslateCResult = if (try man.hit()) .{ | 4694 | const result: Compilation.TranslateCResult = if (try man.hit()) .{ |
| 4713 | .digest = man.finalBin(), | 4695 | .digest = man.finalBin(), |
| ... | @@ -4809,10 +4791,10 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! | ... | @@ -4809,10 +4791,10 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! |
| 4809 | try Io.File.stdout().writeStreamingAll(io, usage_init); | 4791 | try Io.File.stdout().writeStreamingAll(io, usage_init); |
| 4810 | return cleanExit(io); | 4792 | return cleanExit(io); |
| 4811 | } else { | 4793 | } else { |
| 4812 | fatal("unrecognized parameter: '{s}'", .{arg}); | 4794 | fatal("unrecognized parameter: {q}", .{arg}); |
| 4813 | } | 4795 | } |
| 4814 | } else { | 4796 | } else { |
| 4815 | fatal("unexpected extra parameter: '{s}'", .{arg}); | 4797 | fatal("unexpected extra parameter: {q}", .{arg}); |
| 4816 | } | 4798 | } |
| 4817 | } | 4799 | } |
| 4818 | } | 4800 | } |
| ... | @@ -4870,8 +4852,8 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! | ... | @@ -4870,8 +4852,8 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! |
| 4870 | build_options.version, | 4852 | build_options.version, |
| 4871 | fingerprint.int(), | 4853 | fingerprint.int(), |
| 4872 | }) catch |err| switch (err) { | 4854 | }) catch |err| switch (err) { |
| 4873 | else => fatal("failed to create '{s}': {s}", .{ Package.Manifest.basename, @errorName(err) }), | 4855 | else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }), |
| 4874 | error.PathAlreadyExists => fatal("refusing to overwrite '{s}'", .{Package.Manifest.basename}), | 4856 | error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}), |
| 4875 | }; | 4857 | }; |
| 4876 | writeSimpleTemplateFile(io, Package.build_zig_basename, | 4858 | writeSimpleTemplateFile(io, Package.build_zig_basename, |
| 4877 | \\const std = @import("std"); | 4859 | \\const std = @import("std"); |
| ... | @@ -4881,15 +4863,17 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! | ... | @@ -4881,15 +4863,17 @@ fn cmdInit(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) ! |
| 4881 | \\}} | 4863 | \\}} |
| 4882 | \\ | 4864 | \\ |
| 4883 | , .{}) catch |err| switch (err) { | 4865 | , .{}) 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 }), |
| 4885 | // `build.zig` already existing is okay: the user has just used `zig init` to set up | 4867 | // `build.zig` already existing is okay: the user has just used `zig init` to set up |
| 4886 | // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal. | 4868 | // their `build.zig.zon` *after* writing their `build.zig`. So this one isn't fatal. |
| 4887 | error.PathAlreadyExists => { | 4869 | 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 | }); |
| 4889 | return cleanExit(io); | 4873 | return cleanExit(io); |
| 4890 | }, | 4874 | }, |
| 4891 | }; | 4875 | }; |
| 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 }); |
| 4893 | return cleanExit(io); | 4877 | return cleanExit(io); |
| 4894 | }, | 4878 | }, |
| 4895 | } | 4879 | } |
| ... | @@ -5023,7 +5007,7 @@ fn cmdBuild( | ... | @@ -5023,7 +5007,7 @@ fn cmdBuild( |
| 5023 | configure_argv.appendAssumeCapacity(arg); | 5007 | configure_argv.appendAssumeCapacity(arg); |
| 5024 | continue; | 5008 | continue; |
| 5025 | } else if (mem.eql(u8, arg, "--system")) { | 5009 | } 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}); |
| 5027 | i += 1; | 5011 | i += 1; |
| 5028 | system_pkg_dir_path = args[i]; | 5012 | system_pkg_dir_path = args[i]; |
| 5029 | | 5013 | |
| ... | @@ -5032,7 +5016,7 @@ fn cmdBuild( | ... | @@ -5032,7 +5016,7 @@ fn cmdBuild( |
| 5032 | continue; | 5016 | continue; |
| 5033 | } else if (mem.cutPrefix(u8, arg, "--color=")) |rest| { | 5017 | } else if (mem.cutPrefix(u8, arg, "--color=")) |rest| { |
| 5034 | color = std.meta.stringToEnum(Color, rest) orelse | 5018 | 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}); |
| 5036 | | 5020 | |
| 5037 | try cached_passthru_configure.append(arena, @intCast(configure_argv.items.len)); | 5021 | try cached_passthru_configure.append(arena, @intCast(configure_argv.items.len)); |
| 5038 | configure_argv.appendAssumeCapacity(arg); | 5022 | configure_argv.appendAssumeCapacity(arg); |
| ... | @@ -5053,7 +5037,7 @@ fn cmdBuild( | ... | @@ -5053,7 +5037,7 @@ fn cmdBuild( |
| 5053 | // does not go into the cache hash. | 5037 | // does not go into the cache hash. |
| 5054 | configure_argv.appendAssumeCapacity(arg); | 5038 | configure_argv.appendAssumeCapacity(arg); |
| 5055 | } else if (mem.eql(u8, arg, "--search-prefix")) { | 5039 | } 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}); |
| 5057 | i += 1; | 5041 | i += 1; |
| 5058 | // This argument is cache poisonous: it does not go into | 5042 | // This argument is cache poisonous: it does not go into |
| 5059 | // the cache and configurer must set the poison bit when | 5043 | // the cache and configurer must set the poison bit when |
| ... | @@ -5062,27 +5046,27 @@ fn cmdBuild( | ... | @@ -5062,27 +5046,27 @@ fn cmdBuild( |
| 5062 | (try make_argv.addManyAsArray(arena, 2)).* = .{ arg, args[i] }; | 5046 | (try make_argv.addManyAsArray(arena, 2)).* = .{ arg, args[i] }; |
| 5063 | continue; | 5047 | continue; |
| 5064 | } else if (mem.eql(u8, arg, "--build-file")) { | 5048 | } 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}); |
| 5066 | i += 1; | 5050 | i += 1; |
| 5067 | build_file = args[i]; | 5051 | build_file = args[i]; |
| 5068 | continue; | 5052 | continue; |
| 5069 | } else if (mem.eql(u8, arg, "--zig-lib-dir")) { | 5053 | } 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}); |
| 5071 | i += 1; | 5055 | i += 1; |
| 5072 | override_lib_dir = args[i]; | 5056 | override_lib_dir = args[i]; |
| 5073 | continue; | 5057 | continue; |
| 5074 | } else if (mem.eql(u8, arg, "--cache-dir")) { | 5058 | } 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}); |
| 5076 | i += 1; | 5060 | i += 1; |
| 5077 | override_local_cache_dir = args[i]; | 5061 | override_local_cache_dir = args[i]; |
| 5078 | continue; | 5062 | continue; |
| 5079 | } else if (mem.eql(u8, arg, "--pkg-dir")) { | 5063 | } 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}); |
| 5081 | i += 1; | 5065 | i += 1; |
| 5082 | override_pkg_dir = args[i]; | 5066 | override_pkg_dir = args[i]; |
| 5083 | continue; | 5067 | continue; |
| 5084 | } else if (mem.eql(u8, arg, "--global-cache-dir")) { | 5068 | } 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}); |
| 5086 | i += 1; | 5070 | i += 1; |
| 5087 | override_global_cache_dir = args[i]; | 5071 | override_global_cache_dir = args[i]; |
| 5088 | continue; | 5072 | continue; |
| ... | @@ -5093,7 +5077,7 @@ fn cmdBuild( | ... | @@ -5093,7 +5077,7 @@ fn cmdBuild( |
| 5093 | } else if (mem.cutPrefix(u8, arg, "--fetch=")) |sub_arg| { | 5077 | } else if (mem.cutPrefix(u8, arg, "--fetch=")) |sub_arg| { |
| 5094 | fetch_only = true; | 5078 | fetch_only = true; |
| 5095 | fetch_mode = std.meta.stringToEnum(Package.Fetch.JobQueue.Mode, sub_arg) orelse | 5079 | 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}); |
| 5097 | } else if (mem.cutPrefix(u8, arg, "--fork=")) |sub_arg| { | 5081 | } else if (mem.cutPrefix(u8, arg, "--fork=")) |sub_arg| { |
| 5098 | try forks.append(arena, .init(sub_arg)); | 5082 | try forks.append(arena, .init(sub_arg)); |
| 5099 | continue; | 5083 | continue; |
| ... | @@ -5104,7 +5088,7 @@ fn cmdBuild( | ... | @@ -5104,7 +5088,7 @@ fn cmdBuild( |
| 5104 | continue; | 5088 | continue; |
| 5105 | } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| { | 5089 | } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| { |
| 5106 | reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| { | 5090 | 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 }); |
| 5108 | }; | 5092 | }; |
| 5109 | } else if (mem.eql(u8, arg, "-fno-reference-trace")) { | 5093 | } else if (mem.eql(u8, arg, "-fno-reference-trace")) { |
| 5110 | reference_trace = null; | 5094 | reference_trace = null; |
| ... | @@ -5112,7 +5096,7 @@ fn cmdBuild( | ... | @@ -5112,7 +5096,7 @@ fn cmdBuild( |
| 5112 | maker_optimize_mode = parseOptimizeMode(rest); | 5096 | maker_optimize_mode = parseOptimizeMode(rest); |
| 5113 | continue; | 5097 | continue; |
| 5114 | } else if (mem.eql(u8, arg, "--debug-log")) { | 5098 | } 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}); |
| 5116 | try make_argv.appendSlice(arena, args[i .. i + 2]); | 5100 | try make_argv.appendSlice(arena, args[i .. i + 2]); |
| 5117 | i += 1; | 5101 | i += 1; |
| 5118 | try addDebugLog(arena, args[i]); | 5102 | try addDebugLog(arena, args[i]); |
| ... | @@ -5124,7 +5108,7 @@ fn cmdBuild( | ... | @@ -5124,7 +5108,7 @@ fn cmdBuild( |
| 5124 | warn("Zig was compiled without debug extensions. --debug-compile-errors has no effect.", .{}); | 5108 | warn("Zig was compiled without debug extensions. --debug-compile-errors has no effect.", .{}); |
| 5125 | } | 5109 | } |
| 5126 | } else if (mem.eql(u8, arg, "--debug-target")) { | 5110 | } 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}); |
| 5128 | i += 1; | 5112 | i += 1; |
| 5129 | if (build_options.enable_debug_extensions) { | 5113 | if (build_options.enable_debug_extensions) { |
| 5130 | debug_target = args[i]; | 5114 | debug_target = args[i]; |
| ... | @@ -5133,7 +5117,7 @@ fn cmdBuild( | ... | @@ -5133,7 +5117,7 @@ fn cmdBuild( |
| 5133 | } | 5117 | } |
| 5134 | continue; | 5118 | continue; |
| 5135 | } else if (mem.eql(u8, arg, "--debug-libc")) { | 5119 | } 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}); |
| 5137 | i += 1; | 5121 | i += 1; |
| 5138 | if (build_options.enable_debug_extensions) { | 5122 | if (build_options.enable_debug_extensions) { |
| 5139 | debug_libc_paths_file = args[i]; | 5123 | debug_libc_paths_file = args[i]; |
| ... | @@ -5167,7 +5151,7 @@ fn cmdBuild( | ... | @@ -5167,7 +5151,7 @@ fn cmdBuild( |
| 5167 | } | 5151 | } |
| 5168 | n_jobs = num; | 5152 | n_jobs = num; |
| 5169 | } else if (mem.eql(u8, arg, "--seed")) { | 5153 | } 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}); |
| 5171 | i += 1; | 5155 | i += 1; |
| 5172 | make_argv.items[argv_index_seed] = args[i]; | 5156 | make_argv.items[argv_index_seed] = args[i]; |
| 5173 | continue; | 5157 | continue; |
| ... | @@ -5689,7 +5673,7 @@ fn cmdBuild( | ... | @@ -5689,7 +5673,7 @@ fn cmdBuild( |
| 5689 | const hash = hash_string.slice(&configuration); | 5673 | const hash = hash_string.slice(&configuration); |
| 5690 | assert(hash.len != 0); | 5674 | assert(hash.len != 0); |
| 5691 | if (hash.len > Package.Hash.max_len) { | 5675 | 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 }); |
| 5693 | any_errors = true; | 5677 | any_errors = true; |
| 5694 | continue; | 5678 | continue; |
| 5695 | } | 5679 | } |
| ... | @@ -5808,7 +5792,7 @@ const MakeRunner = struct { | ... | @@ -5808,7 +5792,7 @@ const MakeRunner = struct { |
| 5808 | }; | 5792 | }; |
| 5809 | | 5793 | |
| 5810 | fn compileMakeRunner(gpa: Allocator, arena: Allocator, io: Io, options: MakeRunner.Options) !MakeRunner { | 5794 | fn 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); |
| 5812 | defer compile_prog_node.end(); | 5796 | defer compile_prog_node.end(); |
| 5813 | | 5797 | |
| 5814 | const strip = options.optimize_mode != .Debug; | 5798 | const strip = options.optimize_mode != .Debug; |
| ... | @@ -6367,7 +6351,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6367,7 +6351,7 @@ pub const ClangArgIterator = struct { |
| 6367 | const resp_file_path = arg[1..]; | 6351 | const resp_file_path = arg[1..]; |
| 6368 | | 6352 | |
| 6369 | self.arg_iterator_response_file = initArgIteratorResponseFile(arena, io, resp_file_path) catch |err| | 6353 | 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 }); |
| 6371 | // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an | 6355 | // NOTE: The ArgIteratorResponseFile returns tokens from next() that are slices of an |
| 6372 | // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here. | 6356 | // internal buffer. This internal buffer is arena allocated, so it is not cleaned up here. |
| 6373 | | 6357 | |
| ... | @@ -6435,7 +6419,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6435,7 +6419,7 @@ pub const ClangArgIterator = struct { |
| 6435 | const prefix_len = clang_arg.matchStartsWith(arg); | 6419 | const prefix_len = clang_arg.matchStartsWith(arg); |
| 6436 | if (prefix_len == arg.len) { | 6420 | if (prefix_len == arg.len) { |
| 6437 | if (self.next_index >= self.argv.len) { | 6421 | if (self.next_index >= self.argv.len) { |
| 6438 | fatal("Expected parameter after '{s}'", .{arg}); | 6422 | fatal("Expected parameter after {q}", .{arg}); |
| 6439 | } | 6423 | } |
| 6440 | self.only_arg = self.argv[self.next_index]; | 6424 | self.only_arg = self.argv[self.next_index]; |
| 6441 | self.incrementArgIndex(); | 6425 | self.incrementArgIndex(); |
| ... | @@ -6456,7 +6440,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6456,7 +6440,7 @@ pub const ClangArgIterator = struct { |
| 6456 | if (prefix_len != 0) { | 6440 | if (prefix_len != 0) { |
| 6457 | self.only_arg = arg[prefix_len..]; | 6441 | self.only_arg = arg[prefix_len..]; |
| 6458 | if (self.next_index >= self.argv.len) { | 6442 | if (self.next_index >= self.argv.len) { |
| 6459 | fatal("Expected parameter after '{s}'", .{arg}); | 6443 | fatal("Expected parameter after {q}", .{arg}); |
| 6460 | } | 6444 | } |
| 6461 | self.second_arg = self.argv[self.next_index]; | 6445 | self.second_arg = self.argv[self.next_index]; |
| 6462 | self.incrementArgIndex(); | 6446 | self.incrementArgIndex(); |
| ... | @@ -6467,7 +6451,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6467,7 +6451,7 @@ pub const ClangArgIterator = struct { |
| 6467 | }, | 6451 | }, |
| 6468 | .separate => if (clang_arg.matchEql(arg) > 0) { | 6452 | .separate => if (clang_arg.matchEql(arg) > 0) { |
| 6469 | if (self.next_index >= self.argv.len) { | 6453 | if (self.next_index >= self.argv.len) { |
| 6470 | fatal("Expected parameter after '{s}'", .{arg}); | 6454 | fatal("expected parameter after {q}", .{arg}); |
| 6471 | } | 6455 | } |
| 6472 | self.only_arg = self.argv[self.next_index]; | 6456 | self.only_arg = self.argv[self.next_index]; |
| 6473 | self.incrementArgIndex(); | 6457 | self.incrementArgIndex(); |
| ... | @@ -6492,7 +6476,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6492,7 +6476,7 @@ pub const ClangArgIterator = struct { |
| 6492 | break :find_clang_arg; | 6476 | break :find_clang_arg; |
| 6493 | }, | 6477 | }, |
| 6494 | } else { | 6478 | } else { |
| 6495 | fatal("Unknown Clang option: '{s}'", .{arg}); | 6479 | fatal("unknown clang option: {q}", .{arg}); |
| 6496 | } | 6480 | } |
| 6497 | } | 6481 | } |
| 6498 | | 6482 | |
| ... | @@ -6520,7 +6504,7 @@ pub const ClangArgIterator = struct { | ... | @@ -6520,7 +6504,7 @@ pub const ClangArgIterator = struct { |
| 6520 | | 6504 | |
| 6521 | fn parseCodeModel(arg: []const u8) std.lang.CodeModel { | 6505 | fn parseCodeModel(arg: []const u8) std.lang.CodeModel { |
| 6522 | return std.meta.stringToEnum(std.lang.CodeModel, arg) orelse | 6506 | 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}); |
| 6524 | } | 6508 | } |
| 6525 | | 6509 | |
| 6526 | const usage_ast_check = | 6510 | const usage_ast_check = |
| ... | @@ -6569,15 +6553,15 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map: | ... | @@ -6569,15 +6553,15 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map: |
| 6569 | i += 1; | 6553 | i += 1; |
| 6570 | const next_arg = args[i]; | 6554 | const next_arg = args[i]; |
| 6571 | color = std.meta.stringToEnum(Color, next_arg) orelse { | 6555 | 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}); |
| 6573 | }; | 6557 | }; |
| 6574 | } else { | 6558 | } else { |
| 6575 | fatal("unrecognized parameter: '{s}'", .{arg}); | 6559 | fatal("unrecognized parameter: {q}", .{arg}); |
| 6576 | } | 6560 | } |
| 6577 | } else if (zig_source_path == null) { | 6561 | } else if (zig_source_path == null) { |
| 6578 | zig_source_path = arg; | 6562 | zig_source_path = arg; |
| 6579 | } else { | 6563 | } else { |
| 6580 | fatal("extra positional parameter: '{s}'", .{arg}); | 6564 | fatal("extra positional parameter: {q}", .{arg}); |
| 6581 | } | 6565 | } |
| 6582 | } | 6566 | } |
| 6583 | | 6567 | |
| ... | @@ -6585,13 +6569,13 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map: | ... | @@ -6585,13 +6569,13 @@ fn cmdAstCheck(arena: Allocator, io: Io, args: []const []const u8, environ_map: |
| 6585 | const source: [:0]const u8 = s: { | 6569 | const source: [:0]const u8 = s: { |
| 6586 | var f = if (zig_source_path) |p| file: { | 6570 | var f = if (zig_source_path) |p| file: { |
| 6587 | break :file Io.Dir.cwd().openFile(io, p, .{}) catch |err| { | 6571 | 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 }); |
| 6589 | }; | 6573 | }; |
| 6590 | } else Io.File.stdin(); | 6574 | } else Io.File.stdin(); |
| 6591 | defer if (zig_source_path != null) f.close(io); | 6575 | defer if (zig_source_path != null) f.close(io); |
| 6592 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); | 6576 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); |
| 6593 | break :s std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err| { | 6577 | 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 }); |
| 6595 | }; | 6579 | }; |
| 6596 | }; | 6580 | }; |
| 6597 | | 6581 | |
| ... | @@ -6717,7 +6701,7 @@ fn cmdDumpZir(arena: Allocator, io: Io, args: []const []const u8) !void { | ... | @@ -6717,7 +6701,7 @@ fn cmdDumpZir(arena: Allocator, io: Io, args: []const []const u8) !void { |
| 6717 | const cache_file = args[0]; | 6701 | const cache_file = args[0]; |
| 6718 | | 6702 | |
| 6719 | var f = Io.Dir.cwd().openFile(io, cache_file, .{}) catch |err| { | 6703 | 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 }); |
| 6721 | }; | 6705 | }; |
| 6722 | defer f.close(io); | 6706 | defer f.close(io); |
| 6723 | | 6707 | |
| ... | @@ -6764,19 +6748,19 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map | ... | @@ -6764,19 +6748,19 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map |
| 6764 | | 6748 | |
| 6765 | const old_source = source: { | 6749 | const old_source = source: { |
| 6766 | var f = Io.Dir.cwd().openFile(io, old_source_path, .{}) catch |err| | 6750 | 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 }); |
| 6768 | defer f.close(io); | 6752 | defer f.close(io); |
| 6769 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); | 6753 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); |
| 6770 | break :source std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err| | 6754 | 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 }); |
| 6772 | }; | 6756 | }; |
| 6773 | const new_source = source: { | 6757 | const new_source = source: { |
| 6774 | var f = Io.Dir.cwd().openFile(io, new_source_path, .{}) catch |err| | 6758 | 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 }); |
| 6776 | defer f.close(io); | 6760 | defer f.close(io); |
| 6777 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); | 6761 | var file_reader: Io.File.Reader = f.reader(io, &stdin_buffer); |
| 6778 | break :source std.zig.readSourceFileToEndAlloc(arena, &file_reader) catch |err| | 6762 | 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 }); |
| 6780 | }; | 6764 | }; |
| 6781 | | 6765 | |
| 6782 | const old_tree = try Ast.parse(arena, old_source, .zig); | 6766 | const old_tree = try Ast.parse(arena, old_source, .zig); |
| ... | @@ -6835,7 +6819,7 @@ fn eatIntPrefix(arg: []const u8, base: u8) []const u8 { | ... | @@ -6835,7 +6819,7 @@ fn eatIntPrefix(arg: []const u8, base: u8) []const u8 { |
| 6835 | | 6819 | |
| 6836 | fn prefixedIntArg(arg: []const u8, prefix: []const u8) ?u64 { | 6820 | fn prefixedIntArg(arg: []const u8, prefix: []const u8) ?u64 { |
| 6837 | const number = mem.cutPrefix(u8, arg, prefix) orelse return null; | 6821 | 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 }); |
| 6839 | } | 6823 | } |
| 6840 | | 6824 | |
| 6841 | fn warnAboutForeignBinaries( | 6825 | fn warnAboutForeignBinaries( |
| ... | @@ -6873,7 +6857,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6873,7 +6857,7 @@ fn warnAboutForeignBinaries( |
| 6873 | ), | 6857 | ), |
| 6874 | else => warn( | 6858 | else => warn( |
| 6875 | "the host system ({s}) does not appear to be capable of executing binaries " ++ | 6859 | "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", |
| 6877 | .{ host_name, foreign_name, qemu }, | 6861 | .{ host_name, foreign_name, qemu }, |
| 6878 | ), | 6862 | ), |
| 6879 | } | 6863 | } |
| ... | @@ -6890,7 +6874,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6890,7 +6874,7 @@ fn warnAboutForeignBinaries( |
| 6890 | ), | 6874 | ), |
| 6891 | else => warn( | 6875 | else => warn( |
| 6892 | "the host system ({s}) does not appear to be capable of executing binaries " ++ | 6876 | "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", |
| 6894 | .{ host_name, foreign_name, wine }, | 6878 | .{ host_name, foreign_name, wine }, |
| 6895 | ), | 6879 | ), |
| 6896 | } | 6880 | } |
| ... | @@ -6907,7 +6891,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6907,7 +6891,7 @@ fn warnAboutForeignBinaries( |
| 6907 | ), | 6891 | ), |
| 6908 | else => warn( | 6892 | else => warn( |
| 6909 | "the host system ({s}) does not appear to be capable of executing binaries " ++ | 6893 | "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", |
| 6911 | .{ host_name, foreign_name, wasmtime }, | 6895 | .{ host_name, foreign_name, wasmtime }, |
| 6912 | ), | 6896 | ), |
| 6913 | } | 6897 | } |
| ... | @@ -6924,7 +6908,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6924,7 +6908,7 @@ fn warnAboutForeignBinaries( |
| 6924 | ), | 6908 | ), |
| 6925 | else => warn( | 6909 | else => warn( |
| 6926 | "the host system ({s}) does not appear to be capable of executing binaries " ++ | 6910 | "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", |
| 6928 | .{ host_name, foreign_name, darling }, | 6912 | .{ host_name, foreign_name, darling }, |
| 6929 | ), | 6913 | ), |
| 6930 | } | 6914 | } |
| ... | @@ -6935,7 +6919,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6935,7 +6919,7 @@ fn warnAboutForeignBinaries( |
| 6935 | .zig_test => ", '--test-no-exec', or '--test-cmd'", | 6919 | .zig_test => ", '--test-no-exec', or '--test-cmd'", |
| 6936 | else => "", | 6920 | else => "", |
| 6937 | }; | 6921 | }; |
| 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}", .{ |
| 6939 | host_dl, foreign_dl, tip_suffix, | 6923 | host_dl, foreign_dl, tip_suffix, |
| 6940 | }); | 6924 | }); |
| 6941 | }, | 6925 | }, |
| ... | @@ -6955,7 +6939,7 @@ fn warnAboutForeignBinaries( | ... | @@ -6955,7 +6939,7 @@ fn warnAboutForeignBinaries( |
| 6955 | | 6939 | |
| 6956 | fn parseSubsystem(arg: []const u8) !std.zig.Subsystem { | 6940 | fn parseSubsystem(arg: []const u8) !std.zig.Subsystem { |
| 6957 | return std.meta.stringToEnum(std.zig.Subsystem, arg) orelse | 6941 | 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}", .{ |
| 6959 | arg, | 6943 | arg, |
| 6960 | \\ console | 6944 | \\ console |
| 6961 | \\ windows | 6945 | \\ windows |
| ... | @@ -6994,7 +6978,7 @@ const ClangSearchSanitizer = struct { | ... | @@ -6994,7 +6978,7 @@ const ClangSearchSanitizer = struct { |
| 6994 | // init empty membership | 6978 | // init empty membership |
| 6995 | m.* = .{}; | 6979 | m.* = .{}; |
| 6996 | } | 6980 | } |
| 6997 | const wtxt = "add '{s}' to header searchlist '-{s}' conflicts with '-{s}'"; | 6981 | const wtxt = "add {q} to header searchlist '-{s}' conflicts with '-{s}'"; |
| 6998 | switch (group) { | 6982 | switch (group) { |
| 6999 | .I => { | 6983 | .I => { |
| 7000 | if (m.I) return; | 6984 | if (m.I) return; |
| ... | @@ -7074,8 +7058,8 @@ fn accessFrameworkPath( | ... | @@ -7074,8 +7058,8 @@ fn accessFrameworkPath( |
| 7074 | try checked_paths.print("\n {s}", .{test_path.items}); | 7058 | try checked_paths.print("\n {s}", .{test_path.items}); |
| 7075 | Io.Dir.cwd().access(io, test_path.items, .{}) catch |err| switch (err) { | 7059 | Io.Dir.cwd().access(io, test_path.items, .{}) catch |err| switch (err) { |
| 7076 | error.FileNotFound => continue, | 7060 | error.FileNotFound => continue, |
| 7077 | else => |e| fatal("unable to search for {s} framework '{s}': {s}", .{ | 7061 | else => |e| fatal("unable to search for {s} framework {q}: {t}", .{ |
| 7078 | ext, test_path.items, @errorName(e), | 7062 | ext, test_path.items, e, |
| 7079 | }), | 7063 | }), |
| 7080 | }; | 7064 | }; |
| 7081 | return true; | 7065 | return true; |
| ... | @@ -7086,7 +7070,7 @@ fn accessFrameworkPath( | ... | @@ -7086,7 +7070,7 @@ fn accessFrameworkPath( |
| 7086 | | 7070 | |
| 7087 | fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes { | 7071 | fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes { |
| 7088 | return std.meta.stringToEnum(std.zig.RcIncludes, arg) orelse | 7072 | 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}); |
| 7090 | } | 7074 | } |
| 7091 | | 7075 | |
| 7092 | const usage_fetch = | 7076 | const usage_fetch = |
| ... | @@ -7175,10 +7159,10 @@ fn cmdFetch( | ... | @@ -7175,10 +7159,10 @@ fn cmdFetch( |
| 7175 | } else if (mem.cutPrefix(u8, arg, "--save-exact=")) |rest| { | 7159 | } else if (mem.cutPrefix(u8, arg, "--save-exact=")) |rest| { |
| 7176 | save = .{ .exact = rest }; | 7160 | save = .{ .exact = rest }; |
| 7177 | } else { | 7161 | } else { |
| 7178 | fatal("unrecognized parameter: '{s}'", .{arg}); | 7162 | fatal("unrecognized parameter: {q}", .{arg}); |
| 7179 | } | 7163 | } |
| 7180 | } else if (opt_path_or_url != null) { | 7164 | } else if (opt_path_or_url != null) { |
| 7181 | fatal("unexpected extra parameter: '{s}'", .{arg}); | 7165 | fatal("unexpected extra parameter: {q}", .{arg}); |
| 7182 | } else { | 7166 | } else { |
| 7183 | opt_path_or_url = arg; | 7167 | opt_path_or_url = arg; |
| 7184 | } | 7168 | } |
| ... | @@ -7339,7 +7323,7 @@ fn cmdFetch( | ... | @@ -7339,7 +7323,7 @@ fn cmdFetch( |
| 7339 | // the refspec may already be fully resolved | 7323 | // the refspec may already be fully resolved |
| 7340 | if (std.mem.eql(u8, target_ref, latest_commit_hex)) break :resolved; | 7324 | if (std.mem.eql(u8, target_ref, latest_commit_hex)) break :resolved; |
| 7341 | | 7325 | |
| 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 }); |
| 7343 | | 7327 | |
| 7344 | // include the original refspec in a query parameter, could be used to check for updates | 7328 | // include the original refspec in a query parameter, could be used to check for updates |
| 7345 | uri.query = .{ .percent_encoded = try std.fmt.allocPrint(arena, "ref={f}", .{ | 7329 | uri.query = .{ .percent_encoded = try std.fmt.allocPrint(arena, "ref={f}", .{ |
| ... | @@ -7385,7 +7369,7 @@ fn cmdFetch( | ... | @@ -7385,7 +7369,7 @@ fn cmdFetch( |
| 7385 | switch (dep.location) { | 7369 | switch (dep.location) { |
| 7386 | .url => |u| { | 7370 | .url => |u| { |
| 7387 | if (mem.eql(u8, h, package_hash_slice) and mem.eql(u8, u, saved_path_or_url)) { | 7371 | 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}); |
| 7389 | process.exit(0); | 7373 | process.exit(0); |
| 7390 | } | 7374 | } |
| 7391 | }, | 7375 | }, |
| ... | @@ -7404,7 +7388,7 @@ fn cmdFetch( | ... | @@ -7404,7 +7388,7 @@ fn cmdFetch( |
| 7404 | .{std.zig.fmtString(package_hash_slice)}, | 7388 | .{std.zig.fmtString(package_hash_slice)}, |
| 7405 | ); | 7389 | ); |
| 7406 | | 7390 | |
| 7407 | warn("overwriting existing dependency named '{s}'", .{name}); | 7391 | warn("overwriting existing dependency named {q}", .{name}); |
| 7408 | try fixups.replace_nodes_with_string.put(gpa, dep.location_node, location_replace); | 7392 | try fixups.replace_nodes_with_string.put(gpa, dep.location_node, location_replace); |
| 7409 | if (dep.hash_node.unwrap()) |hash_node| { | 7393 | if (dep.hash_node.unwrap()) |hash_node| { |
| 7410 | try fixups.replace_nodes_with_string.put(gpa, hash_node, hash_replace); | 7394 | 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 | ... | @@ -7531,7 +7515,7 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build |
| 7531 | if (options.build_file) |bf| { | 7515 | if (options.build_file) |bf| { |
| 7532 | if (fs.path.dirname(bf)) |dirname| { | 7516 | if (fs.path.dirname(bf)) |dirname| { |
| 7533 | const dir = Io.Dir.cwd().openDir(io, dirname, .{}) catch |err| { | 7517 | 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 }); |
| 7535 | }; | 7519 | }; |
| 7536 | return .{ | 7520 | return .{ |
| 7537 | .build_zig_basename = build_zig_basename, | 7521 | .build_zig_basename = build_zig_basename, |
| ... | @@ -7552,7 +7536,7 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build | ... | @@ -7552,7 +7536,7 @@ fn findBuildRoot(arena: Allocator, io: Io, options: FindBuildRootOptions) !Build |
| 7552 | const joined_path = try fs.path.join(arena, &[_][]const u8{ dirname, build_zig_basename }); | 7536 | const joined_path = try fs.path.join(arena, &[_][]const u8{ dirname, build_zig_basename }); |
| 7553 | if (Io.Dir.cwd().access(io, joined_path, .{})) |_| { | 7537 | if (Io.Dir.cwd().access(io, joined_path, .{})) |_| { |
| 7554 | const dir = Io.Dir.cwd().openDir(io, dirname, .{}) catch |err| { | 7538 | 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 }); |
| 7556 | }; | 7540 | }; |
| 7557 | return .{ | 7541 | return .{ |
| 7558 | .build_zig_basename = build_zig_basename, | 7542 | .build_zig_basename = build_zig_basename, |
| ... | @@ -7673,13 +7657,13 @@ const Templates = struct { | ... | @@ -7673,13 +7657,13 @@ const Templates = struct { |
| 7673 | ) !void { | 7657 | ) !void { |
| 7674 | if (fs.path.dirname(template_path)) |dirname| { | 7658 | if (fs.path.dirname(template_path)) |dirname| { |
| 7675 | out_dir.createDirPath(io, dirname) catch |err| { | 7659 | 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 }); |
| 7677 | }; | 7661 | }; |
| 7678 | } | 7662 | } |
| 7679 | | 7663 | |
| 7680 | const max_bytes = 10 * 1024 * 1024; | 7664 | const max_bytes = 10 * 1024 * 1024; |
| 7681 | const contents = templates.dir.readFileAlloc(io, template_path, arena, .limited(max_bytes)) catch |err| { | 7665 | 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 }); |
| 7683 | }; | 7667 | }; |
| 7684 | templates.buffer.clearRetainingCapacity(); | 7668 | templates.buffer.clearRetainingCapacity(); |
| 7685 | try templates.buffer.ensureUnusedCapacity(contents.len); | 7669 | try templates.buffer.ensureUnusedCapacity(contents.len); |
| ... | @@ -7731,7 +7715,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates { | ... | @@ -7731,7 +7715,7 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates { |
| 7731 | fatal("unable to find self exe path: {t}", .{err}); | 7715 | fatal("unable to find self exe path: {t}", .{err}); |
| 7732 | }; | 7716 | }; |
| 7733 | var zig_lib_directory = introspect.findZigLibDirFromSelfExe(arena, io, cwd_path, self_exe_path) catch |err| { | 7717 | 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 }); |
| 7735 | }; | 7719 | }; |
| 7736 | | 7720 | |
| 7737 | const s = fs.path.sep_str; | 7721 | const s = fs.path.sep_str; |
| ... | @@ -7752,22 +7736,22 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates { | ... | @@ -7752,22 +7736,22 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates { |
| 7752 | | 7736 | |
| 7753 | fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode { | 7737 | fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode { |
| 7754 | return std.meta.stringToEnum(std.lang.OptimizeMode, s) orelse | 7738 | return std.meta.stringToEnum(std.lang.OptimizeMode, s) orelse |
| 7755 | fatal("unrecognized optimization mode: '{s}'", .{s}); | 7739 | fatal("unrecognized optimization mode: {q}", .{s}); |
| 7756 | } | 7740 | } |
| 7757 | | 7741 | |
| 7758 | fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel { | 7742 | fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel { |
| 7759 | return std.meta.stringToEnum(std.lang.WasiExecModel, s) orelse | 7743 | 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}); |
| 7761 | } | 7745 | } |
| 7762 | | 7746 | |
| 7763 | fn parseStackSize(s: []const u8) u64 { | 7747 | fn parseStackSize(s: []const u8) u64 { |
| 7764 | return std.fmt.parseUnsigned(u64, s, 0) catch |err| | 7748 | 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 }); |
| 7766 | } | 7750 | } |
| 7767 | | 7751 | |
| 7768 | fn parseImageBase(s: []const u8) u64 { | 7752 | fn parseImageBase(s: []const u8) u64 { |
| 7769 | return std.fmt.parseUnsigned(u64, s, 0) catch |err| | 7753 | 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 }); |
| 7771 | } | 7755 | } |
| 7772 | | 7756 | |
| 7773 | fn handleModArg( | 7757 | fn handleModArg( |
| ... | @@ -7787,7 +7771,7 @@ fn handleModArg( | ... | @@ -7787,7 +7771,7 @@ fn handleModArg( |
| 7787 | const gop = try create_module.modules.getOrPut(arena, mod_name); | 7771 | const gop = try create_module.modules.getOrPut(arena, mod_name); |
| 7788 | | 7772 | |
| 7789 | if (gop.found_existing) { | 7773 | 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}'", .{ |
| 7791 | mod_name, gop.value_ptr.root_path, fs.path.sep, gop.value_ptr.root_src_path, | 7775 | mod_name, gop.value_ptr.root_path, fs.path.sep, gop.value_ptr.root_src_path, |
| 7792 | }); | 7776 | }); |
| 7793 | } | 7777 | } |
| ... | @@ -7866,7 +7850,7 @@ fn addLibDirectoryWarn2( | ... | @@ -7866,7 +7850,7 @@ fn addLibDirectoryWarn2( |
| 7866 | lib_directories.appendAssumeCapacity(.{ | 7850 | lib_directories.appendAssumeCapacity(.{ |
| 7867 | .handle = Io.Dir.cwd().openDir(io, path, .{}) catch |err| { | 7851 | .handle = Io.Dir.cwd().openDir(io, path, .{}) catch |err| { |
| 7868 | if (err == error.FileNotFound and ignore_not_found) return; | 7852 | 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 }); |
| 7870 | return; | 7854 | return; |
| 7871 | }, | 7855 | }, |
| 7872 | .path = path, | 7856 | .path = path, |