ReviewOS

also looking at this

zig-utils/zig-regex

Migrate to zig 0.16

#5
Closed illya-laifu wants to merge zig-0.16-migrations into main
13 files +222 -239

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

build.zigmodified+1-0
Changes to build.zig
@@ -39,6 +39,7 @@ pub fn build(b: *std.Build) void {
3939 // Later on we'll use this module as the root module of a test executable
4040 // which requires us to specify a target.
4141 .target = target,
42 .link_libc = true,
4243 });
4344
4445 // Here we define an executable. An executable needs to have a root module
src/profiling.zigmodified+4-4
Changes to src/profiling.zig
@@ -192,13 +192,13 @@ test "profiler basic operations" {
192192 const io = std.testing.io;
193193 var profiler = Profiler.init(allocator, io, true);
194194
195 profiler.startCompilation();
195 profiler.startCompilation(io);
196196 // Do some work (just loop to consume time)
197197 var i: usize = 0;
198198 while (i < 1000) : (i += 1) {
199199 _ = i * i;
200200 }
201 profiler.endCompilation();
201 profiler.endCompilation(io);
202202
203203 profiler.recordStateCreation(5);
204204 profiler.recordBacktrack();
@@ -216,8 +216,8 @@ test "scoped timer" {
216216 var profiler = Profiler.init(allocator, io, true);
217217
218218 {
219 var timer = ScopedTimer.init(&profiler, .match);
220 defer timer.deinit();
219 var timer = ScopedTimer.init(&profiler, io, .match);
220 defer timer.deinit(io);
221221 // Do some work
222222 var i: usize = 0;
223223 while (i < 1000) : (i += 1) {
tests/thread_safety.zigmodified+4-3
Changes to tests/thread_safety.zig
@@ -191,7 +191,8 @@ test "RegexCache basic operations" {
191191
192192test "thread-safe allocator with concurrent matching" {
193193 // Use thread-safe allocator for concurrent access
194 var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){};
194 var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){};
195 // TODO: can use this for leak detection
195196 defer _ = gpa.deinit();
196197 const allocator = gpa.allocator();
197198
@@ -222,7 +223,7 @@ test "thread-safe allocator with concurrent matching" {
222223}
223224
224225test "concurrent matching different patterns" {
225 var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){};
226 var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){};
226227 defer _ = gpa.deinit();
227228 const allocator = gpa.allocator();
228229
@@ -272,7 +273,7 @@ test "concurrent matching different patterns" {
272273}
273274
274275test "stress test: many threads many matches" {
275 var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){};
276 var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){};
276277 defer _ = gpa.deinit();
277278 const allocator = gpa.allocator();
278279