From 70b03d9b97721b01a2875533d2e30e699e47ff4b Mon Sep 17 00:00:00 2001 From: mlugg Date: Mon, 28 Jul 2025 13:03:28 +0100 Subject: [PATCH 1/3] update to latest Zig version Just one minor breaking change in `std.zig`. --- build.zig.zon | 2 +- src/Translator.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 70a0b18..3f1da6d 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,7 +5,7 @@ .fingerprint = 0x1c84f6455a54f043, // Changing this has security and trust implications. - .minimum_zig_version = "0.15.0-dev.1145+3ae0ba096", + .minimum_zig_version = "0.15.0-dev.1262+e12dc4947", .dependencies = .{ .aro = .{ diff --git a/src/Translator.zig b/src/Translator.zig index 7997074..189a786 100644 --- a/src/Translator.zig +++ b/src/Translator.zig @@ -3883,7 +3883,7 @@ fn createNumberNode(t: *Translator, num: anytype, num_kind: enum { int, float }) fn createCharLiteralNode(t: *Translator, narrow: bool, val: u32) TransError!ZigNode { return ZigTag.char_literal.create(t.arena, if (narrow) - try std.fmt.allocPrint(t.arena, "'{f}'", .{std.zig.fmtChar(&.{@as(u8, @intCast(val))})}) + try std.fmt.allocPrint(t.arena, "'{f}'", .{std.zig.fmtChar(@as(u8, @intCast(val)))}) else try std.fmt.allocPrint(t.arena, "'\\u{{{x}}}'", .{val})); } From 5398a128e4c5022c781c508e8c7c6854ec4c330b Mon Sep 17 00:00:00 2001 From: mlugg Date: Mon, 28 Jul 2025 13:03:50 +0100 Subject: [PATCH 2/3] Translator: add depfile generation I confirmed that this works by modifying one of the examples so that C code included a header. I was able to replicate that before this change, changes to the header did *not* trigger rebuilds, and after this change, they did. --- build/Translator.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/Translator.zig b/build/Translator.zig index 90e7e4c..cfb78c2 100644 --- a/build/Translator.zig +++ b/build/Translator.zig @@ -71,12 +71,14 @@ pub fn initInner( // Try our best to get a reasonable name; we need one to name the steps and the output file. const name = options.name orelse std.fs.path.stem(options.c_source_file.getDisplayName()); - // We start with the basic command: 'path/to/translate-c in.c -o out.zig' + // We start with the basic command: 'path/to/translate-c in.c -o out.zig -MD -MV -MF deps.d' const run = b.addRunArtifact(tc_conf.exe); run.setName(b.fmt("translate-c {s}", .{name})); run.addFileArg(options.c_source_file); run.addArg("-o"); const output_file = run.addOutputFileArg(b.fmt("{s}.zig", .{name})); + run.addArgs(&.{ "-MD", "-MV", "-MF" }); + _ = run.addDepFileOutputArg("deps.d"); // Now we are free to add extra args to `run` as needed. const mod = b.createModule(.{ From cb8973a121a6de43d3ebc6808cd8070d716e7ea1 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Mon, 28 Jul 2025 16:10:05 +0300 Subject: [PATCH 3/3] update Aro for depfile fixes --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 3f1da6d..25f0bd5 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,8 +9,8 @@ .dependencies = .{ .aro = .{ - .url = "git+https://github.com/Vexu/arocc#e9ea4aabfd39cd5e5f7b69bd9c85b878ea0c6f43", - .hash = "aro-0.0.0-JSD1QmmYJwCdKUjcL-Ltj5xDC6AjprNc79REvndGfAKE", + .url = "git+https://github.com/Vexu/arocc#d0ebb5915074348fc7c8494415efaa569537ba2b", + .hash = "aro-0.0.0-JSD1QreaJwAaUgJOp3h4ZfiTG_gDocaYVqGEefWihgOQ", }, },