@zigc/lib 0.17.0-dev.389 → 0.17.0-dev.420

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,9 @@ pub const std_options: std.Options = .{
26
26
  pub fn main(init: process.Init.Minimal) !void {
27
27
  // The build runner is often short-lived, but thanks to `--watch` and `--webui`, that's not
28
28
  // always the case. So, we do need a true gpa for some things.
29
- var debug_gpa_state: std.heap.DebugAllocator(.{}) = .init;
30
- defer _ = debug_gpa_state.deinit();
31
- const gpa = debug_gpa_state.allocator();
29
+ var safe_gpa_state: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
30
+ defer _ = safe_gpa_state.deinit();
31
+ const gpa = safe_gpa_state.allocator();
32
32
 
33
33
  var threaded: std.Io.Threaded = .init(gpa, .{
34
34
  .environ = init.environ,
@@ -91,8 +91,8 @@ fn mainServer(init: std.process.Init.Minimal) !void {
91
91
  return std.process.exit(0);
92
92
  },
93
93
  .query_test_metadata => {
94
- testing.allocator_instance = .{};
95
- defer if (testing.allocator_instance.deinit() == .leak) {
94
+ testing.allocator_instance = .init(std.heap.page_allocator, .{});
95
+ defer if (testing.allocator_instance.deinit() != 0) {
96
96
  @panic("internal test runner memory leak");
97
97
  };
98
98
 
@@ -123,7 +123,10 @@ fn mainServer(init: std.process.Init.Minimal) !void {
123
123
 
124
124
  .run_test => {
125
125
  testing.environ = init.environ;
126
- testing.allocator_instance = .{};
126
+ testing.allocator_instance = .init(std.heap.page_allocator, .{
127
+ .canary = 0xc3a701ba,
128
+ .check_write_after_free = true,
129
+ });
127
130
  testing.io_instance = .init(testing.allocator, .{
128
131
  .argv0 = .init(init.args),
129
132
  .environ = init.environ,
@@ -150,8 +153,7 @@ fn mainServer(init: std.process.Init.Minimal) !void {
150
153
  },
151
154
  };
152
155
  testing.io_instance.deinit();
153
- const leak_count = testing.allocator_instance.detectLeaks();
154
- testing.allocator_instance.deinitWithoutLeakChecks();
156
+ const leak_count = testing.allocator_instance.deinit();
155
157
  try server.serveTestResults(.{
156
158
  .index = index,
157
159
  .flags = .{
@@ -173,8 +175,8 @@ fn mainServer(init: std.process.Init.Minimal) !void {
173
175
  // since they are not present.
174
176
  if (!builtin.fuzz) unreachable;
175
177
 
176
- var gpa_instance: std.heap.DebugAllocator(.{}) = .init;
177
- defer if (gpa_instance.deinit() == .leak) {
178
+ var gpa_instance: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
179
+ defer if (gpa_instance.deinit() != 0) {
178
180
  @panic("internal test runner memory leak");
179
181
  };
180
182
  const gpa = gpa_instance.allocator();
@@ -271,14 +273,17 @@ fn mainTerminal(init: std.process.Init.Minimal) void {
271
273
 
272
274
  var leaks: usize = 0;
273
275
  for (test_fn_list, 0..) |test_fn, i| {
274
- testing.allocator_instance = .{};
276
+ testing.allocator_instance = .init(std.heap.page_allocator, .{
277
+ .canary = 0xc3a701ba,
278
+ .check_write_after_free = true,
279
+ });
275
280
  testing.io_instance = .init(testing.allocator, .{
276
281
  .argv0 = .init(init.args),
277
282
  .environ = init.environ,
278
283
  });
279
284
  defer {
280
285
  testing.io_instance.deinit();
281
- if (testing.allocator_instance.deinit() == .leak) leaks += 1;
286
+ if (testing.allocator_instance.deinit() != 0) leaks += 1;
282
287
  }
283
288
  testing.log_level = .warn;
284
289
  testing.environ = init.environ;
@@ -430,8 +435,11 @@ var fuzz_runner: if (builtin.fuzz) struct {
430
435
  error.WriteFailed => panic("failed to write to stdout: {t}", .{stdout_writer.err.?}),
431
436
  };
432
437
 
433
- testing.allocator_instance = .{};
434
- defer if (testing.allocator_instance.deinit() == .leak) std.process.exit(1);
438
+ testing.allocator_instance = .init(std.heap.page_allocator, .{
439
+ .canary = 0xc3a701ba,
440
+ .check_write_after_free = true,
441
+ });
442
+ defer if (testing.allocator_instance.deinit() != 0) std.process.exit(1);
435
443
  is_fuzz_test = false;
436
444
 
437
445
  builtin.test_functions[fuzz_runner.indexes[i]].func() catch |err| switch (err) {
@@ -554,8 +562,11 @@ pub fn fuzz(
554
562
 
555
563
  fn test_one() callconv(.c) bool {
556
564
  @disableInstrumentation();
557
- testing.allocator_instance = .{};
558
- defer if (testing.allocator_instance.deinit() == .leak) std.process.exit(1);
565
+ testing.allocator_instance = .init(std.heap.page_allocator, .{
566
+ .canary = 0xcacce5e0,
567
+ .check_write_after_free = true,
568
+ });
569
+ defer if (testing.allocator_instance.deinit() != 0) std.process.exit(1);
559
570
  log_err_count = 0;
560
571
  testOne(ctx, @constCast(&testing.Smith{ .in = null })) catch |err| switch (err) {
561
572
  error.SkipZigTest => return true,
@@ -582,7 +593,6 @@ pub fn fuzz(
582
593
  if (builtin.fuzz) {
583
594
  // Preserve the calling test's allocator state
584
595
  const prev_allocator_state = testing.allocator_instance;
585
- testing.allocator_instance = .{};
586
596
  defer testing.allocator_instance = prev_allocator_state;
587
597
 
588
598
  global.ctx = context;
package/fuzzer.zig CHANGED
@@ -39,10 +39,10 @@ fn logOverride(
39
39
  fw.interface.flush() catch panic("failed to write to fuzzer log: {t}", .{fw.err.?});
40
40
  }
41
41
 
42
- var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
42
+ var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
43
43
  const gpa = switch (builtin.mode) {
44
- .Debug => debug_allocator.allocator(),
45
- .ReleaseFast, .ReleaseSmall, .ReleaseSafe => std.heap.smp_allocator,
44
+ .Debug, .ReleaseSafe => safe_allocator.allocator(),
45
+ .ReleaseFast, .ReleaseSmall => std.heap.smp_allocator,
46
46
  };
47
47
 
48
48
  // Seperate from `exec` to allow initialization before `exec` is.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zigc/lib",
3
- "version": "0.17.0-dev.389",
3
+ "version": "0.17.0-dev.420",
4
4
  "description": "Zig standard library and libc headers (shared across all platforms)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -533,9 +533,8 @@ pub fn serializeCpuAlloc(q: Query, ally: Allocator) Allocator.Error![]u8 {
533
533
  return buffer.toOwnedSlice();
534
534
  }
535
535
 
536
+ /// Deprecated; use `zigTriple` instead. Will be removed in 0.18.0.
536
537
  pub fn allocDescription(self: Query, allocator: Allocator) ![]u8 {
537
- // TODO is there anything else worthy of the description that is not
538
- // already captured in the triple?
539
538
  return self.zigTriple(allocator);
540
539
  }
541
540
 
package/std/Target.zig CHANGED
@@ -2640,7 +2640,6 @@ pub const DynamicLinker = struct {
2640
2640
  }
2641
2641
  else if (abi.isGnu())
2642
2642
  switch (cpu.arch) {
2643
- // TODO: `700` ABI support.
2644
2643
  .arc,
2645
2644
  .arceb,
2646
2645
  => |arch| if (abi == .gnu) initFmt("/lib/ld-linux-{t}.so.2", .{arch}) else none,
package/std/Thread.zig CHANGED
@@ -1411,6 +1411,16 @@ const LinuxThreadImpl = struct {
1411
1411
  : [ptr] "{r4}" (@intFromPtr(self.mapped.ptr)),
1412
1412
  [len] "{r5}" (self.mapped.len),
1413
1413
  : .{ .memory = true }),
1414
+ .xtensa, .xtensaeb => asm volatile (
1415
+ \\ movi a2, 81 // SYS_munmap
1416
+ \\ syscall
1417
+ \\ movi a6, 0
1418
+ \\ movi a2, 118 // SYS_exit
1419
+ \\ syscall
1420
+ :
1421
+ : [ptr] "{a6}" (@intFromPtr(self.mapped.ptr)),
1422
+ [len] "{a3}" (self.mapped.len),
1423
+ : .{ .memory = true }),
1414
1424
  else => |cpu_arch| @compileError("Unsupported linux arch: " ++ @tagName(cpu_arch)),
1415
1425
  }
1416
1426
  unreachable;
package/std/debug.zig CHANGED
@@ -994,6 +994,8 @@ const StackIterator = union(enum) {
994
994
  .sh,
995
995
  .sheb,
996
996
  .xcore,
997
+ .xtensa,
998
+ .xtensaeb,
997
999
  => .useless,
998
1000
  .hexagon,
999
1001
  // The PowerPC ABIs don't actually strictly require a backchain pointer; they allow omitting
package/std/elf.zig CHANGED
@@ -224,6 +224,9 @@ pub const DT_PPC64_NUM = 4;
224
224
  pub const DT_IA_64_PLT_RESERVE = (DT_LOPROC + 0);
225
225
  pub const DT_IA_64_NUM = 1;
226
226
 
227
+ pub const DT_XTENSA_GOT_LOC_OFF = 0x70000000;
228
+ pub const DT_XTENSA_GOT_LOC_SZ = 0x70000001;
229
+
227
230
  pub const DT_NIOS2_GP = 0x70000002;
228
231
 
229
232
  pub const DF_ORIGIN = 0x00000001;
package/std/fmt/float.zig CHANGED
@@ -1646,6 +1646,8 @@ test "format f64" {
1646
1646
  }
1647
1647
 
1648
1648
  test "format f80" {
1649
+ if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
1650
+
1649
1651
  try check(f80, 0.0, "0e0");
1650
1652
  try check(f80, -0.0, "-0e0");
1651
1653
  try check(f80, 1.0, "1e0");
@@ -671,12 +671,10 @@ test "reset while retaining a buffer" {
671
671
 
672
672
  // Create two internal buffers
673
673
  _ = try a.alloc(u8, 1);
674
- _ = try a.alloc(u8, 1000);
675
-
676
674
  try std.testing.expect(arena_allocator.state.used_list != null);
677
-
678
- // Check that we have at least two buffers
679
- try std.testing.expect(arena_allocator.state.used_list.?.next != null);
675
+ while (arena_allocator.state.used_list.?.next == null) {
676
+ _ = try a.alloc(u8, 1000);
677
+ }
680
678
 
681
679
  // This retains the first allocated buffer
682
680
  try std.testing.expect(arena_allocator.reset(.{ .retain_with_limit = 2 }));