From 15adb1bab3d807de155a45e594a8888def148b05 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 21 Oct 2024 12:33:06 +0200 Subject: [PATCH] Pin to Zig 0.13.0 --- .github/workflows/main.yml | 8 ++++---- build.zig | 3 +-- build.zig.zon | 8 ++++---- flake.nix | 2 +- src/Coff.zig | 14 +++++++------- src/Coff/Symbol.zig | 2 +- src/Elf.zig | 6 +++--- src/Elf/Atom.zig | 2 +- src/Elf/InternalObject.zig | 8 ++++---- src/Elf/LdScript.zig | 2 +- src/Elf/Object.zig | 16 ++++++++-------- src/Elf/SharedObject.zig | 16 ++++++++-------- src/Elf/Symbol.zig | 2 +- src/Elf/Thunk.zig | 2 +- src/Elf/merge_section.zig | 4 ++-- src/MachO/Atom.zig | 2 +- src/MachO/Dylib.zig | 8 ++++---- src/MachO/InternalObject.zig | 16 ++++++++-------- src/MachO/Object.zig | 16 ++++++++-------- src/MachO/Symbol.zig | 2 +- src/Wasm/Object.zig | 4 ++-- src/riscv.zig | 2 +- test/macho.zig | 2 +- test/test.zig | 4 ++-- 24 files changed, 75 insertions(+), 76 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3fe743dc..b6222a3e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: - version: master + version: 0.13.0 - run: zig version - run: zig fmt --check src - run: zig build test -Dhas-static -Dhas-zig -Dhas-objc-msgsend-stubs @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: - version: master + version: 0.13.0 - uses: ilammy/msvc-dev-cmd@v1 - run: zig version - run: zig fmt --check src @@ -41,7 +41,7 @@ jobs: - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: - version: master + version: 0.13.0 - run: sudo apt-get install -y musl-tools - run: zig version - run: CC=musl-gcc zig build test -Dhas-static -Dmusl @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v3 - uses: mlugg/setup-zig@v1 with: - version: master + version: 0.13.0 - run: sudo apt-get install -y clang - run: zig version - run: CC=clang zig build test -Dhas-static -Dsystem-compiler=clang diff --git a/build.zig b/build.zig index 55de246b..02542104 100644 --- a/build.zig +++ b/build.zig @@ -155,8 +155,7 @@ const CreateSymlinksStep = struct { return self; } - fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) anyerror!void { - const prog_node = options.progress_node; + fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void { const self: *CreateSymlinksStep = @fieldParentPtr("step", step); const install_path = self.install.artifact.getEmittedBin().getPath(self.builder); const rel_source = fs.path.basename(install_path); diff --git a/build.zig.zon b/build.zig.zon index c4ce7435..3419dc5b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -4,12 +4,12 @@ .dependencies = .{ .@"zig-yaml" = .{ - .url = "https://github.com/kubkon/zig-yaml/archive/a551d00ab041f4799420ab224cdc3efdf978092c.tar.gz", - .hash = "12208398e1393f83a39d03f3ef4893607650b6227dc7f1eee3db4d163fbc2c0c37ca", + .url = "https://github.com/kubkon/zig-yaml/archive/325dbdd276604dccf184c32fef9600b0ac48343d.tar.gz", + .hash = "1220e8870ca83e47b98807e89b5b636072413f6c09f9b26037e4c98c55e4960ac55a", }, .@"zig-dis-x86_64" = .{ - .url = "https://github.com/kubkon/zig-dis-x86_64/archive/53b2e2dae9e824d7b4994e767c2cbb4f39e443a9.tar.gz", - .hash = "1220f2b9588352067d5b6f3b68d5461cea52f4425c9144f6757db775cf2f19cb5d26", + .url = "https://github.com/kubkon/zig-dis-x86_64/archive/5203b9affc5045e000ae7963d988e155e98e396d.tar.gz", + .hash = "12207252f0592e53e8794d5a41409791d5c8c70e0de67bfba48844406619847cc971", }, }, diff --git a/flake.nix b/flake.nix index 002fa5b0..cbc2e2ec 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,7 @@ devShells.default = pkgs.stdenvNoCC.mkDerivation { name = "emerald"; nativeBuildInputs = with pkgs; [ - zigpkgs.master-2024-10-08 + zigpkgs."0.13.0" zlspkgs.default ]; }; diff --git a/src/Coff.zig b/src/Coff.zig index 8ee69be8..572fdd88 100644 --- a/src/Coff.zig +++ b/src/Coff.zig @@ -1293,14 +1293,14 @@ fn writeHeader(self: *Coff) !void { pub fn isCoffObj(buffer: *const [@sizeOf(coff.CoffHeader)]u8) bool { const header = @as(*align(1) const coff.CoffHeader, @ptrCast(buffer)).*; - if (header.machine == .UNKNOWN and header.number_of_sections == 0xffff) return false; + if (header.machine == .Unknown and header.number_of_sections == 0xffff) return false; if (header.size_of_optional_header != 0) return false; return true; } pub fn isImportLib(buffer: *const [@sizeOf(coff.ImportHeader)]u8) bool { const header = @as(*align(1) const coff.ImportHeader, @ptrCast(buffer)).*; - return header.sig1 == .UNKNOWN and header.sig2 == 0xffff; + return header.sig1 == .Unknown and header.sig2 == 0xffff; } pub fn isArchive(data: *const [Archive.magic.len]u8) bool { @@ -1502,14 +1502,14 @@ pub fn getSymbol(self: *Coff, index: Symbol.Index) *Symbol { } pub fn addSymbolExtra(self: *Coff, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(self.base.allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } pub fn addSymbolExtraAssumeCapacity(self: *Coff, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -1521,7 +1521,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *Coff, extra: Symbol.Extra) u32 { pub fn getSymbolExtra(self: Coff, index: u32) ?Symbol.Extra { if (index == 0) return null; - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -1536,7 +1536,7 @@ pub fn getSymbolExtra(self: Coff, index: u32) ?Symbol.Extra { pub fn setSymbolExtra(self: *Coff, index: u32, extra: Symbol.Extra) void { assert(index > 0); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), @@ -1645,7 +1645,7 @@ fn formatSectionFlags( ) !void { _ = options; _ = unused_fmt_string; - inline for (@typeInfo(coff.SectionHeaderFlags).@"struct".fields) |field| { + inline for (@typeInfo(coff.SectionHeaderFlags).Struct.fields) |field| { if (@field(flags, field.name) == 0b1) { try writer.writeAll(field.name ++ " "); } diff --git a/src/Coff/Symbol.zig b/src/Coff/Symbol.zig index 4d392f57..a87bccc7 100644 --- a/src/Coff/Symbol.zig +++ b/src/Coff/Symbol.zig @@ -119,7 +119,7 @@ pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, coff_file: *Coff) !void { symbol.extra = try coff_file.addSymbolExtra(.{}); } var extra = symbol.getExtra(coff_file).?; - inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| { + inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| { if (@field(opts, field.name)) |x| { @field(extra, field.name) = x; } diff --git a/src/Elf.zig b/src/Elf.zig index 7ff921bf..0751fa14 100644 --- a/src/Elf.zig +++ b/src/Elf.zig @@ -41,11 +41,11 @@ resolver: SymbolResolver = .{}, undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{}, dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{}, -shstrtab: std.ArrayListUnmanaged(u8) = .empty, +shstrtab: std.ArrayListUnmanaged(u8) = .{}, symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .{}, dynsym: DynsymSection = .{}, -dynstrtab: std.ArrayListUnmanaged(u8) = .empty, +dynstrtab: std.ArrayListUnmanaged(u8) = .{}, versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, verneed: VerneedSection = .{}, diff --git a/src/Elf/Atom.zig b/src/Elf/Atom.zig index 8ac00777..8d7fdcd8 100644 --- a/src/Elf/Atom.zig +++ b/src/Elf/Atom.zig @@ -125,7 +125,7 @@ const AddExtraOpts = struct { pub fn addExtra(atom: *Atom, opts: AddExtraOpts, elf_file: *Elf) void { const object = atom.getObject(elf_file); var extras = object.getAtomExtra(atom.extra); - inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| { + inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| { if (@field(opts, field.name)) |x| { @field(extras, field.name) = x; } diff --git a/src/Elf/InternalObject.zig b/src/Elf/InternalObject.zig index a299b6c2..5efd95e2 100644 --- a/src/Elf/InternalObject.zig +++ b/src/Elf/InternalObject.zig @@ -399,14 +399,14 @@ fn addSymbolAssumeCapacity(self: *InternalObject) Symbol.Index { } pub fn addSymbolExtra(self: *InternalObject, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } pub fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -417,7 +417,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) } pub fn getSymbolExtra(self: *InternalObject, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -431,7 +431,7 @@ pub fn getSymbolExtra(self: *InternalObject, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *InternalObject, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/Elf/LdScript.zig b/src/Elf/LdScript.zig index 12baeb65..ca95ad27 100644 --- a/src/Elf/LdScript.zig +++ b/src/Elf/LdScript.zig @@ -105,7 +105,7 @@ const Command = enum { as_needed, fn fromString(s: []const u8) ?Command { - inline for (@typeInfo(Command).@"enum".fields) |field| { + inline for (@typeInfo(Command).Enum.fields) |field| { const upper_name = n: { comptime var buf: [field.name.len]u8 = undefined; inline for (field.name, 0..) |c, i| { diff --git a/src/Elf/Object.zig b/src/Elf/Object.zig index 20721672..6466b8af 100644 --- a/src/Elf/Object.zig +++ b/src/Elf/Object.zig @@ -1038,14 +1038,14 @@ fn addSymbolAssumeCapacity(self: *Object) Symbol.Index { } pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -1056,7 +1056,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 { } pub fn getSymbolExtra(self: *Object, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -1070,7 +1070,7 @@ pub fn getSymbolExtra(self: *Object, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), @@ -1149,14 +1149,14 @@ pub fn getAtom(self: *Object, atom_index: Atom.Index) ?*Atom { } pub fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len); return self.addAtomExtraAssumeCapacity(extra); } pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 { const index = @as(u32, @intCast(self.atoms_extra.items.len)); - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields) |field| { self.atoms_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -1167,7 +1167,7 @@ pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 { } pub fn getAtomExtra(self: *Object, index: u32) Atom.Extra { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; var i: usize = index; var result: Atom.Extra = undefined; inline for (fields) |field| { @@ -1181,7 +1181,7 @@ pub fn getAtomExtra(self: *Object, index: u32) Atom.Extra { } pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.atoms_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/Elf/SharedObject.zig b/src/Elf/SharedObject.zig index 82802c3e..86bd608d 100644 --- a/src/Elf/SharedObject.zig +++ b/src/Elf/SharedObject.zig @@ -10,12 +10,12 @@ strtab: std.ArrayListUnmanaged(u8) = .{}, versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, verstrings: std.ArrayListUnmanaged(u32) = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .empty, -symbols_extra: std.ArrayListUnmanaged(u32) = .empty, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, +symbols: std.ArrayListUnmanaged(Symbol) = .{}, +symbols_extra: std.ArrayListUnmanaged(u32) = .{}, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, aliases: ?std.ArrayListUnmanaged(u32) = null, -dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty, +dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{}, needed: bool, alive: bool, @@ -420,14 +420,14 @@ fn addSymbolAssumeCapacity(self: *SharedObject) Symbol.Index { } pub fn addSymbolExtra(self: *SharedObject, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -438,7 +438,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u3 } pub fn getSymbolExtra(self: *SharedObject, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -452,7 +452,7 @@ pub fn getSymbolExtra(self: *SharedObject, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *SharedObject, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/Elf/Symbol.zig b/src/Elf/Symbol.zig index 44905e08..b742427c 100644 --- a/src/Elf/Symbol.zig +++ b/src/Elf/Symbol.zig @@ -242,7 +242,7 @@ const AddExtraOpts = struct { pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, elf_file: *Elf) void { var extra = symbol.getExtra(elf_file); - inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| { + inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| { if (@field(opts, field.name)) |x| { @field(extra, field.name) = x; } diff --git a/src/Elf/Thunk.zig b/src/Elf/Thunk.zig index 3315a1ca..6a4d1806 100644 --- a/src/Elf/Thunk.zig +++ b/src/Elf/Thunk.zig @@ -1,6 +1,6 @@ value: i64 = 0, out_shndx: u32 = 0, -symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, +symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{}, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/Elf/merge_section.zig b/src/Elf/merge_section.zig index 917122d7..38b30f9d 100644 --- a/src/Elf/merge_section.zig +++ b/src/Elf/merge_section.zig @@ -14,8 +14,8 @@ pub const MergeSection = struct { IndexContext, std.hash_map.default_max_load_percentage, ) = .{}, - subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty, - finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, + subsections: std.ArrayListUnmanaged(MergeSubsection) = .{}, + finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, pub fn deinit(msec: *MergeSection, allocator: Allocator) void { msec.bytes.deinit(allocator); diff --git a/src/MachO/Atom.zig b/src/MachO/Atom.zig index 480317c4..7803fb02 100644 --- a/src/MachO/Atom.zig +++ b/src/MachO/Atom.zig @@ -116,7 +116,7 @@ const AddExtraOpts = struct { pub fn addExtra(atom: *Atom, opts: AddExtraOpts, macho_file: *MachO) void { const file = atom.getFile(macho_file); var extra = file.getAtomExtra(atom.extra); - inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| { + inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| { if (@field(opts, field.name)) |x| { @field(extra, field.name) = x; } diff --git a/src/MachO/Dylib.zig b/src/MachO/Dylib.zig index c3678486..0dcb82b7 100644 --- a/src/MachO/Dylib.zig +++ b/src/MachO/Dylib.zig @@ -695,14 +695,14 @@ pub fn getSymbolRef(self: Dylib, index: Symbol.Index, macho_file: *MachO) MachO. } pub fn addSymbolExtra(self: *Dylib, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -713,7 +713,7 @@ fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 { } pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -727,7 +727,7 @@ pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *Dylib, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/MachO/InternalObject.zig b/src/MachO/InternalObject.zig index 74c87fc0..74acf70e 100644 --- a/src/MachO/InternalObject.zig +++ b/src/MachO/InternalObject.zig @@ -702,14 +702,14 @@ pub fn getAtoms(self: InternalObject) []const Atom.Index { } fn addAtomExtra(self: *InternalObject, allocator: Allocator, extra: Atom.Extra) !u32 { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len); return self.addAtomExtraAssumeCapacity(extra); } fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 { const index = @as(u32, @intCast(self.atoms_extra.items.len)); - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields) |field| { self.atoms_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -720,7 +720,7 @@ fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 { } pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; var i: usize = index; var result: Atom.Extra = undefined; inline for (fields) |field| { @@ -735,7 +735,7 @@ pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra { pub fn setAtomExtra(self: *InternalObject, index: u32, extra: Atom.Extra) void { assert(index > 0); - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.atoms_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), @@ -783,14 +783,14 @@ pub fn getSymbolRef(self: InternalObject, index: Symbol.Index, macho_file: *Mach } pub fn addSymbolExtra(self: *InternalObject, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -801,7 +801,7 @@ fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32 } pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -815,7 +815,7 @@ pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *InternalObject, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/MachO/Object.zig b/src/MachO/Object.zig index aa633a7e..73028a83 100644 --- a/src/MachO/Object.zig +++ b/src/MachO/Object.zig @@ -2360,14 +2360,14 @@ pub fn getAtoms(self: *Object) []const Atom.Index { } fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len); return self.addAtomExtraAssumeCapacity(extra); } fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 { const index = @as(u32, @intCast(self.atoms_extra.items.len)); - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields) |field| { self.atoms_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -2378,7 +2378,7 @@ fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 { } pub fn getAtomExtra(self: Object, index: u32) Atom.Extra { - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; var i: usize = index; var result: Atom.Extra = undefined; inline for (fields) |field| { @@ -2393,7 +2393,7 @@ pub fn getAtomExtra(self: Object, index: u32) Atom.Extra { pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void { assert(index > 0); - const fields = @typeInfo(Atom.Extra).@"struct".fields; + const fields = @typeInfo(Atom.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.atoms_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), @@ -2421,14 +2421,14 @@ pub fn getSymbolRef(self: Object, index: Symbol.Index, macho_file: *MachO) MachO } pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len); return self.addSymbolExtraAssumeCapacity(extra); } fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 { const index = @as(u32, @intCast(self.symbols_extra.items.len)); - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields) |field| { self.symbols_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), @@ -2439,7 +2439,7 @@ fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 { } pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; var i: usize = index; var result: Symbol.Extra = undefined; inline for (fields) |field| { @@ -2453,7 +2453,7 @@ pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra { } pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void { - const fields = @typeInfo(Symbol.Extra).@"struct".fields; + const fields = @typeInfo(Symbol.Extra).Struct.fields; inline for (fields, 0..) |field, i| { self.symbols_extra.items[index + i] = switch (field.type) { u32 => @field(extra, field.name), diff --git a/src/MachO/Symbol.zig b/src/MachO/Symbol.zig index 6646da3b..e06acd43 100644 --- a/src/MachO/Symbol.zig +++ b/src/MachO/Symbol.zig @@ -198,7 +198,7 @@ const AddExtraOpts = struct { pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, macho_file: *MachO) void { var extra = symbol.getExtra(macho_file); - inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| { + inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| { if (@field(opts, field.name)) |x| { @field(extra, field.name) = x; } diff --git a/src/Wasm/Object.zig b/src/Wasm/Object.zig index 439b449f..8a256ea5 100644 --- a/src/Wasm/Object.zig +++ b/src/Wasm/Object.zig @@ -867,7 +867,7 @@ fn ElementType(comptime ptr: type) type { /// signedness of the given type `T`. /// Asserts `T` is an integer. fn readLeb(comptime T: type, reader: anytype) !T { - return switch (@typeInfo(T).int.signedness) { + return switch (@typeInfo(T).Int.signedness) { .signed => try leb.readILEB128(T, reader), .unsigned => try leb.readULEB128(T, reader), }; @@ -877,7 +877,7 @@ fn readLeb(comptime T: type, reader: anytype) !T { /// Asserts `T` is an enum fn readEnum(comptime T: type, reader: anytype) !T { switch (@typeInfo(T)) { - .@"enum" => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))), + .Enum => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))), else => @compileError("T must be an enum. Instead was given type " ++ @typeName(T)), } } diff --git a/src/riscv.zig b/src/riscv.zig index 0923a25a..ebf0351c 100644 --- a/src/riscv.zig +++ b/src/riscv.zig @@ -419,7 +419,7 @@ pub fn writeSetSub6(comptime op: enum { set, sub }, code: *[1]u8, addend: anytyp pub fn writeAddend( comptime Int: type, comptime op: enum { add, sub }, - code: *[@typeInfo(Int).int.bits / 8]u8, + code: *[@typeInfo(Int).Int.bits / 8]u8, value: anytype, ) void { var V: Int = mem.readInt(Int, code, .little); diff --git a/test/macho.zig b/test/macho.zig index 989b77ff..60b57bbe 100644 --- a/test/macho.zig +++ b/test/macho.zig @@ -2516,7 +2516,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step { \\ return x; \\} \\comptime { - \\ @export(&foo, .{ .name = "bar", .linkage = .strong }); + \\ @export(foo, .{ .name = "bar", .linkage = .strong }); \\} ); diff --git a/test/test.zig b/test/test.zig index f93e6364..2c04d365 100644 --- a/test/test.zig +++ b/test/test.zig @@ -235,9 +235,9 @@ pub const SkipTestStep = struct { return self; } - fn make(step: *Step, options: Step.MakeOptions) anyerror!void { + fn make(step: *Step, prog_node: std.Progress.Node) anyerror!void { _ = step; - _ = options; + _ = prog_node; return error.MakeSkipped; } };