From da0088224c117be8e2937480c82a490fc41eed4e Mon Sep 17 00:00:00 2001 From: Organ1sm Date: Fri, 20 Sep 2024 15:16:31 +0800 Subject: [PATCH 1/2] zig: update the latest zig --- src/aro/Preprocessor.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aro/Preprocessor.zig b/src/aro/Preprocessor.zig index 63bf0858..8e3f535a 100644 --- a/src/aro/Preprocessor.zig +++ b/src/aro/Preprocessor.zig @@ -271,7 +271,7 @@ fn clearBuffers(pp: *Preprocessor) void { pub fn expansionSlice(pp: *Preprocessor, tok: Tree.TokenIndex) []Source.Location { const S = struct { fn orderTokenIndex(context: Tree.TokenIndex, item: Tree.TokenIndex) std.math.Order { - return std.math.order(item, context); + return std.math.order(context, item); } }; From 6c4e218cd7b47246057d98c8ea3276548559da73 Mon Sep 17 00:00:00 2001 From: Organ1sm Date: Fri, 20 Sep 2024 15:35:39 +0800 Subject: [PATCH 2/2] zig: rework fuzzing api related https://github.com/ziglang/zig/pull/21370 --- src/aro/Tokenizer.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aro/Tokenizer.zig b/src/aro/Tokenizer.zig index f703940f..7ab33103 100644 --- a/src/aro/Tokenizer.zig +++ b/src/aro/Tokenizer.zig @@ -2151,12 +2151,13 @@ test "C23 keywords" { } test "Tokenizer fuzz test" { + return std.testing.fuzz(testTokenizerFuzz, .{}); +} + +fn testTokenizerFuzz(input_bytes: []const u8) anyerror!void { var comp = Compilation.init(std.testing.allocator, std.fs.cwd()); defer comp.deinit(); - const input_bytes = std.testing.fuzzInput(.{}); - if (input_bytes.len == 0) return; - const source = try comp.addSourceFromBuffer("fuzz.c", input_bytes); var tokenizer: Tokenizer = .{