| author | |
| committer | |
| log | 89ab6b161d39e0f6338930b2c06dbff891d1f768 |
| tree | 74b2dfa357e850a7c23ddcfd1e07f0f0347c1ac7 |
| parent | 9a69aede0e250c136de5f1e1b33f072d4d744ffc |
| parent | 11a49868a1d4c3cbfdeab13fe872aa4175759fb1 |
| signature |
Fix bitrot in tools10 files changed, 94 insertions(+), 84 deletions(-)
test/standalone/build.zig+19-1| ... | @@ -38,20 +38,38 @@ pub fn build(b: *std.Build) void { | ... | @@ -38,20 +38,38 @@ pub fn build(b: *std.Build) void { |
| 38 | "../../tools/gen_spirv_spec.zig", | 38 | "../../tools/gen_spirv_spec.zig", |
| 39 | "../../tools/gen_stubs.zig", | 39 | "../../tools/gen_stubs.zig", |
| 40 | "../../tools/generate_c_size_and_align_checks.zig", | 40 | "../../tools/generate_c_size_and_align_checks.zig", |
| 41 | "../../tools/generate_JSONTestSuite.zig", | ||
| 41 | "../../tools/generate_linux_syscalls.zig", | 42 | "../../tools/generate_linux_syscalls.zig", |
| 42 | "../../tools/process_headers.zig", | 43 | "../../tools/process_headers.zig", |
| 44 | "../../tools/migrate_langref.zig", | ||
| 43 | "../../tools/update-linux-headers.zig", | 45 | "../../tools/update-linux-headers.zig", |
| 44 | "../../tools/update_clang_options.zig", | 46 | "../../tools/update_clang_options.zig", |
| 45 | "../../tools/update_cpu_features.zig", | 47 | "../../tools/update_cpu_features.zig", |
| 48 | "../../tools/update_crc_catalog.zig", | ||
| 46 | "../../tools/update_freebsd_libc.zig", | 49 | "../../tools/update_freebsd_libc.zig", |
| 47 | "../../tools/update_glibc.zig", | 50 | "../../tools/update_glibc.zig", |
| 51 | "../../tools/update_mingw.zig", | ||
| 48 | "../../tools/update_netbsd_libc.zig", | 52 | "../../tools/update_netbsd_libc.zig", |
| 53 | }) |tool_src_path| { | ||
| 54 | if (std.mem.endsWith(u8, tool_src_path, "dump-cov.zig") and tools_target.result.os.tag == .windows) continue; | ||
| 55 | |||
| 56 | const tool = b.addExecutable(.{ | ||
| 57 | .name = std.fs.path.stem(tool_src_path), | ||
| 58 | .root_module = b.createModule(.{ | ||
| 59 | .root_source_file = b.path(tool_src_path), | ||
| 60 | .target = tools_target, | ||
| 61 | }), | ||
| 62 | }); | ||
| 63 | tools_tests_step.dependOn(&tool.step); | ||
| 64 | } | ||
| 65 | for ([_][]const u8{ | ||
| 66 | // Alphabetically sorted. Only ones with `test` blocks. | ||
| 67 | "../../tools/doctest.zig", | ||
| 49 | }) |tool_src_path| { | 68 | }) |tool_src_path| { |
| 50 | const tool = b.addTest(.{ | 69 | const tool = b.addTest(.{ |
| 51 | .name = std.fs.path.stem(tool_src_path), | 70 | .name = std.fs.path.stem(tool_src_path), |
| 52 | .root_module = b.createModule(.{ | 71 | .root_module = b.createModule(.{ |
| 53 | .root_source_file = b.path(tool_src_path), | 72 | .root_source_file = b.path(tool_src_path), |
| 54 | .optimize = .Debug, | ||
| 55 | .target = tools_target, | 73 | .target = tools_target, |
| 56 | }), | 74 | }), |
| 57 | }); | 75 | }); |
tools/fetch_them_macos_headers.zig+5-9| ... | @@ -87,7 +87,7 @@ pub fn main() anyerror!void { | ... | @@ -87,7 +87,7 @@ pub fn main() anyerror!void { |
| 87 | 87 | ||
| 88 | const sysroot_path = sysroot orelse blk: { | 88 | const sysroot_path = sysroot orelse blk: { |
| 89 | const target = try std.zig.system.resolveTargetQuery(.{}); | 89 | const target = try std.zig.system.resolveTargetQuery(.{}); |
| 90 | break :blk std.zig.system.darwin.getSdk(allocator, target) orelse | 90 | break :blk std.zig.system.darwin.getSdk(allocator, &target) orelse |
| 91 | fatal("no SDK found; you can provide one explicitly with '--sysroot' flag", .{}); | 91 | fatal("no SDK found; you can provide one explicitly with '--sysroot' flag", .{}); |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| ... | @@ -112,7 +112,7 @@ pub fn main() anyerror!void { | ... | @@ -112,7 +112,7 @@ pub fn main() anyerror!void { |
| 112 | 15 => .sequoia, | 112 | 15 => .sequoia, |
| 113 | else => unreachable, | 113 | else => unreachable, |
| 114 | }; | 114 | }; |
| 115 | info("found SDK deployment target macOS {} aka '{s}'", .{ version, @tagName(os_ver) }); | 115 | info("found SDK deployment target macOS {f} aka '{s}'", .{ version, @tagName(os_ver) }); |
| 116 | 116 | ||
| 117 | var tmp = tmpDir(.{}); | 117 | var tmp = tmpDir(.{}); |
| 118 | defer tmp.cleanup(); | 118 | defer tmp.cleanup(); |
| ... | @@ -198,7 +198,7 @@ fn fetchTarget( | ... | @@ -198,7 +198,7 @@ fn fetchTarget( |
| 198 | var dirs = std.StringHashMap(fs.Dir).init(arena); | 198 | var dirs = std.StringHashMap(fs.Dir).init(arena); |
| 199 | try dirs.putNoClobber(".", dest_dir); | 199 | try dirs.putNoClobber(".", dest_dir); |
| 200 | 200 | ||
| 201 | const headers_list_str = try headers_list_file.reader().readAllAlloc(arena, std.math.maxInt(usize)); | 201 | const headers_list_str = try headers_list_file.deprecatedReader().readAllAlloc(arena, std.math.maxInt(usize)); |
| 202 | const prefix = "/usr/include"; | 202 | const prefix = "/usr/include"; |
| 203 | 203 | ||
| 204 | var it = mem.splitScalar(u8, headers_list_str, '\n'); | 204 | var it = mem.splitScalar(u8, headers_list_str, '\n'); |
| ... | @@ -270,12 +270,8 @@ const Version = struct { | ... | @@ -270,12 +270,8 @@ const Version = struct { |
| 270 | 270 | ||
| 271 | pub fn format( | 271 | pub fn format( |
| 272 | v: Version, | 272 | v: Version, |
| 273 | comptime unused_fmt_string: []const u8, | 273 | writer: *std.Io.Writer, |
| 274 | options: std.fmt.FormatOptions, | 274 | ) std.Io.Writer.Error!void { |
| 275 | writer: anytype, | ||
| 276 | ) !void { | ||
| 277 | _ = unused_fmt_string; | ||
| 278 | _ = options; | ||
| 279 | try writer.print("{d}.{d}.{d}", .{ v.major, v.minor, v.patch }); | 275 | try writer.print("{d}.{d}.{d}", .{ v.major, v.minor, v.patch }); |
| 280 | } | 276 | } |
| 281 | }; | 277 | }; |
tools/gen_stubs.zig+1-1| ... | @@ -303,7 +303,7 @@ pub fn main() !void { | ... | @@ -303,7 +303,7 @@ pub fn main() !void { |
| 303 | libc_so_path, | 303 | libc_so_path, |
| 304 | 100 * 1024 * 1024, | 304 | 100 * 1024 * 1024, |
| 305 | 1 * 1024 * 1024, | 305 | 1 * 1024 * 1024, |
| 306 | @alignOf(elf.Elf64_Ehdr), | 306 | .of(elf.Elf64_Ehdr), |
| 307 | null, | 307 | null, |
| 308 | ) catch |err| { | 308 | ) catch |err| { |
| 309 | std.debug.panic("unable to read '{s}/{s}': {s}", .{ | 309 | std.debug.panic("unable to read '{s}/{s}': {s}", .{ |
tools/generate_linux_syscalls.zig+7-7| ... | @@ -477,7 +477,7 @@ fn processPreprocessedFile( | ... | @@ -477,7 +477,7 @@ fn processPreprocessedFile( |
| 477 | const name = (getOverridenNameNew(value) orelse sys_name)["sys_".len..]; | 477 | const name = (getOverridenNameNew(value) orelse sys_name)["sys_".len..]; |
| 478 | const fixed_name = if (stdlib_renames_new.get(name)) |f| f else if (stdlib_renames.get(name)) |f| f else name; | 478 | const fixed_name = if (stdlib_renames_new.get(name)) |f| f else if (stdlib_renames.get(name)) |f| f else name; |
| 479 | 479 | ||
| 480 | try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), value }); | 480 | try writer.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), value }); |
| 481 | } | 481 | } |
| 482 | } | 482 | } |
| 483 | 483 | ||
| ... | @@ -510,7 +510,7 @@ fn processTableBasedArch( | ... | @@ -510,7 +510,7 @@ fn processTableBasedArch( |
| 510 | } | 510 | } |
| 511 | const fixed_name = if (filters.fixedName) |fixedNameFn| fixedNameFn(name) else name; | 511 | const fixed_name = if (filters.fixedName) |fixedNameFn| fixedNameFn(name) else name; |
| 512 | 512 | ||
| 513 | try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number }); | 513 | try writer.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 514 | } | 514 | } |
| 515 | } | 515 | } |
| 516 | 516 | ||
| ... | @@ -543,7 +543,7 @@ fn processMipsBasedArch( | ... | @@ -543,7 +543,7 @@ fn processMipsBasedArch( |
| 543 | } | 543 | } |
| 544 | const fixed_name = if (filters.fixedName) |fixedNameFn| fixedNameFn(name) else name; | 544 | const fixed_name = if (filters.fixedName) |fixedNameFn| fixedNameFn(name) else name; |
| 545 | 545 | ||
| 546 | try writer.print(" {p} = linux_base + {s},\n", .{ zig.fmtId(fixed_name), number }); | 546 | try writer.print(" {f} = linux_base + {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 547 | } | 547 | } |
| 548 | } | 548 | } |
| 549 | 549 | ||
| ... | @@ -568,12 +568,12 @@ fn processPowerPcBasedArch( | ... | @@ -568,12 +568,12 @@ fn processPowerPcBasedArch( |
| 568 | if (mem.eql(u8, abi, "spu")) { | 568 | if (mem.eql(u8, abi, "spu")) { |
| 569 | continue; | 569 | continue; |
| 570 | } else if (mem.eql(u8, abi, "32")) { | 570 | } else if (mem.eql(u8, abi, "32")) { |
| 571 | try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number }); | 571 | try writer.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 572 | } else if (mem.eql(u8, abi, "64")) { | 572 | } else if (mem.eql(u8, abi, "64")) { |
| 573 | try optional_writer.?.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number }); | 573 | try optional_writer.?.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 574 | } else { // common/nospu | 574 | } else { // common/nospu |
| 575 | try writer.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number }); | 575 | try writer.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 576 | try optional_writer.?.print(" {p} = {s},\n", .{ zig.fmtId(fixed_name), number }); | 576 | try optional_writer.?.print(" {f} = {s},\n", .{ zig.fmtId(fixed_name), number }); |
| 577 | } | 577 | } |
| 578 | } | 578 | } |
| 579 | } | 579 | } |
tools/migrate_langref.zig+18-18| ... | @@ -27,9 +27,9 @@ pub fn main() !void { | ... | @@ -27,9 +27,9 @@ pub fn main() !void { |
| 27 | var out_dir = try fs.cwd().openDir(fs.path.dirname(output_file).?, .{}); | 27 | var out_dir = try fs.cwd().openDir(fs.path.dirname(output_file).?, .{}); |
| 28 | defer out_dir.close(); | 28 | defer out_dir.close(); |
| 29 | 29 | ||
| 30 | const input_file_bytes = try in_file.reader().readAllAlloc(arena, std.math.maxInt(u32)); | 30 | const input_file_bytes = try in_file.deprecatedReader().readAllAlloc(arena, std.math.maxInt(u32)); |
| 31 | 31 | ||
| 32 | var buffered_writer = io.bufferedWriter(out_file.writer()); | 32 | var buffered_writer = io.bufferedWriter(out_file.deprecatedWriter()); |
| 33 | 33 | ||
| 34 | var tokenizer = Tokenizer.init(input_file, input_file_bytes); | 34 | var tokenizer = Tokenizer.init(input_file, input_file_bytes); |
| 35 | 35 | ||
| ... | @@ -388,39 +388,39 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype | ... | @@ -388,39 +388,39 @@ fn walk(arena: Allocator, tokenizer: *Tokenizer, out_dir: std.fs.Dir, w: anytype |
| 388 | try file.writeAll("\n\n"); | 388 | try file.writeAll("\n\n"); |
| 389 | 389 | ||
| 390 | if (just_check_syntax) { | 390 | if (just_check_syntax) { |
| 391 | try file.writer().print("// syntax\n", .{}); | 391 | try file.deprecatedWriter().print("// syntax\n", .{}); |
| 392 | } else switch (code_kind_id) { | 392 | } else switch (code_kind_id) { |
| 393 | .@"test" => try file.writer().print("// test\n", .{}), | 393 | .@"test" => try file.deprecatedWriter().print("// test\n", .{}), |
| 394 | .lib => try file.writer().print("// lib\n", .{}), | 394 | .lib => try file.deprecatedWriter().print("// lib\n", .{}), |
| 395 | .test_error => |s| try file.writer().print("// test_error={s}\n", .{s}), | 395 | .test_error => |s| try file.deprecatedWriter().print("// test_error={s}\n", .{s}), |
| 396 | .test_safety => |s| try file.writer().print("// test_safety={s}\n", .{s}), | 396 | .test_safety => |s| try file.deprecatedWriter().print("// test_safety={s}\n", .{s}), |
| 397 | .exe => |s| try file.writer().print("// exe={s}\n", .{@tagName(s)}), | 397 | .exe => |s| try file.deprecatedWriter().print("// exe={s}\n", .{@tagName(s)}), |
| 398 | .obj => |opt| if (opt) |s| { | 398 | .obj => |opt| if (opt) |s| { |
| 399 | try file.writer().print("// obj={s}\n", .{s}); | 399 | try file.deprecatedWriter().print("// obj={s}\n", .{s}); |
| 400 | } else { | 400 | } else { |
| 401 | try file.writer().print("// obj\n", .{}); | 401 | try file.deprecatedWriter().print("// obj\n", .{}); |
| 402 | }, | 402 | }, |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | if (mode != .Debug) | 405 | if (mode != .Debug) |
| 406 | try file.writer().print("// optimize={s}\n", .{@tagName(mode)}); | 406 | try file.deprecatedWriter().print("// optimize={s}\n", .{@tagName(mode)}); |
| 407 | 407 | ||
| 408 | for (link_objects.items) |link_object| { | 408 | for (link_objects.items) |link_object| { |
| 409 | try file.writer().print("// link_object={s}\n", .{link_object}); | 409 | try file.deprecatedWriter().print("// link_object={s}\n", .{link_object}); |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | if (target_str) |s| | 412 | if (target_str) |s| |
| 413 | try file.writer().print("// target={s}\n", .{s}); | 413 | try file.deprecatedWriter().print("// target={s}\n", .{s}); |
| 414 | 414 | ||
| 415 | if (link_libc) try file.writer().print("// link_libc\n", .{}); | 415 | if (link_libc) try file.deprecatedWriter().print("// link_libc\n", .{}); |
| 416 | if (disable_cache) try file.writer().print("// disable_cache\n", .{}); | 416 | if (disable_cache) try file.deprecatedWriter().print("// disable_cache\n", .{}); |
| 417 | if (verbose_cimport) try file.writer().print("// verbose_cimport\n", .{}); | 417 | if (verbose_cimport) try file.deprecatedWriter().print("// verbose_cimport\n", .{}); |
| 418 | 418 | ||
| 419 | if (link_mode) |m| | 419 | if (link_mode) |m| |
| 420 | try file.writer().print("// link_mode={s}\n", .{@tagName(m)}); | 420 | try file.deprecatedWriter().print("// link_mode={s}\n", .{@tagName(m)}); |
| 421 | 421 | ||
| 422 | for (additional_options.items) |o| { | 422 | for (additional_options.items) |o| { |
| 423 | try file.writer().print("// additional_option={s}\n", .{o}); | 423 | try file.deprecatedWriter().print("// additional_option={s}\n", .{o}); |
| 424 | } | 424 | } |
| 425 | try w.print("{{#code|{s}#}}\n", .{basename}); | 425 | try w.print("{{#code|{s}#}}\n", .{basename}); |
| 426 | } else { | 426 | } else { |
tools/process_headers.zig+7-7| ... | @@ -266,10 +266,10 @@ pub fn main() !void { | ... | @@ -266,10 +266,10 @@ pub fn main() !void { |
| 266 | if (gop.found_existing) { | 266 | if (gop.found_existing) { |
| 267 | max_bytes_saved += raw_bytes.len; | 267 | max_bytes_saved += raw_bytes.len; |
| 268 | gop.value_ptr.hit_count += 1; | 268 | gop.value_ptr.hit_count += 1; |
| 269 | std.debug.print("duplicate: {s} {s} ({:2})\n", .{ | 269 | std.debug.print("duplicate: {s} {s} ({B})\n", .{ |
| 270 | libc_dir, | 270 | libc_dir, |
| 271 | rel_path, | 271 | rel_path, |
| 272 | std.fmt.fmtIntSizeDec(raw_bytes.len), | 272 | raw_bytes.len, |
| 273 | }); | 273 | }); |
| 274 | } else { | 274 | } else { |
| 275 | gop.value_ptr.* = Contents{ | 275 | gop.value_ptr.* = Contents{ |
| ... | @@ -311,9 +311,9 @@ pub fn main() !void { | ... | @@ -311,9 +311,9 @@ pub fn main() !void { |
| 311 | std.debug.print("warning: libc target not found: {s}\n", .{libc_dir}); | 311 | std.debug.print("warning: libc target not found: {s}\n", .{libc_dir}); |
| 312 | } | 312 | } |
| 313 | } | 313 | } |
| 314 | std.debug.print("summary: {:2} could be reduced to {:2}\n", .{ | 314 | std.debug.print("summary: {B} could be reduced to {B}\n", .{ |
| 315 | std.fmt.fmtIntSizeDec(total_bytes), | 315 | total_bytes, |
| 316 | std.fmt.fmtIntSizeDec(total_bytes - max_bytes_saved), | 316 | total_bytes - max_bytes_saved, |
| 317 | }); | 317 | }); |
| 318 | try std.fs.cwd().makePath(out_dir); | 318 | try std.fs.cwd().makePath(out_dir); |
| 319 | 319 | ||
| ... | @@ -343,8 +343,8 @@ pub fn main() !void { | ... | @@ -343,8 +343,8 @@ pub fn main() !void { |
| 343 | if (contender.hit_count > 1) { | 343 | if (contender.hit_count > 1) { |
| 344 | const this_missed_bytes = contender.hit_count * contender.bytes.len; | 344 | const this_missed_bytes = contender.hit_count * contender.bytes.len; |
| 345 | missed_opportunity_bytes += this_missed_bytes; | 345 | missed_opportunity_bytes += this_missed_bytes; |
| 346 | std.debug.print("Missed opportunity ({:2}): {s}\n", .{ | 346 | std.debug.print("Missed opportunity ({B}): {s}\n", .{ |
| 347 | std.fmt.fmtIntSizeDec(this_missed_bytes), | 347 | this_missed_bytes, |
| 348 | path_kv.key_ptr.*, | 348 | path_kv.key_ptr.*, |
| 349 | }); | 349 | }); |
| 350 | } else break; | 350 | } else break; |
tools/update-linux-headers.zig+7-7| ... | @@ -218,10 +218,10 @@ pub fn main() !void { | ... | @@ -218,10 +218,10 @@ pub fn main() !void { |
| 218 | if (gop.found_existing) { | 218 | if (gop.found_existing) { |
| 219 | max_bytes_saved += raw_bytes.len; | 219 | max_bytes_saved += raw_bytes.len; |
| 220 | gop.value_ptr.hit_count += 1; | 220 | gop.value_ptr.hit_count += 1; |
| 221 | std.debug.print("duplicate: {s} {s} ({:2})\n", .{ | 221 | std.debug.print("duplicate: {s} {s} ({B})\n", .{ |
| 222 | linux_target.name, | 222 | linux_target.name, |
| 223 | rel_path, | 223 | rel_path, |
| 224 | std.fmt.fmtIntSizeDec(raw_bytes.len), | 224 | raw_bytes.len, |
| 225 | }); | 225 | }); |
| 226 | } else { | 226 | } else { |
| 227 | gop.value_ptr.* = Contents{ | 227 | gop.value_ptr.* = Contents{ |
| ... | @@ -249,9 +249,9 @@ pub fn main() !void { | ... | @@ -249,9 +249,9 @@ pub fn main() !void { |
| 249 | std.debug.print("warning: libc target not found: {s}\n", .{linux_target.name}); | 249 | std.debug.print("warning: libc target not found: {s}\n", .{linux_target.name}); |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | std.debug.print("summary: {:2} could be reduced to {:2}\n", .{ | 252 | std.debug.print("summary: {B} could be reduced to {B}\n", .{ |
| 253 | std.fmt.fmtIntSizeDec(total_bytes), | 253 | total_bytes, |
| 254 | std.fmt.fmtIntSizeDec(total_bytes - max_bytes_saved), | 254 | total_bytes - max_bytes_saved, |
| 255 | }); | 255 | }); |
| 256 | try std.fs.cwd().makePath(out_dir); | 256 | try std.fs.cwd().makePath(out_dir); |
| 257 | 257 | ||
| ... | @@ -281,8 +281,8 @@ pub fn main() !void { | ... | @@ -281,8 +281,8 @@ pub fn main() !void { |
| 281 | if (contender.hit_count > 1) { | 281 | if (contender.hit_count > 1) { |
| 282 | const this_missed_bytes = contender.hit_count * contender.bytes.len; | 282 | const this_missed_bytes = contender.hit_count * contender.bytes.len; |
| 283 | missed_opportunity_bytes += this_missed_bytes; | 283 | missed_opportunity_bytes += this_missed_bytes; |
| 284 | std.debug.print("Missed opportunity ({:2}): {s}\n", .{ | 284 | std.debug.print("Missed opportunity ({B}): {s}\n", .{ |
| 285 | std.fmt.fmtIntSizeDec(this_missed_bytes), | 285 | this_missed_bytes, |
| 286 | path_kv.key_ptr.*, | 286 | path_kv.key_ptr.*, |
| 287 | }); | 287 | }); |
| 288 | } else break; | 288 | } else break; |
tools/update_clang_options.zig+6-10| ... | @@ -635,7 +635,7 @@ pub fn main() anyerror!void { | ... | @@ -635,7 +635,7 @@ pub fn main() anyerror!void { |
| 635 | const args = try std.process.argsAlloc(allocator); | 635 | const args = try std.process.argsAlloc(allocator); |
| 636 | 636 | ||
| 637 | var stdout_buffer: [4000]u8 = undefined; | 637 | var stdout_buffer: [4000]u8 = undefined; |
| 638 | var stdout_writer = fs.stdout().writerStreaming(&stdout_buffer); | 638 | var stdout_writer = fs.File.stdout().writerStreaming(&stdout_buffer); |
| 639 | const stdout = &stdout_writer.interface; | 639 | const stdout = &stdout_writer.interface; |
| 640 | 640 | ||
| 641 | if (args.len <= 1) printUsageAndExit(args[0]); | 641 | if (args.len <= 1) printUsageAndExit(args[0]); |
| ... | @@ -767,7 +767,7 @@ pub fn main() anyerror!void { | ... | @@ -767,7 +767,7 @@ pub fn main() anyerror!void { |
| 767 | try stdout.print( | 767 | try stdout.print( |
| 768 | \\.{{ | 768 | \\.{{ |
| 769 | \\ .name = "{s}", | 769 | \\ .name = "{s}", |
| 770 | \\ .syntax = {s}, | 770 | \\ .syntax = {f}, |
| 771 | \\ .zig_equivalent = .{s}, | 771 | \\ .zig_equivalent = .{s}, |
| 772 | \\ .pd1 = {}, | 772 | \\ .pd1 = {}, |
| 773 | \\ .pd2 = {}, | 773 | \\ .pd2 = {}, |
| ... | @@ -797,7 +797,7 @@ pub fn main() anyerror!void { | ... | @@ -797,7 +797,7 @@ pub fn main() anyerror!void { |
| 797 | try stdout.print( | 797 | try stdout.print( |
| 798 | \\.{{ | 798 | \\.{{ |
| 799 | \\ .name = "{s}", | 799 | \\ .name = "{s}", |
| 800 | \\ .syntax = {s}, | 800 | \\ .syntax = {f}, |
| 801 | \\ .zig_equivalent = .other, | 801 | \\ .zig_equivalent = .other, |
| 802 | \\ .pd1 = {}, | 802 | \\ .pd1 = {}, |
| 803 | \\ .pd2 = {}, | 803 | \\ .pd2 = {}, |
| ... | @@ -845,14 +845,10 @@ const Syntax = union(enum) { | ... | @@ -845,14 +845,10 @@ const Syntax = union(enum) { |
| 845 | 845 | ||
| 846 | pub fn format( | 846 | pub fn format( |
| 847 | self: Syntax, | 847 | self: Syntax, |
| 848 | comptime fmt: []const u8, | 848 | out_stream: *std.Io.Writer, |
| 849 | options: std.fmt.FormatOptions, | 849 | ) std.Io.Writer.Error!void { |
| 850 | out_stream: anytype, | ||
| 851 | ) !void { | ||
| 852 | _ = fmt; | ||
| 853 | _ = options; | ||
| 854 | switch (self) { | 850 | switch (self) { |
| 855 | .multi_arg => |n| return out_stream.print(".{{.{s}={}}}", .{ @tagName(self), n }), | 851 | .multi_arg => |n| return out_stream.print(".{{.{t}={d}}}", .{ self, n }), |
| 856 | else => return out_stream.print(".{s}", .{@tagName(self)}), | 852 | else => return out_stream.print(".{s}", .{@tagName(self)}), |
| 857 | } | 853 | } |
| 858 | } | 854 | } |
tools/update_cpu_features.zig+22-22| ... | @@ -1906,7 +1906,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1906,7 +1906,7 @@ fn processOneTarget(job: Job) void { |
| 1906 | var zig_code_file = try target_dir.createFile(zig_code_basename, .{}); | 1906 | var zig_code_file = try target_dir.createFile(zig_code_basename, .{}); |
| 1907 | defer zig_code_file.close(); | 1907 | defer zig_code_file.close(); |
| 1908 | 1908 | ||
| 1909 | var bw = std.io.bufferedWriter(zig_code_file.writer()); | 1909 | var bw = std.io.bufferedWriter(zig_code_file.deprecatedWriter()); |
| 1910 | const w = bw.writer(); | 1910 | const w = bw.writer(); |
| 1911 | 1911 | ||
| 1912 | try w.writeAll( | 1912 | try w.writeAll( |
| ... | @@ -1920,7 +1920,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1920,7 +1920,7 @@ fn processOneTarget(job: Job) void { |
| 1920 | ); | 1920 | ); |
| 1921 | 1921 | ||
| 1922 | for (all_features.items, 0..) |feature, i| { | 1922 | for (all_features.items, 0..) |feature, i| { |
| 1923 | try w.print("\n {p},", .{std.zig.fmtId(feature.zig_name)}); | 1923 | try w.print("\n {f},", .{std.zig.fmtId(feature.zig_name)}); |
| 1924 | 1924 | ||
| 1925 | if (i == all_features.items.len - 1) try w.writeAll("\n"); | 1925 | if (i == all_features.items.len - 1) try w.writeAll("\n"); |
| 1926 | } | 1926 | } |
| ... | @@ -1949,27 +1949,27 @@ fn processOneTarget(job: Job) void { | ... | @@ -1949,27 +1949,27 @@ fn processOneTarget(job: Job) void { |
| 1949 | for (all_features.items) |feature| { | 1949 | for (all_features.items) |feature| { |
| 1950 | if (feature.llvm_name) |llvm_name| { | 1950 | if (feature.llvm_name) |llvm_name| { |
| 1951 | try w.print( | 1951 | try w.print( |
| 1952 | \\ result[@intFromEnum(Feature.{p_})] = .{{ | 1952 | \\ result[@intFromEnum(Feature.{f})] = .{{ |
| 1953 | \\ .llvm_name = "{}", | 1953 | \\ .llvm_name = "{f}", |
| 1954 | \\ .description = "{}", | 1954 | \\ .description = "{f}", |
| 1955 | \\ .dependencies = featureSet(&[_]Feature{{ | 1955 | \\ .dependencies = featureSet(&[_]Feature{{ |
| 1956 | , | 1956 | , |
| 1957 | .{ | 1957 | .{ |
| 1958 | std.zig.fmtId(feature.zig_name), | 1958 | std.zig.fmtIdPU(feature.zig_name), |
| 1959 | std.zig.fmtEscapes(llvm_name), | 1959 | std.zig.fmtString(llvm_name), |
| 1960 | std.zig.fmtEscapes(feature.desc), | 1960 | std.zig.fmtString(feature.desc), |
| 1961 | }, | 1961 | }, |
| 1962 | ); | 1962 | ); |
| 1963 | } else { | 1963 | } else { |
| 1964 | try w.print( | 1964 | try w.print( |
| 1965 | \\ result[@intFromEnum(Feature.{p_})] = .{{ | 1965 | \\ result[@intFromEnum(Feature.{f})] = .{{ |
| 1966 | \\ .llvm_name = null, | 1966 | \\ .llvm_name = null, |
| 1967 | \\ .description = "{}", | 1967 | \\ .description = "{f}", |
| 1968 | \\ .dependencies = featureSet(&[_]Feature{{ | 1968 | \\ .dependencies = featureSet(&[_]Feature{{ |
| 1969 | , | 1969 | , |
| 1970 | .{ | 1970 | .{ |
| 1971 | std.zig.fmtId(feature.zig_name), | 1971 | std.zig.fmtIdPU(feature.zig_name), |
| 1972 | std.zig.fmtEscapes(feature.desc), | 1972 | std.zig.fmtString(feature.desc), |
| 1973 | }, | 1973 | }, |
| 1974 | ); | 1974 | ); |
| 1975 | } | 1975 | } |
| ... | @@ -1996,7 +1996,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -1996,7 +1996,7 @@ fn processOneTarget(job: Job) void { |
| 1996 | } else { | 1996 | } else { |
| 1997 | try w.writeAll("\n"); | 1997 | try w.writeAll("\n"); |
| 1998 | for (dependencies.items) |dep| { | 1998 | for (dependencies.items) |dep| { |
| 1999 | try w.print(" .{p_},\n", .{std.zig.fmtId(dep)}); | 1999 | try w.print(" .{f},\n", .{std.zig.fmtIdPU(dep)}); |
| 2000 | } | 2000 | } |
| 2001 | try w.writeAll( | 2001 | try w.writeAll( |
| 2002 | \\ }), | 2002 | \\ }), |
| ... | @@ -2033,24 +2033,24 @@ fn processOneTarget(job: Job) void { | ... | @@ -2033,24 +2033,24 @@ fn processOneTarget(job: Job) void { |
| 2033 | mem.sort([]const u8, cpu_features.items, {}, asciiLessThan); | 2033 | mem.sort([]const u8, cpu_features.items, {}, asciiLessThan); |
| 2034 | if (cpu.llvm_name) |llvm_name| { | 2034 | if (cpu.llvm_name) |llvm_name| { |
| 2035 | try w.print( | 2035 | try w.print( |
| 2036 | \\ pub const {}: CpuModel = .{{ | 2036 | \\ pub const {f}: CpuModel = .{{ |
| 2037 | \\ .name = "{}", | 2037 | \\ .name = "{f}", |
| 2038 | \\ .llvm_name = "{}", | 2038 | \\ .llvm_name = "{f}", |
| 2039 | \\ .features = featureSet(&[_]Feature{{ | 2039 | \\ .features = featureSet(&[_]Feature{{ |
| 2040 | , .{ | 2040 | , .{ |
| 2041 | std.zig.fmtId(cpu.zig_name), | 2041 | std.zig.fmtId(cpu.zig_name), |
| 2042 | std.zig.fmtEscapes(cpu.zig_name), | 2042 | std.zig.fmtString(cpu.zig_name), |
| 2043 | std.zig.fmtEscapes(llvm_name), | 2043 | std.zig.fmtString(llvm_name), |
| 2044 | }); | 2044 | }); |
| 2045 | } else { | 2045 | } else { |
| 2046 | try w.print( | 2046 | try w.print( |
| 2047 | \\ pub const {}: CpuModel = .{{ | 2047 | \\ pub const {f}: CpuModel = .{{ |
| 2048 | \\ .name = "{}", | 2048 | \\ .name = "{f}", |
| 2049 | \\ .llvm_name = null, | 2049 | \\ .llvm_name = null, |
| 2050 | \\ .features = featureSet(&[_]Feature{{ | 2050 | \\ .features = featureSet(&[_]Feature{{ |
| 2051 | , .{ | 2051 | , .{ |
| 2052 | std.zig.fmtId(cpu.zig_name), | 2052 | std.zig.fmtId(cpu.zig_name), |
| 2053 | std.zig.fmtEscapes(cpu.zig_name), | 2053 | std.zig.fmtString(cpu.zig_name), |
| 2054 | }); | 2054 | }); |
| 2055 | } | 2055 | } |
| 2056 | if (cpu_features.items.len == 0) { | 2056 | if (cpu_features.items.len == 0) { |
| ... | @@ -2062,7 +2062,7 @@ fn processOneTarget(job: Job) void { | ... | @@ -2062,7 +2062,7 @@ fn processOneTarget(job: Job) void { |
| 2062 | } else { | 2062 | } else { |
| 2063 | try w.writeAll("\n"); | 2063 | try w.writeAll("\n"); |
| 2064 | for (cpu_features.items) |feature_zig_name| { | 2064 | for (cpu_features.items) |feature_zig_name| { |
| 2065 | try w.print(" .{p_},\n", .{std.zig.fmtId(feature_zig_name)}); | 2065 | try w.print(" .{f},\n", .{std.zig.fmtIdPU(feature_zig_name)}); |
| 2066 | } | 2066 | } |
| 2067 | try w.writeAll( | 2067 | try w.writeAll( |
| 2068 | \\ }), | 2068 | \\ }), |
tools/update_crc_catalog.zig+2-2| ... | @@ -30,7 +30,7 @@ pub fn main() anyerror!void { | ... | @@ -30,7 +30,7 @@ pub fn main() anyerror!void { |
| 30 | var zig_code_file = try hash_target_dir.createFile("crc.zig", .{}); | 30 | var zig_code_file = try hash_target_dir.createFile("crc.zig", .{}); |
| 31 | defer zig_code_file.close(); | 31 | defer zig_code_file.close(); |
| 32 | 32 | ||
| 33 | var cbw = std.io.bufferedWriter(zig_code_file.writer()); | 33 | var cbw = std.io.bufferedWriter(zig_code_file.deprecatedWriter()); |
| 34 | defer cbw.flush() catch unreachable; | 34 | defer cbw.flush() catch unreachable; |
| 35 | const code_writer = cbw.writer(); | 35 | const code_writer = cbw.writer(); |
| 36 | 36 | ||
| ... | @@ -55,7 +55,7 @@ pub fn main() anyerror!void { | ... | @@ -55,7 +55,7 @@ pub fn main() anyerror!void { |
| 55 | var zig_test_file = try crc_target_dir.createFile("test.zig", .{}); | 55 | var zig_test_file = try crc_target_dir.createFile("test.zig", .{}); |
| 56 | defer zig_test_file.close(); | 56 | defer zig_test_file.close(); |
| 57 | 57 | ||
| 58 | var tbw = std.io.bufferedWriter(zig_test_file.writer()); | 58 | var tbw = std.io.bufferedWriter(zig_test_file.deprecatedWriter()); |
| 59 | defer tbw.flush() catch unreachable; | 59 | defer tbw.flush() catch unreachable; |
| 60 | const test_writer = tbw.writer(); | 60 | const test_writer = tbw.writer(); |
| 61 | 61 |