@zigc/lib 0.16.0-dev.3121 → 0.16.0-dev.3132
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.
- package/c/math.zig +15 -13
- package/compiler/aro/backend/Ir/x86/Renderer.zig +3 -3
- package/compiler/build_runner.zig +1 -0
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/test_runner.zig +191 -59
- package/fuzzer.zig +855 -307
- package/package.json +1 -1
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Step/Run.zig +530 -68
- package/std/Build/abi.zig +39 -7
- package/std/Build.zig +3 -0
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io.zig +2 -2
- package/std/bit_set.zig +22 -6
- package/std/compress/flate/Compress.zig +3 -3
- package/std/crypto/codecs/base64_hex_ct.zig +2 -2
- package/std/enums.zig +19 -25
- package/std/http/Client.zig +10 -6
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/zig/Client.zig +8 -3
- package/std/zig/Server.zig +26 -0
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- package/libc/mingw/math/x86/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- package/libc/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/math/exp_data.c +0 -182
- package/libc/musl/src/math/exp_data.h +0 -26
- package/libc/musl/src/math/pow_data.c +0 -180
- package/libc/musl/src/math/pow_data.h +0 -22
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
package/std/Build/abi.zig
CHANGED
|
@@ -162,15 +162,39 @@ pub const fuzz = struct {
|
|
|
162
162
|
pub extern fn fuzzer_init(cache_dir_path: Slice) void;
|
|
163
163
|
/// `fuzzer_init` must be called first.
|
|
164
164
|
pub extern fn fuzzer_coverage() Coverage;
|
|
165
|
+
pub extern fn fuzzer_unslide_address(addr: usize) usize;
|
|
166
|
+
|
|
167
|
+
/// Performs all the fuzzing work and selects tests to run
|
|
168
|
+
///
|
|
165
169
|
/// `fuzzer_init` must be called first.
|
|
166
|
-
pub extern fn
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
pub extern fn fuzzer_main(
|
|
171
|
+
n_tests: u32,
|
|
172
|
+
seed: u32,
|
|
173
|
+
limit_kind: LimitKind,
|
|
174
|
+
amount_or_instance: u64,
|
|
175
|
+
) void;
|
|
176
|
+
pub extern fn runner_test_run(i: u32) void;
|
|
177
|
+
pub extern fn runner_test_name(i: u32) Slice;
|
|
178
|
+
// Since the runner owns the `std.zig.Server` instance, it also controls the
|
|
179
|
+
// concurrent Io instance so reads can be canceled. As such, the fuzzer has
|
|
180
|
+
// to call into the runner for any zig server / concurrent operation.
|
|
181
|
+
pub extern fn runner_start_input_poller() void;
|
|
182
|
+
pub extern fn runner_stop_input_poller() void;
|
|
183
|
+
/// Returns if cancelation has been indicated.
|
|
184
|
+
pub extern fn runner_futex_wait(*const u32, expected: u32) bool;
|
|
185
|
+
pub extern fn runner_futex_wake(*const u32, waiters: u32) void;
|
|
186
|
+
pub extern fn runner_broadcast_input(test_i: u32, bytes: Slice) void;
|
|
187
|
+
/// `fuzzer_main` must be called first.
|
|
188
|
+
///
|
|
189
|
+
/// Called concurrently with `fuzzer_main`. Returns if cancelation has been indicated.
|
|
190
|
+
pub extern fn fuzzer_receive_input(test_i: u32, bytes: Slice) bool;
|
|
191
|
+
|
|
192
|
+
/// Must be called from inside a test function
|
|
193
|
+
pub extern fn fuzzer_set_test(test_one: TestOne) void;
|
|
194
|
+
/// Must be called from inside a test function where `fuzzer_set_test` has been called first.
|
|
169
195
|
pub extern fn fuzzer_new_input(bytes: Slice) void;
|
|
170
|
-
/// `fuzzer_set_test`
|
|
171
|
-
|
|
172
|
-
pub extern fn fuzzer_main(limit_kind: LimitKind, amount: u64) void;
|
|
173
|
-
pub extern fn fuzzer_unslide_address(addr: usize) usize;
|
|
196
|
+
/// Must be called from inside a test function where `fuzzer_set_test` has been called first.
|
|
197
|
+
pub extern fn fuzzer_start_test() void;
|
|
174
198
|
|
|
175
199
|
pub extern fn fuzzer_int(uid: Uid, weights: Weights) u64;
|
|
176
200
|
pub extern fn fuzzer_eos(uid: Uid, weights: Weights) bool;
|
|
@@ -337,6 +361,14 @@ pub const fuzz = struct {
|
|
|
337
361
|
}
|
|
338
362
|
};
|
|
339
363
|
|
|
364
|
+
/// Fields are little-endian
|
|
365
|
+
pub const MmapInputHeader = extern struct {
|
|
366
|
+
pc_digest: u64 align(4), // aligned so header does not have padding
|
|
367
|
+
instance_id: u32,
|
|
368
|
+
test_i: u32,
|
|
369
|
+
len: u32,
|
|
370
|
+
};
|
|
371
|
+
|
|
340
372
|
/// WebSocket server->client.
|
|
341
373
|
///
|
|
342
374
|
/// Sent once, when fuzzing starts, to indicate the available coverage data.
|
package/std/Build.zig
CHANGED
|
@@ -128,6 +128,9 @@ pub const Graph = struct {
|
|
|
128
128
|
random_seed: u32 = 0,
|
|
129
129
|
dependency_cache: InitializedDepMap = .empty,
|
|
130
130
|
allow_so_scripts: ?bool = null,
|
|
131
|
+
/// Steps should use `io` to limit the number of jobs, however in the case of
|
|
132
|
+
/// a single step spawning a fixed number of processes this can be used.
|
|
133
|
+
max_jobs: ?u32 = null,
|
|
131
134
|
time_report: bool,
|
|
132
135
|
/// Similar to the `Io.Terminal.Mode` returned by `Io.lockStderr`, but also
|
|
133
136
|
/// respects the '--color' flag.
|
package/std/Io/File/Reader.zig
CHANGED
|
@@ -309,7 +309,9 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize {
|
|
|
309
309
|
return 0;
|
|
310
310
|
};
|
|
311
311
|
const logical_pos = logicalPos(r);
|
|
312
|
-
const
|
|
312
|
+
const bytes_remaining = size - logical_pos;
|
|
313
|
+
if (bytes_remaining == 0) return error.EndOfStream;
|
|
314
|
+
const delta = @min(@intFromEnum(limit), bytes_remaining);
|
|
313
315
|
setLogicalPos(r, logical_pos + delta);
|
|
314
316
|
return delta;
|
|
315
317
|
},
|
package/std/Io/Kqueue.zig
CHANGED
|
@@ -186,7 +186,7 @@ pub fn init(k: *Kqueue, gpa: Allocator, options: InitOptions) !void {
|
|
|
186
186
|
.awaiter = null,
|
|
187
187
|
.queue_next = null,
|
|
188
188
|
.cancel_thread = null,
|
|
189
|
-
.awaiting_completions = .
|
|
189
|
+
.awaiting_completions = .empty,
|
|
190
190
|
};
|
|
191
191
|
const main_thread = &k.threads.allocated[0];
|
|
192
192
|
Thread.self = main_thread;
|
|
@@ -713,7 +713,7 @@ fn concurrent(
|
|
|
713
713
|
.awaiter = null,
|
|
714
714
|
.queue_next = null,
|
|
715
715
|
.cancel_thread = null,
|
|
716
|
-
.awaiting_completions = .
|
|
716
|
+
.awaiting_completions = .empty,
|
|
717
717
|
};
|
|
718
718
|
closure.* = .{
|
|
719
719
|
.kqueue = k,
|
package/std/Io.zig
CHANGED
|
@@ -500,8 +500,8 @@ pub const Batch = struct {
|
|
|
500
500
|
/// Returns the index that will be returned by `next` after the operation completes.
|
|
501
501
|
/// Asserts that no more than `storage.len` operations are active at a time.
|
|
502
502
|
pub fn add(batch: *Batch, operation: Operation) u32 {
|
|
503
|
-
const index = batch.unused.
|
|
504
|
-
batch.addAt(index
|
|
503
|
+
const index = batch.unused.head.toIndex();
|
|
504
|
+
batch.addAt(index, operation);
|
|
505
505
|
return index;
|
|
506
506
|
}
|
|
507
507
|
|
package/std/bit_set.zig
CHANGED
|
@@ -68,16 +68,24 @@ pub fn IntegerBitSet(comptime size: u16) type {
|
|
|
68
68
|
/// The bit mask, as a single integer
|
|
69
69
|
mask: MaskInt,
|
|
70
70
|
|
|
71
|
+
/// Deprecated: use `.empty`.
|
|
71
72
|
/// Creates a bit set with no elements present.
|
|
72
73
|
pub fn initEmpty() Self {
|
|
73
74
|
return .{ .mask = 0 };
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
/// Deprecated: use `.full`.
|
|
76
78
|
/// Creates a bit set with all elements present.
|
|
77
79
|
pub fn initFull() Self {
|
|
78
80
|
return .{ .mask = ~@as(MaskInt, 0) };
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
/// A bit set with no elements present.
|
|
84
|
+
pub const empty: Self = .{ .mask = 0 };
|
|
85
|
+
|
|
86
|
+
/// A bit set with all elements present.
|
|
87
|
+
pub const full: Self = .{ .mask = ~@as(MaskInt, 0) };
|
|
88
|
+
|
|
81
89
|
/// Returns the number of bits in this bit set
|
|
82
90
|
pub inline fn capacity(self: Self) usize {
|
|
83
91
|
_ = self;
|
|
@@ -387,11 +395,13 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
387
395
|
/// Padding bits at the end are undefined.
|
|
388
396
|
masks: [num_masks]MaskInt,
|
|
389
397
|
|
|
398
|
+
/// Deprecated: use `.empty`.
|
|
390
399
|
/// Creates a bit set with no elements present.
|
|
391
400
|
pub fn initEmpty() Self {
|
|
392
401
|
return .{ .masks = [_]MaskInt{0} ** num_masks };
|
|
393
402
|
}
|
|
394
403
|
|
|
404
|
+
/// Deprecated: use `.full`.
|
|
395
405
|
/// Creates a bit set with all elements present.
|
|
396
406
|
pub fn initFull() Self {
|
|
397
407
|
if (num_masks == 0) {
|
|
@@ -401,6 +411,12 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
|
|
|
401
411
|
}
|
|
402
412
|
}
|
|
403
413
|
|
|
414
|
+
/// A bit set with no elements present.
|
|
415
|
+
pub const empty: Self = .{ .masks = @splat(0) };
|
|
416
|
+
|
|
417
|
+
/// A bit set with all elements present.
|
|
418
|
+
pub const full: Self = .{ .masks = if (num_masks == 0) .{} else ([_]MaskInt{~@as(MaskInt, 0)} ** (num_masks - 1) ++ [_]MaskInt{last_item_mask}) };
|
|
419
|
+
|
|
404
420
|
/// Returns the number of bits in this bit set
|
|
405
421
|
pub inline fn capacity(self: Self) usize {
|
|
406
422
|
_ = self;
|
|
@@ -1633,17 +1649,17 @@ fn fillOdd(set: anytype, len: usize) void {
|
|
|
1633
1649
|
}
|
|
1634
1650
|
|
|
1635
1651
|
fn testPureBitSet(comptime Set: type) !void {
|
|
1636
|
-
const empty = Set.
|
|
1637
|
-
const full = Set.
|
|
1652
|
+
const empty = Set.empty;
|
|
1653
|
+
const full = Set.full;
|
|
1638
1654
|
|
|
1639
1655
|
const even = even: {
|
|
1640
|
-
var bit_set = Set.
|
|
1656
|
+
var bit_set = Set.empty;
|
|
1641
1657
|
fillEven(&bit_set, Set.bit_length);
|
|
1642
1658
|
break :even bit_set;
|
|
1643
1659
|
};
|
|
1644
1660
|
|
|
1645
1661
|
const odd = odd: {
|
|
1646
|
-
var bit_set = Set.
|
|
1662
|
+
var bit_set = Set.empty;
|
|
1647
1663
|
fillOdd(&bit_set, Set.bit_length);
|
|
1648
1664
|
break :odd bit_set;
|
|
1649
1665
|
};
|
|
@@ -1686,8 +1702,8 @@ fn testPureBitSet(comptime Set: type) !void {
|
|
|
1686
1702
|
}
|
|
1687
1703
|
|
|
1688
1704
|
fn testStaticBitSet(comptime Set: type) !void {
|
|
1689
|
-
var a = Set.
|
|
1690
|
-
var b = Set.
|
|
1705
|
+
var a = Set.empty;
|
|
1706
|
+
var b = Set.full;
|
|
1691
1707
|
try testing.expectEqual(@as(usize, 0), a.count());
|
|
1692
1708
|
try testing.expectEqual(@as(usize, Set.bit_length), b.count());
|
|
1693
1709
|
|
|
@@ -1488,7 +1488,7 @@ const PackedContainer = packed struct(u2) {
|
|
|
1488
1488
|
|
|
1489
1489
|
test Compress {
|
|
1490
1490
|
const fbufs = try testingFreqBufs();
|
|
1491
|
-
defer
|
|
1491
|
+
defer std.testing.allocator.destroy(fbufs);
|
|
1492
1492
|
try std.testing.fuzz(fbufs, testFuzzedCompressInput, .{});
|
|
1493
1493
|
}
|
|
1494
1494
|
|
|
@@ -1818,7 +1818,7 @@ pub const Raw = struct {
|
|
|
1818
1818
|
|
|
1819
1819
|
test Raw {
|
|
1820
1820
|
const data_buf = try std.testing.allocator.create([4 * 65536]u8);
|
|
1821
|
-
defer
|
|
1821
|
+
defer std.testing.allocator.destroy(data_buf);
|
|
1822
1822
|
var prng: std.Random.DefaultPrng = .init(std.testing.random_seed);
|
|
1823
1823
|
prng.random().bytes(data_buf);
|
|
1824
1824
|
try std.testing.fuzz(data_buf, testFuzzedRawInput, .{});
|
|
@@ -2491,7 +2491,7 @@ pub const Huffman = struct {
|
|
|
2491
2491
|
|
|
2492
2492
|
test Huffman {
|
|
2493
2493
|
const fbufs = try testingFreqBufs();
|
|
2494
|
-
defer
|
|
2494
|
+
defer std.testing.allocator.destroy(fbufs);
|
|
2495
2495
|
try std.testing.fuzz(fbufs, testFuzzedHuffmanInput, .{});
|
|
2496
2496
|
}
|
|
2497
2497
|
|
|
@@ -93,7 +93,7 @@ pub const hex = struct {
|
|
|
93
93
|
/// The decoder will skip any characters that are in the ignore list.
|
|
94
94
|
/// The ignore list must not contain any valid hexadecimal characters.
|
|
95
95
|
pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore {
|
|
96
|
-
var ignored_chars = StaticBitSet(256).
|
|
96
|
+
var ignored_chars = StaticBitSet(256).empty;
|
|
97
97
|
for (ignore_chars) |c| {
|
|
98
98
|
switch (c) {
|
|
99
99
|
'0'...'9', 'a'...'f', 'A'...'F' => return error.InvalidCharacter,
|
|
@@ -269,7 +269,7 @@ pub const base64 = struct {
|
|
|
269
269
|
|
|
270
270
|
/// Creates a new decoder that ignores certain characters.
|
|
271
271
|
pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore {
|
|
272
|
-
var ignored_chars = StaticBitSet(256).
|
|
272
|
+
var ignored_chars = StaticBitSet(256).empty;
|
|
273
273
|
for (ignore_chars) |c| {
|
|
274
274
|
switch (c) {
|
|
275
275
|
'A'...'Z', 'a'...'z', '0'...'9' => return error.InvalidCharacter,
|
package/std/enums.zig
CHANGED
|
@@ -252,7 +252,7 @@ pub fn EnumSet(comptime E: type) type {
|
|
|
252
252
|
/// The maximum number of items in this set.
|
|
253
253
|
pub const len = Indexer.count;
|
|
254
254
|
|
|
255
|
-
bits: BitSet =
|
|
255
|
+
bits: BitSet = .empty,
|
|
256
256
|
|
|
257
257
|
/// Initializes the set using a struct of bools
|
|
258
258
|
pub fn init(init_values: EnumFieldStruct(E, bool, false)) Self {
|
|
@@ -278,19 +278,15 @@ pub fn EnumSet(comptime E: type) type {
|
|
|
278
278
|
return result;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
///
|
|
282
|
-
pub
|
|
283
|
-
return .{ .bits = BitSet.initEmpty() };
|
|
284
|
-
}
|
|
281
|
+
/// A set containing no keys.
|
|
282
|
+
pub const empty: Self = .{ .bits = .empty };
|
|
285
283
|
|
|
286
|
-
///
|
|
287
|
-
pub
|
|
288
|
-
return .{ .bits = BitSet.initFull() };
|
|
289
|
-
}
|
|
284
|
+
/// A set containing all possible keys.
|
|
285
|
+
pub const full: Self = .{ .bits = .full };
|
|
290
286
|
|
|
291
287
|
/// Returns a set containing multiple keys.
|
|
292
288
|
pub fn initMany(keys: []const Key) Self {
|
|
293
|
-
var set =
|
|
289
|
+
var set: Self = .empty;
|
|
294
290
|
for (keys) |key| set.insert(key);
|
|
295
291
|
return set;
|
|
296
292
|
}
|
|
@@ -440,7 +436,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
|
|
|
440
436
|
const BitSet = std.StaticBitSet(Indexer.count);
|
|
441
437
|
|
|
442
438
|
/// Bits determining whether items are in the map
|
|
443
|
-
bits: BitSet =
|
|
439
|
+
bits: BitSet = .empty,
|
|
444
440
|
/// Values of items in the map. If the associated
|
|
445
441
|
/// bit is zero, the value is undefined.
|
|
446
442
|
values: [Indexer.count]Value = undefined,
|
|
@@ -475,7 +471,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
|
|
|
475
471
|
/// Consider using EnumArray instead if the map will remain full.
|
|
476
472
|
pub fn initFull(value: Value) Self {
|
|
477
473
|
var result: Self = .{
|
|
478
|
-
.bits =
|
|
474
|
+
.bits = .full,
|
|
479
475
|
.values = undefined,
|
|
480
476
|
};
|
|
481
477
|
@memset(&result.values, value);
|
|
@@ -493,7 +489,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
|
|
|
493
489
|
pub fn initFullWithDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
|
|
494
490
|
@setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
|
|
495
491
|
var result: Self = .{
|
|
496
|
-
.bits =
|
|
492
|
+
.bits = .full,
|
|
497
493
|
.values = undefined,
|
|
498
494
|
};
|
|
499
495
|
inline for (0..Self.len) |i| {
|
|
@@ -687,16 +683,14 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
|
|
|
687
683
|
return self;
|
|
688
684
|
}
|
|
689
685
|
|
|
690
|
-
///
|
|
691
|
-
pub
|
|
692
|
-
return initWithCount(0);
|
|
693
|
-
}
|
|
686
|
+
/// A multiset with a count of zero.
|
|
687
|
+
pub const empty: Self = .initWithCount(0);
|
|
694
688
|
|
|
695
689
|
/// Initializes the multiset with all keys at the
|
|
696
690
|
/// same count.
|
|
697
691
|
pub fn initWithCount(comptime c: CountSize) Self {
|
|
698
692
|
return .{
|
|
699
|
-
.counts =
|
|
693
|
+
.counts = .initDefault(c, .{}),
|
|
700
694
|
};
|
|
701
695
|
}
|
|
702
696
|
|
|
@@ -855,7 +849,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
|
|
|
855
849
|
test EnumMultiset {
|
|
856
850
|
const Ball = enum { red, green, blue };
|
|
857
851
|
|
|
858
|
-
const empty = EnumMultiset(Ball).
|
|
852
|
+
const empty = EnumMultiset(Ball).empty;
|
|
859
853
|
const r0_g1_b2 = EnumMultiset(Ball).init(.{
|
|
860
854
|
.red = 0,
|
|
861
855
|
.green = 1,
|
|
@@ -1162,8 +1156,8 @@ pub fn EnumArray(comptime E: type, comptime V: type) type {
|
|
|
1162
1156
|
test "pure EnumSet fns" {
|
|
1163
1157
|
const Suit = enum { spades, hearts, clubs, diamonds };
|
|
1164
1158
|
|
|
1165
|
-
const empty = EnumSet(Suit).
|
|
1166
|
-
const full = EnumSet(Suit).
|
|
1159
|
+
const empty = EnumSet(Suit).empty;
|
|
1160
|
+
const full = EnumSet(Suit).full;
|
|
1167
1161
|
const black = EnumSet(Suit).initMany(&[_]Suit{ .spades, .clubs });
|
|
1168
1162
|
const red = EnumSet(Suit).initMany(&[_]Suit{ .hearts, .diamonds });
|
|
1169
1163
|
|
|
@@ -1224,8 +1218,8 @@ test "pure EnumSet fns" {
|
|
|
1224
1218
|
|
|
1225
1219
|
test "EnumSet empty" {
|
|
1226
1220
|
const E = enum {};
|
|
1227
|
-
const empty = EnumSet(E).
|
|
1228
|
-
const full = EnumSet(E).
|
|
1221
|
+
const empty = EnumSet(E).empty;
|
|
1222
|
+
const full = EnumSet(E).full;
|
|
1229
1223
|
|
|
1230
1224
|
try std.testing.expect(empty.eql(full));
|
|
1231
1225
|
try std.testing.expect(empty.complement().eql(full));
|
|
@@ -1236,13 +1230,13 @@ test "EnumSet empty" {
|
|
|
1236
1230
|
test "EnumSet const iterator" {
|
|
1237
1231
|
const Direction = enum { up, down, left, right };
|
|
1238
1232
|
const diag_move = init: {
|
|
1239
|
-
var move = EnumSet(Direction).
|
|
1233
|
+
var move = EnumSet(Direction).empty;
|
|
1240
1234
|
move.insert(.right);
|
|
1241
1235
|
move.insert(.up);
|
|
1242
1236
|
break :init move;
|
|
1243
1237
|
};
|
|
1244
1238
|
|
|
1245
|
-
var result = EnumSet(Direction).
|
|
1239
|
+
var result = EnumSet(Direction).empty;
|
|
1246
1240
|
var it = diag_move.iterator();
|
|
1247
1241
|
while (it.next()) |dir| {
|
|
1248
1242
|
result.insert(dir);
|
package/std/http/Client.zig
CHANGED
|
@@ -1133,7 +1133,16 @@ pub const Request = struct {
|
|
|
1133
1133
|
pub fn receiveHead(r: *Request, redirect_buffer: []u8) ReceiveHeadError!Response {
|
|
1134
1134
|
var aux_buf = redirect_buffer;
|
|
1135
1135
|
while (true) {
|
|
1136
|
-
|
|
1136
|
+
// This while loop is for handling redirects, which means the request's
|
|
1137
|
+
// connection may be different than the previous iteration. However, it
|
|
1138
|
+
// is still guaranteed to be non-null with each iteration of this loop.
|
|
1139
|
+
const connection = r.connection.?;
|
|
1140
|
+
|
|
1141
|
+
const head_buffer = r.reader.receiveHead() catch |err| {
|
|
1142
|
+
// Failure here means the connection can no longer be reused.
|
|
1143
|
+
connection.closing = true;
|
|
1144
|
+
return err;
|
|
1145
|
+
};
|
|
1137
1146
|
const response: Response = .{
|
|
1138
1147
|
.request = r,
|
|
1139
1148
|
.head = Response.Head.parse(head_buffer) catch return error.HttpHeadersInvalid,
|
|
@@ -1147,11 +1156,6 @@ pub const Request = struct {
|
|
|
1147
1156
|
return response; // we're not handling the 100-continue
|
|
1148
1157
|
}
|
|
1149
1158
|
|
|
1150
|
-
// This while loop is for handling redirects, which means the request's
|
|
1151
|
-
// connection may be different than the previous iteration. However, it
|
|
1152
|
-
// is still guaranteed to be non-null with each iteration of this loop.
|
|
1153
|
-
const connection = r.connection.?;
|
|
1154
|
-
|
|
1155
1159
|
if (r.method == .CONNECT and head.status.class() == .success) {
|
|
1156
1160
|
// This connection is no longer doing HTTP.
|
|
1157
1161
|
connection.closing = false;
|
package/std/priority_dequeue.zig
CHANGED
|
@@ -40,8 +40,9 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/// Free memory used by the dequeue.
|
|
43
|
-
pub fn deinit(self: Self, allocator: Allocator) void {
|
|
43
|
+
pub fn deinit(self: *Self, allocator: Allocator) void {
|
|
44
44
|
allocator.free(self.items);
|
|
45
|
+
self.* = undefined;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/// Insert a new element, maintaining priority.
|
|
@@ -77,7 +78,7 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
77
78
|
return 1 == @clz(index +% 1) & 1;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
fn nextIsMinLayer(self: Self) bool {
|
|
81
|
+
fn nextIsMinLayer(self: *const Self) bool {
|
|
81
82
|
return isMinLayer(self.len);
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -86,7 +87,7 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
86
87
|
min_layer: bool,
|
|
87
88
|
};
|
|
88
89
|
|
|
89
|
-
fn getStartForSiftUp(self: Self, child: T, index: usize) StartIndexAndLayer {
|
|
90
|
+
fn getStartForSiftUp(self: *const Self, child: T, index: usize) StartIndexAndLayer {
|
|
90
91
|
const child_index = index;
|
|
91
92
|
const parent_index = parentIndex(child_index);
|
|
92
93
|
const parent = self.items[parent_index];
|
|
@@ -136,20 +137,20 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
136
137
|
|
|
137
138
|
/// Look at the smallest element in the dequeue. Returns
|
|
138
139
|
/// `null` if empty.
|
|
139
|
-
pub fn peekMin(self: *Self) ?T {
|
|
140
|
+
pub fn peekMin(self: *const Self) ?T {
|
|
140
141
|
return if (self.len > 0) self.items[0] else null;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/// Look at the largest element in the dequeue. Returns
|
|
144
145
|
/// `null` if empty.
|
|
145
|
-
pub fn peekMax(self: *Self) ?T {
|
|
146
|
+
pub fn peekMax(self: *const Self) ?T {
|
|
146
147
|
if (self.len == 0) return null;
|
|
147
148
|
if (self.len == 1) return self.items[0];
|
|
148
149
|
if (self.len == 2) return self.items[1];
|
|
149
150
|
return self.bestItemAtIndices(1, 2, .gt).item;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
fn maxIndex(self: Self) ?usize {
|
|
153
|
+
fn maxIndex(self: *const Self) ?usize {
|
|
153
154
|
if (self.len == 0) return null;
|
|
154
155
|
if (self.len == 1) return 0;
|
|
155
156
|
if (self.len == 2) return 1;
|
|
@@ -261,14 +262,14 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
261
262
|
index: usize,
|
|
262
263
|
};
|
|
263
264
|
|
|
264
|
-
fn getItem(self: Self, index: usize) ItemAndIndex {
|
|
265
|
+
fn getItem(self: *const Self, index: usize) ItemAndIndex {
|
|
265
266
|
return .{
|
|
266
267
|
.item = self.items[index],
|
|
267
268
|
.index = index,
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
fn bestItem(self: Self, item1: ItemAndIndex, item2: ItemAndIndex, target_order: Order) ItemAndIndex {
|
|
272
|
+
fn bestItem(self: *const Self, item1: ItemAndIndex, item2: ItemAndIndex, target_order: Order) ItemAndIndex {
|
|
272
273
|
if (compareFn(self.context, item1.item, item2.item) == target_order) {
|
|
273
274
|
return item1;
|
|
274
275
|
} else {
|
|
@@ -276,13 +277,13 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
|
|
279
|
-
fn bestItemAtIndices(self: Self, index1: usize, index2: usize, target_order: Order) ItemAndIndex {
|
|
280
|
+
fn bestItemAtIndices(self: *const Self, index1: usize, index2: usize, target_order: Order) ItemAndIndex {
|
|
280
281
|
const item1 = self.getItem(index1);
|
|
281
282
|
const item2 = self.getItem(index2);
|
|
282
283
|
return self.bestItem(item1, item2, target_order);
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
fn bestDescendent(self: Self, first_child_index: usize, first_grandchild_index: usize, target_order: Order) ItemAndIndex {
|
|
286
|
+
fn bestDescendent(self: *const Self, first_child_index: usize, first_grandchild_index: usize, target_order: Order) ItemAndIndex {
|
|
286
287
|
const second_child_index = first_child_index + 1;
|
|
287
288
|
if (first_grandchild_index >= self.len) {
|
|
288
289
|
// No grandchildren, find the best child (second may not exist)
|
|
@@ -314,13 +315,13 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
|
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
/// Return the number of elements remaining in the dequeue
|
|
317
|
-
pub fn count(self: Self) usize {
|
|
318
|
+
pub fn count(self: *const Self) usize {
|
|
318
319
|
return self.len;
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
/// Return the number of elements that can be added to the
|
|
322
323
|
/// dequeue before more memory is allocated.
|
|
323
|
-
pub fn capacity(self: Self) usize {
|
|
324
|
+
pub fn capacity(self: *const Self) usize {
|
|
324
325
|
return self.items.len;
|
|
325
326
|
}
|
|
326
327
|
|
package/std/priority_queue.zig
CHANGED
|
@@ -41,6 +41,7 @@ pub fn PriorityQueue(comptime T: type, comptime Context: type, comptime compareF
|
|
|
41
41
|
/// Free memory used by the queue.
|
|
42
42
|
pub fn deinit(self: *Self, allocator: Allocator) void {
|
|
43
43
|
allocator.free(self.allocatedSlice());
|
|
44
|
+
self.* = undefined;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/// Insert a new element, maintaining priority.
|
|
@@ -78,7 +79,7 @@ pub fn PriorityQueue(comptime T: type, comptime Context: type, comptime compareF
|
|
|
78
79
|
|
|
79
80
|
/// Look at the highest priority element in the queue. Returns
|
|
80
81
|
/// `null` if empty.
|
|
81
|
-
pub fn peek(self: *Self) ?T {
|
|
82
|
+
pub fn peek(self: *const Self) ?T {
|
|
82
83
|
return if (self.items.len > 0) self.items[0] else null;
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -117,19 +118,19 @@ pub fn PriorityQueue(comptime T: type, comptime Context: type, comptime compareF
|
|
|
117
118
|
|
|
118
119
|
/// Return the number of elements remaining in the priority
|
|
119
120
|
/// queue.
|
|
120
|
-
pub fn count(self: Self) usize {
|
|
121
|
+
pub fn count(self: *const Self) usize {
|
|
121
122
|
return self.items.len;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
/// Return the number of elements that can be added to the
|
|
125
126
|
/// queue before more memory is allocated.
|
|
126
|
-
pub fn capacity(self: Self) usize {
|
|
127
|
+
pub fn capacity(self: *const Self) usize {
|
|
127
128
|
return self.cap;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/// Returns a slice of all the items plus the extra capacity, whose memory
|
|
131
132
|
/// contents are `undefined`.
|
|
132
|
-
fn allocatedSlice(self: Self) []T {
|
|
133
|
+
fn allocatedSlice(self: *const Self) []T {
|
|
133
134
|
// `items.len` is the length, not the capacity.
|
|
134
135
|
return self.items.ptr[0..self.cap];
|
|
135
136
|
}
|
package/std/zig/Client.zig
CHANGED
|
@@ -33,13 +33,18 @@ pub const Message = struct {
|
|
|
33
33
|
/// Ask the test runner to run a particular test.
|
|
34
34
|
/// The message body is a u32 test index.
|
|
35
35
|
run_test,
|
|
36
|
-
/// Ask the test runner to start fuzzing a
|
|
36
|
+
/// Ask the test runner to start fuzzing a set of test forever or each for a given amount of
|
|
37
|
+
/// iterations. After this is sent, the only allowed message is `new_fuzz_input`.
|
|
38
|
+
///
|
|
37
39
|
/// The message body is:
|
|
38
|
-
/// - a u32 test name len.
|
|
39
|
-
/// - a test name with the above length
|
|
40
40
|
/// - a u8 test limit kind (std.Build.api.fuzz.LimitKind)
|
|
41
41
|
/// - a u64 value whose meaning depends on FuzzLimitKind (either a limit amount or an instance id)
|
|
42
|
+
/// - a u32 number of tests followed by n elements of
|
|
43
|
+
/// - a u32 test name len.
|
|
44
|
+
/// - a test name with the above length
|
|
42
45
|
start_fuzzing,
|
|
46
|
+
/// The message body has the same format as in Server.
|
|
47
|
+
new_fuzz_input,
|
|
43
48
|
|
|
44
49
|
_,
|
|
45
50
|
};
|
package/std/zig/Server.zig
CHANGED
|
@@ -60,6 +60,13 @@ pub const Message = struct {
|
|
|
60
60
|
/// address of the fuzz unit test. This is used to provide a starting
|
|
61
61
|
/// point to view coverage.
|
|
62
62
|
fuzz_start_addr,
|
|
63
|
+
/// Body is:
|
|
64
|
+
/// - u32le test index.
|
|
65
|
+
fuzz_test_change,
|
|
66
|
+
/// Body is:
|
|
67
|
+
/// - u32le test index
|
|
68
|
+
/// - input in remaining bytes
|
|
69
|
+
broadcast_fuzz_input,
|
|
63
70
|
/// Body is a TimeReport.
|
|
64
71
|
time_report,
|
|
65
72
|
|
|
@@ -176,6 +183,15 @@ pub fn serveMessageHeader(s: *const Server, header: OutMessage.Header) !void {
|
|
|
176
183
|
try s.out.writeStruct(header, .little);
|
|
177
184
|
}
|
|
178
185
|
|
|
186
|
+
pub fn serveU32Message(s: *const Server, tag: OutMessage.Tag, int: u32) !void {
|
|
187
|
+
try serveMessageHeader(s, .{
|
|
188
|
+
.tag = tag,
|
|
189
|
+
.bytes_len = @sizeOf(u32),
|
|
190
|
+
});
|
|
191
|
+
try s.out.writeInt(u32, int, .little);
|
|
192
|
+
try s.out.flush();
|
|
193
|
+
}
|
|
194
|
+
|
|
179
195
|
pub fn serveU64Message(s: *const Server, tag: OutMessage.Tag, int: u64) !void {
|
|
180
196
|
assert(tag != .coverage_id);
|
|
181
197
|
try serveMessageHeader(s, .{
|
|
@@ -198,6 +214,16 @@ pub fn serveCoverageIdMessage(s: *const Server, id: u64, runs: u64, unique: u64,
|
|
|
198
214
|
try s.out.flush();
|
|
199
215
|
}
|
|
200
216
|
|
|
217
|
+
pub fn serveBroadcastFuzzInputMessage(s: *const Server, test_i: u32, bytes: []const u8) !void {
|
|
218
|
+
try s.serveMessageHeader(.{
|
|
219
|
+
.tag = .broadcast_fuzz_input,
|
|
220
|
+
.bytes_len = @sizeOf(u32) + @as(u32, @intCast(bytes.len)),
|
|
221
|
+
});
|
|
222
|
+
try s.out.writeInt(u32, test_i, .little);
|
|
223
|
+
try s.out.writeAll(bytes);
|
|
224
|
+
try s.out.flush();
|
|
225
|
+
}
|
|
226
|
+
|
|
201
227
|
pub fn serveEmitDigest(
|
|
202
228
|
s: *Server,
|
|
203
229
|
digest: *const [Cache.bin_digest_len]u8,
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
This Software is provided under the Zope Public License (ZPL) Version 2.1.
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2009, 2010 by the mingw-w64 project
|
|
5
|
-
|
|
6
|
-
See the AUTHORS file for the list of contributors to the mingw-w64 project.
|
|
7
|
-
|
|
8
|
-
This license has been certified as open source. It has also been designated
|
|
9
|
-
as GPL compatible by the Free Software Foundation (FSF).
|
|
10
|
-
|
|
11
|
-
Redistribution and use in source and binary forms, with or without
|
|
12
|
-
modification, are permitted provided that the following conditions are met:
|
|
13
|
-
|
|
14
|
-
1. Redistributions in source code must retain the accompanying copyright
|
|
15
|
-
notice, this list of conditions, and the following disclaimer.
|
|
16
|
-
2. Redistributions in binary form must reproduce the accompanying
|
|
17
|
-
copyright notice, this list of conditions, and the following disclaimer
|
|
18
|
-
in the documentation and/or other materials provided with the
|
|
19
|
-
distribution.
|
|
20
|
-
3. Names of the copyright holders must not be used to endorse or promote
|
|
21
|
-
products derived from this software without prior written permission
|
|
22
|
-
from the copyright holders.
|
|
23
|
-
4. The right to distribute this software or to use it for any purpose does
|
|
24
|
-
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
|
|
25
|
-
the copyright holders. Use of them is covered by separate agreement
|
|
26
|
-
with the copyright holders.
|
|
27
|
-
5. If any files are modified, you must cause the modified files to carry
|
|
28
|
-
prominent notices stating that you changed the files and the date of
|
|
29
|
-
any change.
|
|
30
|
-
|
|
31
|
-
Disclaimer
|
|
32
|
-
|
|
33
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
|
|
34
|
-
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
35
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
36
|
-
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
37
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
38
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
39
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
40
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
41
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
42
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/* double version of the functions. */
|
|
46
|
-
#define _NEW_COMPLEX_DOUBLE 1
|
|
47
|
-
#include "complex_internal.h"
|
|
48
|
-
#include "cabs.def.h"
|