Skip to content

Commit

Permalink
Update to latest Zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Feb 15, 2023
1 parent 9fe4271 commit 49bdff9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
17 changes: 10 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *std.Build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const mode = b.standardOptimizeOption(.{});

const exe = b.addExecutable("zcoff", "src/main.zig");
exe.addPackagePath("clap", "zig-clap/clap.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
const exe = b.addExecutable(.{
.name = "zcoff",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = mode,
});
exe.addAnonymousModule("clap", .{ .source_file = .{ .path = "zig-clap/clap.zig" } });
exe.install();

const run_cmd = exe.run();
Expand All @@ -20,6 +23,6 @@ pub fn build(b: *std.build.Builder) void {
run_step.dependOn(&run_cmd.step);

const test_step = b.step("test", "Run all tests");
const tests = b.addTest("src/Zcoff.zig");
const tests = b.addTest(.{ .root_source_file = .{ .path = "src/Zcoff.zig" } });
test_step.dependOn(&tests.step);
}
4 changes: 2 additions & 2 deletions src/Zcoff.zig
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ fn printHeaders(self: *Zcoff, writer: anytype) !void {

fn printDllFlags(flags: coff.DllFlags, writer: anytype) !void {
inline for (std.meta.fields(coff.DllFlags)) |field| {
if (field.field_type == u1) {
if (field.type == u1) {
if (@field(flags, field.name) == 0b1) {
try writer.print("{s: >22} {s}\n", .{ "", field.name });
}
Expand Down Expand Up @@ -412,7 +412,7 @@ fn printSectionHeader(self: *Zcoff, writer: anytype, sect_id: u16, sect_hdr: *al

try writer.print("{x: >20} flags\n", .{@bitCast(u32, sect_hdr.flags)});
inline for (std.meta.fields(coff.SectionHeaderFlags)) |flag_field| {
if (flag_field.field_type == u1) {
if (flag_field.type == u1) {
if (@field(sect_hdr.flags, flag_field.name) == 0b1) {
try writer.print("{s: >22} {s}\n", .{ "", flag_field.name });
}
Expand Down
2 changes: 1 addition & 1 deletion zig-clap

0 comments on commit 49bdff9

Please sign in to comment.