@zigc/lib 0.16.0-test.1 → 0.17.0-dev.9
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/LICENSE +19 -0
- package/c/math.zig +135 -35
- package/c/stropts.zig +17 -0
- package/c.zig +1 -0
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +3 -1
- package/compiler/aro/aro/Compilation.zig +120 -97
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +124 -50
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +336 -142
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +127 -56
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/assembly_backend/x86_64.zig +3 -4
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -0
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +193 -61
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +364 -126
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +75 -16
- package/compiler_rt/cos.zig +141 -52
- package/compiler_rt/limb64.zig +266 -0
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/sin.zig +140 -55
- package/compiler_rt/sincos.zig +279 -72
- package/compiler_rt/tan.zig +118 -47
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +855 -307
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -0
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +536 -87
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +8 -15
- package/std/Build/WebServer.zig +29 -17
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -14
- package/std/Io/Dispatch.zig +2 -0
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Threaded.zig +181 -143
- package/std/Io/Uring.zig +2 -1
- package/std/Io.zig +970 -2
- package/std/Target.zig +3 -2
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +96 -555
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/c.zig +17 -17
- package/std/compress/flate/Compress.zig +3 -3
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +14 -4
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +539 -36
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +179 -65
- package/std/enums.zig +25 -19
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/debug_allocator.zig +7 -7
- package/std/http/Client.zig +10 -6
- package/std/http.zig +11 -9
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +2 -18
- package/std/os/linux/arc.zig +144 -0
- package/std/os/linux.zig +21 -4
- package/std/os/windows.zig +2 -2
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +186 -458
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +44 -7
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/Client.zig +8 -3
- package/std/zig/Parse.zig +83 -74
- package/std/zig/Server.zig +26 -0
- package/std/zig/Zir.zig +17 -0
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +107 -48
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +6 -0
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- 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/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- 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/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- 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/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- 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/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
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/Parse.zig
CHANGED
|
@@ -257,7 +257,7 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
|
|
|
257
257
|
while (true) {
|
|
258
258
|
const doc_comment = try p.eatDocComments();
|
|
259
259
|
|
|
260
|
-
switch (p.tokenTag(p.tok_i)) {
|
|
260
|
+
sw: switch (p.tokenTag(p.tok_i)) {
|
|
261
261
|
.keyword_test => {
|
|
262
262
|
if (doc_comment) |some| {
|
|
263
263
|
try p.warnMsg(.{ .tag = .test_doc_comment, .token = some });
|
|
@@ -348,17 +348,7 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
|
|
|
348
348
|
p.findNextContainerMember();
|
|
349
349
|
},
|
|
350
350
|
},
|
|
351
|
-
.keyword_pub
|
|
352
|
-
p.tok_i += 1;
|
|
353
|
-
const opt_top_level_decl = try p.expectTopLevelDeclRecoverable();
|
|
354
|
-
if (opt_top_level_decl) |top_level_decl| {
|
|
355
|
-
if (field_state == .seen) {
|
|
356
|
-
field_state = .{ .end = top_level_decl };
|
|
357
|
-
}
|
|
358
|
-
try p.scratch.append(p.gpa, top_level_decl);
|
|
359
|
-
}
|
|
360
|
-
trailing = p.tokenTag(p.tok_i - 1) == .semicolon;
|
|
361
|
-
},
|
|
351
|
+
.keyword_pub,
|
|
362
352
|
.keyword_const,
|
|
363
353
|
.keyword_var,
|
|
364
354
|
.keyword_threadlocal,
|
|
@@ -367,7 +357,27 @@ fn parseContainerMembers(p: *Parse) Allocator.Error!Members {
|
|
|
367
357
|
.keyword_inline,
|
|
368
358
|
.keyword_noinline,
|
|
369
359
|
.keyword_fn,
|
|
370
|
-
=> {
|
|
360
|
+
=> |t| {
|
|
361
|
+
if (t == .keyword_extern) {
|
|
362
|
+
switch (p.tokenTag(p.tok_i + 1)) {
|
|
363
|
+
.keyword_struct,
|
|
364
|
+
.keyword_union,
|
|
365
|
+
.keyword_enum,
|
|
366
|
+
.keyword_opaque,
|
|
367
|
+
=> |ct| continue :sw ct,
|
|
368
|
+
else => {},
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (t == .keyword_inline) {
|
|
372
|
+
switch (p.tokenTag(p.tok_i + 1)) {
|
|
373
|
+
.keyword_for,
|
|
374
|
+
.keyword_while,
|
|
375
|
+
=> |ct| continue :sw ct,
|
|
376
|
+
else => {},
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
p.tok_i += @intFromBool(t == .keyword_pub);
|
|
371
381
|
const opt_top_level_decl = try p.expectTopLevelDeclRecoverable();
|
|
372
382
|
if (opt_top_level_decl) |top_level_decl| {
|
|
373
383
|
if (field_state == .seen) {
|
|
@@ -588,7 +598,8 @@ fn expectTestDeclRecoverable(p: *Parse) error{OutOfMemory}!?Node.Index {
|
|
|
588
598
|
}
|
|
589
599
|
|
|
590
600
|
/// Decl
|
|
591
|
-
/// <- (KEYWORD_export /
|
|
601
|
+
/// <- (KEYWORD_export / KEYWORD_inline / KEYWORD_noinline)? FnProto (SEMICOLON / Block)
|
|
602
|
+
/// / KEYWORD_extern STRINGLITERALSINGLE? FnProto SEMICOLON
|
|
592
603
|
/// / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl
|
|
593
604
|
fn expectTopLevelDecl(p: *Parse) !?Node.Index {
|
|
594
605
|
const extern_export_inline_token = p.nextToken();
|
|
@@ -665,7 +676,7 @@ fn expectTopLevelDeclRecoverable(p: *Parse) error{OutOfMemory}!?Node.Index {
|
|
|
665
676
|
};
|
|
666
677
|
}
|
|
667
678
|
|
|
668
|
-
/// FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? AddrSpace? LinkSection? CallConv? EXCLAMATIONMARK? TypeExpr
|
|
679
|
+
/// FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? AddrSpace? LinkSection? CallConv? EXCLAMATIONMARK? TypeExpr !ExprSuffix
|
|
669
680
|
fn parseFnProto(p: *Parse) !?Node.Index {
|
|
670
681
|
const fn_token = p.eatToken(.keyword_fn) orelse return null;
|
|
671
682
|
|
|
@@ -853,7 +864,7 @@ fn parseGlobalVarDecl(p: *Parse) !?Node.Index {
|
|
|
853
864
|
return var_decl;
|
|
854
865
|
}
|
|
855
866
|
|
|
856
|
-
/// ContainerField <- doc_comment? KEYWORD_comptime
|
|
867
|
+
/// ContainerField <- doc_comment? (KEYWORD_comptime / !KEYWORD_comptime) !KEYWORD_fn (IDENTIFIER COLON / !(IDENTIFIER COLON))? TypeExpr ByteAlign? (EQUAL Expr)?
|
|
857
868
|
fn expectContainerField(p: *Parse) !Node.Index {
|
|
858
869
|
_ = p.eatToken(.keyword_comptime);
|
|
859
870
|
const main_token = p.tok_i;
|
|
@@ -895,16 +906,23 @@ fn expectContainerField(p: *Parse) !Node.Index {
|
|
|
895
906
|
}
|
|
896
907
|
}
|
|
897
908
|
|
|
898
|
-
///
|
|
899
|
-
/// <-
|
|
900
|
-
/// / KEYWORD_nosuspend BlockExprStatement
|
|
901
|
-
/// / KEYWORD_suspend BlockExprStatement
|
|
909
|
+
/// BlockStatement
|
|
910
|
+
/// <- Statement
|
|
902
911
|
/// / KEYWORD_defer BlockExprStatement
|
|
903
912
|
/// / KEYWORD_errdefer Payload? BlockExprStatement
|
|
904
|
-
/// /
|
|
913
|
+
/// / !ExprStatement (KEYWORD_comptime !BlockExpr)? VarAssignStatement
|
|
914
|
+
///
|
|
915
|
+
/// Statement
|
|
916
|
+
/// <- ExprStatement
|
|
917
|
+
/// / KEYWORD_suspend BlockExprStatement
|
|
918
|
+
/// / !ExprStatement (KEYWORD_comptime !BlockExpr)? AssignExpr SEMICOLON
|
|
919
|
+
///
|
|
920
|
+
/// ExprStatement
|
|
921
|
+
/// <- IfStatement
|
|
905
922
|
/// / LabeledStatement
|
|
906
|
-
/// /
|
|
907
|
-
|
|
923
|
+
/// / KEYWORD_nosuspend BlockExprStatement
|
|
924
|
+
/// / KEYWORD_comptime BlockExpr
|
|
925
|
+
fn expectStatement(p: *Parse, is_block_level: bool) Error!Node.Index {
|
|
908
926
|
if (p.eatToken(.keyword_comptime)) |comptime_token| {
|
|
909
927
|
const opt_block_expr = try p.parseBlockExpr();
|
|
910
928
|
if (opt_block_expr) |block_expr| {
|
|
@@ -915,7 +933,7 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
|
|
|
915
933
|
});
|
|
916
934
|
}
|
|
917
935
|
|
|
918
|
-
if (
|
|
936
|
+
if (is_block_level) {
|
|
919
937
|
return p.expectVarDeclExprStatement(comptime_token);
|
|
920
938
|
} else {
|
|
921
939
|
const assign = try p.expectAssignExpr();
|
|
@@ -949,12 +967,12 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
|
|
|
949
967
|
.data = .{ .node = block_expr },
|
|
950
968
|
});
|
|
951
969
|
},
|
|
952
|
-
.keyword_defer => if (
|
|
970
|
+
.keyword_defer => if (is_block_level) return p.addNode(.{
|
|
953
971
|
.tag = .@"defer",
|
|
954
972
|
.main_token = p.nextToken(),
|
|
955
973
|
.data = .{ .node = try p.expectBlockExprStatement() },
|
|
956
974
|
}),
|
|
957
|
-
.keyword_errdefer => if (
|
|
975
|
+
.keyword_errdefer => if (is_block_level) return p.addNode(.{
|
|
958
976
|
.tag = .@"errdefer",
|
|
959
977
|
.main_token = p.nextToken(),
|
|
960
978
|
.data = .{ .opt_token_and_node = .{
|
|
@@ -979,7 +997,7 @@ fn expectStatement(p: *Parse, allow_defer_var: bool) Error!Node.Index {
|
|
|
979
997
|
|
|
980
998
|
if (try p.parseLabeledStatement()) |labeled_statement| return labeled_statement;
|
|
981
999
|
|
|
982
|
-
if (
|
|
1000
|
+
if (is_block_level) {
|
|
983
1001
|
return p.expectVarDeclExprStatement(null);
|
|
984
1002
|
} else {
|
|
985
1003
|
const assign = try p.expectAssignExpr();
|
|
@@ -1007,8 +1025,10 @@ fn expectComptimeStatement(p: *Parse, comptime_token: TokenIndex) !Node.Index {
|
|
|
1007
1025
|
}
|
|
1008
1026
|
|
|
1009
1027
|
/// VarDeclExprStatement
|
|
1010
|
-
/// <-
|
|
1011
|
-
/// /
|
|
1028
|
+
/// <- Expr
|
|
1029
|
+
/// / VarAssignStatement
|
|
1030
|
+
///
|
|
1031
|
+
/// VarAssignStatement <- (VarDeclProto / Expr) (COMMA (VarDeclProto / Expr))* EQUAL Expr SEMICOLON
|
|
1012
1032
|
fn expectVarDeclExprStatement(p: *Parse, comptime_token: ?TokenIndex) !Node.Index {
|
|
1013
1033
|
const scratch_top = p.scratch.items.len;
|
|
1014
1034
|
defer p.scratch.shrinkRetainingCapacity(scratch_top);
|
|
@@ -1140,7 +1160,7 @@ fn expectStatementRecoverable(p: *Parse) Error!?Node.Index {
|
|
|
1140
1160
|
|
|
1141
1161
|
/// IfStatement
|
|
1142
1162
|
/// <- IfPrefix BlockExpr ( KEYWORD_else Payload? Statement )?
|
|
1143
|
-
/// / IfPrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
|
|
1163
|
+
/// / IfPrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
|
|
1144
1164
|
fn expectIfStatement(p: *Parse) !Node.Index {
|
|
1145
1165
|
const if_token = p.assertToken(.keyword_if);
|
|
1146
1166
|
_ = try p.expectToken(.l_paren);
|
|
@@ -1235,8 +1255,8 @@ fn parseLoopStatement(p: *Parse) !?Node.Index {
|
|
|
1235
1255
|
}
|
|
1236
1256
|
|
|
1237
1257
|
/// ForStatement
|
|
1238
|
-
/// <- ForPrefix BlockExpr ( KEYWORD_else Statement )
|
|
1239
|
-
/// / ForPrefix AssignExpr ( SEMICOLON / KEYWORD_else Statement )
|
|
1258
|
+
/// <- ForPrefix BlockExpr ( KEYWORD_else Statement / !KEYWORD_else )
|
|
1259
|
+
/// / ForPrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Statement )
|
|
1240
1260
|
fn parseForStatement(p: *Parse) !?Node.Index {
|
|
1241
1261
|
const for_token = p.eatToken(.keyword_for) orelse return null;
|
|
1242
1262
|
|
|
@@ -1293,7 +1313,7 @@ fn parseForStatement(p: *Parse) !?Node.Index {
|
|
|
1293
1313
|
///
|
|
1294
1314
|
/// WhileStatement
|
|
1295
1315
|
/// <- WhilePrefix BlockExpr ( KEYWORD_else Payload? Statement )?
|
|
1296
|
-
/// / WhilePrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
|
|
1316
|
+
/// / WhilePrefix !BlockExpr AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
|
|
1297
1317
|
fn parseWhileStatement(p: *Parse) !?Node.Index {
|
|
1298
1318
|
const while_token = p.eatToken(.keyword_while) orelse return null;
|
|
1299
1319
|
_ = try p.expectToken(.l_paren);
|
|
@@ -1383,7 +1403,7 @@ fn parseWhileStatement(p: *Parse) !?Node.Index {
|
|
|
1383
1403
|
|
|
1384
1404
|
/// BlockExprStatement
|
|
1385
1405
|
/// <- BlockExpr
|
|
1386
|
-
/// / AssignExpr SEMICOLON
|
|
1406
|
+
/// / !BlockExpr AssignExpr SEMICOLON
|
|
1387
1407
|
fn parseBlockExprStatement(p: *Parse) !?Node.Index {
|
|
1388
1408
|
const block_expr = try p.parseBlockExpr();
|
|
1389
1409
|
if (block_expr) |expr| return expr;
|
|
@@ -1685,18 +1705,20 @@ fn expectPrefixExpr(p: *Parse) Error!Node.Index {
|
|
|
1685
1705
|
/// PrefixTypeOp
|
|
1686
1706
|
/// <- QUESTIONMARK
|
|
1687
1707
|
/// / KEYWORD_anyframe MINUSRARROW
|
|
1688
|
-
/// / SliceTypeStart
|
|
1708
|
+
/// / (ManyPtrTypeStart / SliceTypeStart) KEYWORD_allowzero? ByteAlign? AddrSpace? KEYWORD_const? KEYWORD_volatile?
|
|
1709
|
+
/// / SinglePtrTypeStart KEYWORD_allowzero? BitAlign? AddrSpace? KEYWORD_const? KEYWORD_volatile?
|
|
1689
1710
|
/// / PtrTypeStart (AddrSpace / KEYWORD_align LPAREN Expr (COLON Expr COLON Expr)? RPAREN / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)*
|
|
1690
1711
|
/// / ArrayTypeStart
|
|
1691
1712
|
///
|
|
1692
1713
|
/// SliceTypeStart <- LBRACKET (COLON Expr)? RBRACKET
|
|
1693
1714
|
///
|
|
1694
|
-
///
|
|
1695
|
-
///
|
|
1696
|
-
///
|
|
1697
|
-
///
|
|
1715
|
+
/// SinglePtrTypeStart <- ASTERISK / ASTERISK2
|
|
1716
|
+
///
|
|
1717
|
+
/// ManyPtrTypeStart <- LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET
|
|
1718
|
+
///
|
|
1719
|
+
/// ArrayTypeStart <- LBRACKET Expr !(ASTERISK / ASTERISK2) (COLON Expr)? RBRACKET
|
|
1698
1720
|
///
|
|
1699
|
-
///
|
|
1721
|
+
/// BitAlign <- KEYWORD_align LPAREN Expr (COLON Expr COLON Expr)? RPAREN
|
|
1700
1722
|
fn parseTypeExpr(p: *Parse) Error!?Node.Index {
|
|
1701
1723
|
switch (p.tokenTag(p.tok_i)) {
|
|
1702
1724
|
.question_mark => return try p.addNode(.{
|
|
@@ -1962,12 +1984,12 @@ fn expectTypeExpr(p: *Parse) Error!Node.Index {
|
|
|
1962
1984
|
/// PrimaryExpr
|
|
1963
1985
|
/// <- AsmExpr
|
|
1964
1986
|
/// / IfExpr
|
|
1965
|
-
/// / KEYWORD_break BreakLabel
|
|
1966
|
-
/// / KEYWORD_comptime Expr
|
|
1967
|
-
/// / KEYWORD_nosuspend Expr
|
|
1968
|
-
/// / KEYWORD_continue BreakLabel
|
|
1969
|
-
/// / KEYWORD_resume Expr
|
|
1970
|
-
/// / KEYWORD_return Expr
|
|
1987
|
+
/// / KEYWORD_break (BreakLabel / !BreakLabel) (Expr !ExprSuffix / !SinglePtrTypeStart)
|
|
1988
|
+
/// / KEYWORD_comptime Expr !ExprSuffix
|
|
1989
|
+
/// / KEYWORD_nosuspend Expr !ExprSuffix
|
|
1990
|
+
/// / KEYWORD_continue (BreakLabel / !BreakLabel) (Expr !ExprSuffix / !SinglePtrTypeStart)
|
|
1991
|
+
/// / KEYWORD_resume Expr !ExprSuffix
|
|
1992
|
+
/// / KEYWORD_return (Expr !ExprSuffix / !SinglePtrTypeStart)
|
|
1971
1993
|
/// / BlockLabel? LoopExpr
|
|
1972
1994
|
/// / Block
|
|
1973
1995
|
/// / CurlySuffixExpr
|
|
@@ -2042,10 +2064,6 @@ fn parsePrimaryExpr(p: *Parse) !?Node.Index {
|
|
|
2042
2064
|
p.tok_i += 2;
|
|
2043
2065
|
return try p.parseWhileExpr();
|
|
2044
2066
|
},
|
|
2045
|
-
.l_brace => {
|
|
2046
|
-
p.tok_i += 2;
|
|
2047
|
-
return try p.parseBlock();
|
|
2048
|
-
},
|
|
2049
2067
|
else => return try p.parseCurlySuffixExpr(),
|
|
2050
2068
|
}
|
|
2051
2069
|
} else {
|
|
@@ -2067,12 +2085,12 @@ fn parsePrimaryExpr(p: *Parse) !?Node.Index {
|
|
|
2067
2085
|
}
|
|
2068
2086
|
}
|
|
2069
2087
|
|
|
2070
|
-
/// IfExpr <- IfPrefix Expr (KEYWORD_else Payload? Expr)?
|
|
2088
|
+
/// IfExpr <- IfPrefix Expr (KEYWORD_else Payload? Expr)? !ExprSuffix
|
|
2071
2089
|
fn parseIfExpr(p: *Parse) !?Node.Index {
|
|
2072
2090
|
return try p.parseIf(expectExpr);
|
|
2073
2091
|
}
|
|
2074
2092
|
|
|
2075
|
-
/// Block <- LBRACE
|
|
2093
|
+
/// Block <- LBRACE BlockStatement* RBRACE
|
|
2076
2094
|
fn parseBlock(p: *Parse) !?Node.Index {
|
|
2077
2095
|
const lbrace = p.eatToken(.l_brace) orelse return null;
|
|
2078
2096
|
const scratch_top = p.scratch.items.len;
|
|
@@ -2177,7 +2195,7 @@ fn forPrefix(p: *Parse) Error!usize {
|
|
|
2177
2195
|
|
|
2178
2196
|
/// WhilePrefix <- KEYWORD_while LPAREN Expr RPAREN PtrPayload? WhileContinueExpr?
|
|
2179
2197
|
///
|
|
2180
|
-
/// WhileExpr <- WhilePrefix Expr (KEYWORD_else Payload? Expr)?
|
|
2198
|
+
/// WhileExpr <- WhilePrefix Expr (KEYWORD_else Payload? Expr)? !ExprSuffi
|
|
2181
2199
|
fn parseWhileExpr(p: *Parse) !?Node.Index {
|
|
2182
2200
|
const while_token = p.eatToken(.keyword_while) orelse return null;
|
|
2183
2201
|
_ = try p.expectToken(.l_paren);
|
|
@@ -2409,10 +2427,10 @@ fn parseSuffixExpr(p: *Parse) !?Node.Index {
|
|
|
2409
2427
|
/// / FnProto
|
|
2410
2428
|
/// / GroupedExpr
|
|
2411
2429
|
/// / LabeledTypeExpr
|
|
2412
|
-
/// / IDENTIFIER
|
|
2430
|
+
/// / IDENTIFIER !(COLON LabelableExpr)
|
|
2413
2431
|
/// / IfTypeExpr
|
|
2414
2432
|
/// / INTEGER
|
|
2415
|
-
/// / KEYWORD_comptime TypeExpr
|
|
2433
|
+
/// / KEYWORD_comptime TypeExpr !ExprSuffix
|
|
2416
2434
|
/// / KEYWORD_error DOT IDENTIFIER
|
|
2417
2435
|
/// / KEYWORD_anyframe
|
|
2418
2436
|
/// / KEYWORD_unreachable
|
|
@@ -2431,7 +2449,7 @@ fn parseSuffixExpr(p: *Parse) !?Node.Index {
|
|
|
2431
2449
|
///
|
|
2432
2450
|
/// GroupedExpr <- LPAREN Expr RPAREN
|
|
2433
2451
|
///
|
|
2434
|
-
/// IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)?
|
|
2452
|
+
/// IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? !ExprSuffix
|
|
2435
2453
|
///
|
|
2436
2454
|
/// LabeledTypeExpr
|
|
2437
2455
|
/// <- BlockLabel Block
|
|
@@ -2711,7 +2729,7 @@ fn expectPrimaryTypeExpr(p: *Parse) !Node.Index {
|
|
|
2711
2729
|
|
|
2712
2730
|
/// WhilePrefix <- KEYWORD_while LPAREN Expr RPAREN PtrPayload? WhileContinueExpr?
|
|
2713
2731
|
///
|
|
2714
|
-
/// WhileTypeExpr <- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)?
|
|
2732
|
+
/// WhileTypeExpr <- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? !ExprSuffix
|
|
2715
2733
|
fn parseWhileTypeExpr(p: *Parse) !?Node.Index {
|
|
2716
2734
|
const while_token = p.eatToken(.keyword_while) orelse return null;
|
|
2717
2735
|
_ = try p.expectToken(.l_paren);
|
|
@@ -2876,7 +2894,7 @@ fn expectAsmExpr(p: *Parse) !Node.Index {
|
|
|
2876
2894
|
});
|
|
2877
2895
|
}
|
|
2878
2896
|
|
|
2879
|
-
/// AsmOutputItem <- LBRACKET IDENTIFIER RBRACKET
|
|
2897
|
+
/// AsmOutputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERALSINGLE LPAREN (MINUSRARROW TypeExpr / IDENTIFIER) RPAREN
|
|
2880
2898
|
fn parseAsmOutputItem(p: *Parse) !?Node.Index {
|
|
2881
2899
|
_ = p.eatToken(.l_bracket) orelse return null;
|
|
2882
2900
|
const identifier = try p.expectToken(.identifier);
|
|
@@ -2902,7 +2920,7 @@ fn parseAsmOutputItem(p: *Parse) !?Node.Index {
|
|
|
2902
2920
|
});
|
|
2903
2921
|
}
|
|
2904
2922
|
|
|
2905
|
-
/// AsmInputItem <- LBRACKET IDENTIFIER RBRACKET
|
|
2923
|
+
/// AsmInputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERALSINGLE LPAREN Expr RPAREN
|
|
2906
2924
|
fn parseAsmInputItem(p: *Parse) !?Node.Index {
|
|
2907
2925
|
_ = p.eatToken(.l_bracket) orelse return null;
|
|
2908
2926
|
const identifier = try p.expectToken(.identifier);
|
|
@@ -2923,9 +2941,7 @@ fn parseAsmInputItem(p: *Parse) !?Node.Index {
|
|
|
2923
2941
|
|
|
2924
2942
|
/// BreakLabel <- COLON IDENTIFIER
|
|
2925
2943
|
fn parseBreakLabel(p: *Parse) Error!OptionalTokenIndex {
|
|
2926
|
-
|
|
2927
|
-
const next_token = try p.expectToken(.identifier);
|
|
2928
|
-
return .fromToken(next_token);
|
|
2944
|
+
return if (p.eatTokens(&.{ .colon, .identifier })) |i| .fromToken(i + 1) else .none;
|
|
2929
2945
|
}
|
|
2930
2946
|
|
|
2931
2947
|
/// BlockLabel <- IDENTIFIER COLON
|
|
@@ -2950,12 +2966,7 @@ fn expectFieldInit(p: *Parse) !Node.Index {
|
|
|
2950
2966
|
|
|
2951
2967
|
/// WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN
|
|
2952
2968
|
fn parseWhileContinueExpr(p: *Parse) !?Node.Index {
|
|
2953
|
-
_ = p.eatToken(.colon) orelse
|
|
2954
|
-
if (p.tokenTag(p.tok_i) == .l_paren and
|
|
2955
|
-
p.tokensOnSameLine(p.tok_i - 1, p.tok_i))
|
|
2956
|
-
return p.fail(.expected_continue_expr);
|
|
2957
|
-
return null;
|
|
2958
|
-
};
|
|
2969
|
+
_ = p.eatToken(.colon) orelse return null;
|
|
2959
2970
|
_ = try p.expectToken(.l_paren);
|
|
2960
2971
|
const node = try p.parseAssignExpr() orelse return p.fail(.expected_expr_or_assignment);
|
|
2961
2972
|
_ = try p.expectToken(.r_paren);
|
|
@@ -2993,9 +3004,7 @@ fn parseAddrSpace(p: *Parse) !?Node.Index {
|
|
|
2993
3004
|
/// such as in the case of anytype and `...`. Caller must look for rparen to find
|
|
2994
3005
|
/// out when there are no more param decls left.
|
|
2995
3006
|
///
|
|
2996
|
-
/// ParamDecl
|
|
2997
|
-
/// <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType
|
|
2998
|
-
/// / DOT3
|
|
3007
|
+
/// ParamDecl <- doc_comment? (KEYWORD_noalias / KEYWORD_comptime / !KEYWORD_comptime) (IDENTIFIER COLON / !(IDENTIFIER_COLON)) ParamType
|
|
2999
3008
|
///
|
|
3000
3009
|
/// ParamType
|
|
3001
3010
|
/// <- KEYWORD_anytype
|
|
@@ -3482,7 +3491,7 @@ fn parseSwitchProngList(p: *Parse) !Node.SubRange {
|
|
|
3482
3491
|
return p.listToSpan(p.scratch.items[scratch_top..]);
|
|
3483
3492
|
}
|
|
3484
3493
|
|
|
3485
|
-
/// ParamDeclList <- (ParamDecl COMMA)* ParamDecl?
|
|
3494
|
+
/// ParamDeclList <- (ParamDecl COMMA)* (ParamDecl / DOT3 COMMA?)?
|
|
3486
3495
|
fn parseParamDeclList(p: *Parse) !SmallSpan {
|
|
3487
3496
|
_ = try p.expectToken(.l_paren);
|
|
3488
3497
|
const scratch_top = p.scratch.items.len;
|
|
@@ -3604,9 +3613,9 @@ fn parseIf(p: *Parse, comptime bodyParseFn: fn (p: *Parse) Error!Node.Index) !?N
|
|
|
3604
3613
|
});
|
|
3605
3614
|
}
|
|
3606
3615
|
|
|
3607
|
-
/// ForExpr <- ForPrefix Expr (KEYWORD_else Expr)
|
|
3616
|
+
/// ForExpr <- ForPrefix Expr (KEYWORD_else Expr / !KEYWORD_else) !ExprSuffix
|
|
3608
3617
|
///
|
|
3609
|
-
/// ForTypeExpr <- ForPrefix TypeExpr (KEYWORD_else TypeExpr)
|
|
3618
|
+
/// ForTypeExpr <- ForPrefix TypeExpr (KEYWORD_else TypeExpr / !KEYWORD_else) !ExprSuffix
|
|
3610
3619
|
fn parseFor(p: *Parse, comptime bodyParseFn: fn (p: *Parse) Error!Node.Index) !?Node.Index {
|
|
3611
3620
|
const for_token = p.eatToken(.keyword_for) orelse return null;
|
|
3612
3621
|
|
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,
|
package/std/zig/Zir.zig
CHANGED
|
@@ -2009,6 +2009,14 @@ pub const Inst = struct {
|
|
|
2009
2009
|
/// `operand` is payload index to `BinNode`.
|
|
2010
2010
|
/// `small` is unused.
|
|
2011
2011
|
shl_with_overflow,
|
|
2012
|
+
/// `@round`, `@floor`, `@ceil`, or `@trunc`, with a result type.
|
|
2013
|
+
/// `operand` is payload index to `BinNode`.
|
|
2014
|
+
/// `small` is a `RoundOp` representing the specific operation being performed.
|
|
2015
|
+
round_op,
|
|
2016
|
+
/// Returns the type for the operand of a rounding op.
|
|
2017
|
+
/// `operand` is `UnNode`.
|
|
2018
|
+
/// `small` is unused.
|
|
2019
|
+
round_op_ty,
|
|
2012
2020
|
/// `operand` is payload index to `UnNode`.
|
|
2013
2021
|
c_undef,
|
|
2014
2022
|
/// `operand` is payload index to `UnNode`.
|
|
@@ -3233,6 +3241,13 @@ pub const Inst = struct {
|
|
|
3233
3241
|
string_to_union_field_attrs,
|
|
3234
3242
|
};
|
|
3235
3243
|
|
|
3244
|
+
pub const RoundOp = enum(u16) {
|
|
3245
|
+
round,
|
|
3246
|
+
floor,
|
|
3247
|
+
ceil,
|
|
3248
|
+
trunc,
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3236
3251
|
pub const UnNode = struct {
|
|
3237
3252
|
node: Ast.Node.Offset,
|
|
3238
3253
|
operand: Ref,
|
|
@@ -4344,6 +4359,7 @@ fn findTrackableInner(
|
|
|
4344
4359
|
.sub_with_overflow,
|
|
4345
4360
|
.mul_with_overflow,
|
|
4346
4361
|
.shl_with_overflow,
|
|
4362
|
+
.round_op,
|
|
4347
4363
|
.c_undef,
|
|
4348
4364
|
.c_include,
|
|
4349
4365
|
.c_define,
|
|
@@ -4385,6 +4401,7 @@ fn findTrackableInner(
|
|
|
4385
4401
|
.dbg_empty_stmt,
|
|
4386
4402
|
.astgen_error,
|
|
4387
4403
|
.float_op_result_ty,
|
|
4404
|
+
.round_op_ty,
|
|
4388
4405
|
=> return,
|
|
4389
4406
|
|
|
4390
4407
|
// `@TypeOf` has a body.
|
|
@@ -81,15 +81,20 @@ fn ToUnsigned(comptime T: type) type {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/// Constructs a [*c] pointer with the const and volatile annotations
|
|
84
|
-
/// from
|
|
85
|
-
pub fn FlexibleArrayType(comptime
|
|
86
|
-
|
|
87
|
-
.pointer => |ptr|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
/// from SelfType for pointing to a C flexible array of ElementType.
|
|
85
|
+
pub fn FlexibleArrayType(comptime SelfType: type, comptime ElementType: type) type {
|
|
86
|
+
switch (@typeInfo(SelfType)) {
|
|
87
|
+
.pointer => |ptr| {
|
|
88
|
+
return @Pointer(.c, .{
|
|
89
|
+
.@"const" = ptr.is_const,
|
|
90
|
+
.@"volatile" = ptr.is_volatile,
|
|
91
|
+
.@"allowzero" = true,
|
|
92
|
+
.@"addrspace" = .generic,
|
|
93
|
+
.@"align" = null,
|
|
94
|
+
}, ElementType, null);
|
|
95
|
+
},
|
|
96
|
+
else => |info| @compileError("Invalid self type \"" ++ @tagName(info) ++ "\" for flexible array getter: " ++ @typeName(SelfType)),
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
/// Promote the type of an integer literal until it fits as C would.
|