From 674fc4441e640158bc476b1b2c8d0145a65be1ff Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Sat, 12 Jul 2025 21:35:12 -0600 Subject: [PATCH] chore: upgrade to zig v0.14.0 --- build.zig | 12 ------------ build.zig.zon | 5 +++-- src/records.zig | 27 +++++++++++++++------------ 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/build.zig b/build.zig index 9a26412..f5ef9d5 100644 --- a/build.zig +++ b/build.zig @@ -1,18 +1,6 @@ const std = @import("std"); const builtin = @import("builtin"); -comptime { - const required_zig = "0.12.0-dev.2150+63de8a598"; - const current_zig = builtin.zig_version; - const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; - if (current_zig.order(min_zig) == .lt) { - @compileError(std.fmt.comptimePrint( - "Your Zig version v{} does not meet the minimum build requirement of v{}", - .{ current_zig, min_zig }, - )); - } -} - // Although this function looks imperative, note that its job is to // declaratively construct a build graph that will be executed by an external // runner. diff --git a/build.zig.zon b/build.zig.zon index b961ce1..040dfc0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,8 +1,9 @@ .{ - .name = "sonic-pdb-parser", + .name = .sonic_pdb_parser, + .fingerprint = 0x58ec5ebdefe1a198, // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. - .version = "0.0.0", + .version = "0.1.0", .paths = .{ "build.zig", "build.zig.zon", diff --git a/src/records.zig b/src/records.zig index d158c37..116a138 100644 --- a/src/records.zig +++ b/src/records.zig @@ -131,7 +131,8 @@ pub const RunRecord = struct { } pub fn writeCSVHeader(file: std.fs.File) !void { - const fields = @typeInfo(RunRecord).Struct.fields; + // const fields = @typeInfo(RunRecord).Struct.fields; + const fields = @typeInfo(RunRecord).@"struct".fields; const len = fields.len; inline for (fields, 0..) |field, idx| { std.debug.print("{s}\n", .{field.name}); @@ -305,27 +306,29 @@ pub const Record = union(RecordType) { if (comptime std.mem.eql(u8, fmt, "json")) { _ = try std.json.stringify(self, .{}, writer); } else { - const uInfo = @typeInfo(@TypeOf(self)).Union; + // const uInfo = @typeInfo(@TypeOf(self)).Union; + const uInfo = @typeInfo(@TypeOf(self)).@"union"; + if (uInfo.tag_type) |UnionTagType| { inline for (uInfo.fields) |uField| { if (self == @field(UnionTagType, uField.name)) { switch (@typeInfo(uField.type)) { - .Void => try writer.print("{s}", .{uField.name}), - .Struct => { - const fields = @typeInfo(uField.type).Struct.fields; + .void => try writer.print("{s}", .{uField.name}), + .@"struct" => { + const fields = @typeInfo(uField.type).@"struct".fields; inline for (fields) |field| { const fmt2 = switch (@typeInfo(field.type)) { - .Optional => |optional| switch (@typeInfo(optional.child)) { - .Pointer => |ptr_info| switch (ptr_info.size) { - .Slice, .Many => "{?s}", + .optional => |optional| switch (@typeInfo(optional.child)) { + .pointer => |ptr_info| switch (ptr_info.size) { + .slice, .many => "{?s}", else => "{?}", }, else => "{?}", }, - .Float => "{d:.3}", - .Int => "{}", - .Pointer => |ptr_info| switch (ptr_info.size) { - .Slice, .Many => "{s}", + .float => "{d:.3}", + .int => "{}", + .pointer => |ptr_info| switch (ptr_info.size) { + .slice, .many => "{s}", else => "{}", }, // .Pointer => |ptr| if (ptr.child == .Slice) "{s}", -- 2.51.2