@zigc/lib 0.16.0-test.1 → 0.17.0-dev.131
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/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +138 -114
- package/c/pthread.zig +57 -0
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +0 -100
- package/c/string.zig +20 -7
- package/c/strings.zig +0 -38
- package/c/stropts.zig +17 -0
- package/c/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +3 -2
- 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 +8 -7
- package/compiler/aro/aro/Compilation.zig +137 -111
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +138 -63
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +352 -153
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +136 -62
- 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/message.zig +3 -2
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +7 -8
- 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 -2
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce/Walk.zig +7 -7
- 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 +194 -62
- 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 +369 -127
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +76 -17
- package/compiler_rt/cos.zig +140 -53
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -6
- package/compiler_rt/exp2.zig +1 -6
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/limb64.zig +1127 -0
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +139 -56
- package/compiler_rt/sincos.zig +277 -72
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +117 -48
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +857 -307
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Cache.zig +6 -6
- 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 -1
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +538 -89
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +10 -19
- package/std/Build/WebServer.zig +31 -19
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -17
- package/std/Io/Dir.zig +7 -2
- package/std/Io/Dispatch.zig +5 -13
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Reader.zig +8 -9
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +352 -180
- package/std/Io/Uring.zig +15 -16
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +1052 -20
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target.zig +53 -7
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +105 -573
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +106 -24
- package/std/compress/flate/Compress.zig +3 -3
- package/std/compress/flate/Decompress.zig +2 -3
- package/std/compress/zstd/Decompress.zig +2 -4
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/Certificate.zig +13 -1
- package/std/crypto/ascon.zig +75 -33
- package/std/crypto/codecs/asn1/Oid.zig +12 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +16 -8
- package/std/crypto/ml_kem.zig +2 -9
- package/std/crypto/tls/Client.zig +79 -4
- package/std/crypto/tls.zig +1 -1
- package/std/crypto.zig +1 -0
- 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 +540 -37
- 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 +181 -66
- package/std/enums.zig +25 -19
- package/std/fmt.zig +8 -3
- package/std/fs/path.zig +6 -4
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/debug_allocator.zig +7 -7
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +31 -30
- package/std/http.zig +14 -13
- package/std/json/Scanner.zig +2 -2
- 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/IoUring.zig +2 -0
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +173 -0
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +419 -438
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/windows.zig +2 -2
- package/std/os.zig +41 -0
- 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/process.zig +1 -1
- package/std/sort.zig +3 -3
- 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 +187 -459
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +86 -103
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/Client.zig +8 -3
- package/std/zig/LibCInstallation.zig +4 -3
- package/std/zig/Parse.zig +90 -81
- package/std/zig/Server.zig +26 -0
- package/std/zig/WindowsSdk.zig +13 -13
- package/std/zig/Zir.zig +66 -62
- package/std/zig/ZonGen.zig +6 -5
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +119 -60
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +7 -10
- package/std/zip.zig +5 -5
- package/zig.h +340 -1
- 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/fdiml.c +0 -24
- 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/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/linux/tee.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/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- 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/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
|
@@ -158,12 +158,10 @@ pub const BootServices = extern struct {
|
|
|
158
158
|
_locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,
|
|
159
159
|
|
|
160
160
|
/// Installs one or more protocol interfaces into the boot services environment
|
|
161
|
-
|
|
162
|
-
_installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
|
|
161
|
+
_installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status,
|
|
163
162
|
|
|
164
163
|
/// Removes one or more protocol interfaces into the boot services environment
|
|
165
|
-
|
|
166
|
-
_uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
|
|
164
|
+
_uninstallMultipleProtocolInterfaces: *const fn (handle: Handle, ...) callconv(cc) Status,
|
|
167
165
|
|
|
168
166
|
/// Computes and returns a 32-bit CRC for a data buffer.
|
|
169
167
|
_calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
|
|
@@ -1238,8 +1236,9 @@ fn protocolInterfaces(
|
|
|
1238
1236
|
@TypeOf(interfaces),
|
|
1239
1237
|
) = undefined;
|
|
1240
1238
|
result[0] = handle_arg;
|
|
1239
|
+
result[result.len - 1] = null;
|
|
1241
1240
|
|
|
1242
|
-
var idx: usize = 1;
|
|
1241
|
+
comptime var idx: usize = 1;
|
|
1243
1242
|
inline for (interfaces) |interface| {
|
|
1244
1243
|
const InterfacePtr = @TypeOf(interface);
|
|
1245
1244
|
const Interface = switch (@typeInfo(InterfacePtr)) {
|
|
@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
|
|
|
1272
1271
|
@compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
|
|
1273
1272
|
const interfaces_info = interfaces_type_info.@"struct";
|
|
1274
1273
|
|
|
1275
|
-
var tuple_types: [interfaces_info.fields.len * 2 +
|
|
1274
|
+
var tuple_types: [interfaces_info.fields.len * 2 + 2]type = undefined;
|
|
1276
1275
|
tuple_types[0] = HandleType;
|
|
1276
|
+
tuple_types[tuple_types.len - 1] = ?*const Guid;
|
|
1277
|
+
|
|
1277
1278
|
var idx = 1;
|
|
1278
|
-
while (idx < tuple_types.len) : (idx += 2) {
|
|
1279
|
+
while (idx < tuple_types.len - 1) : (idx += 2) {
|
|
1279
1280
|
tuple_types[idx] = *const Guid;
|
|
1280
1281
|
tuple_types[idx + 1] = *const anyopaque;
|
|
1281
1282
|
}
|
|
1282
1283
|
|
|
1283
|
-
return
|
|
1284
|
+
return @Tuple(tuple_types[0..]);
|
|
1284
1285
|
}
|
package/std/os/windows.zig
CHANGED
|
@@ -3952,7 +3952,7 @@ inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID {
|
|
|
3952
3952
|
/// and you get an unexpected error.
|
|
3953
3953
|
pub fn unexpectedError(err: Win32Error) UnexpectedError {
|
|
3954
3954
|
@branchHint(.cold);
|
|
3955
|
-
if (std.
|
|
3955
|
+
if (std.options.unexpected_error_tracing) {
|
|
3956
3956
|
std.debug.print("error.Unexpected: GetLastError({d}): {t}\n", .{ err, err });
|
|
3957
3957
|
std.debug.dumpCurrentStackTrace(.{ .first_address = @returnAddress() });
|
|
3958
3958
|
}
|
|
@@ -3962,7 +3962,7 @@ pub fn unexpectedError(err: Win32Error) UnexpectedError {
|
|
|
3962
3962
|
/// Call this when you made a windows NtDll call
|
|
3963
3963
|
/// and you get an unexpected status.
|
|
3964
3964
|
pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError {
|
|
3965
|
-
if (std.
|
|
3965
|
+
if (std.options.unexpected_error_tracing) {
|
|
3966
3966
|
std.debug.print("error.Unexpected NTSTATUS=0x{x} ({s})\n", .{
|
|
3967
3967
|
@intFromEnum(status),
|
|
3968
3968
|
std.enums.tagName(NTSTATUS, status) orelse "<unnamed>",
|
package/std/os.zig
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const builtin = @import("builtin");
|
|
2
|
+
const std = @import("std.zig");
|
|
2
3
|
const native_os = builtin.os.tag;
|
|
3
4
|
|
|
4
5
|
pub const linux = @import("os/linux.zig");
|
|
@@ -8,6 +9,46 @@ pub const wasi = @import("os/wasi.zig");
|
|
|
8
9
|
pub const emscripten = @import("os/emscripten.zig");
|
|
9
10
|
pub const windows = @import("os/windows.zig");
|
|
10
11
|
|
|
12
|
+
/// Returns whether the Zig standard library requires libc in order to interface
|
|
13
|
+
/// with the operating system on the given target.
|
|
14
|
+
pub fn targetRequiresLibC(target: *const std.Target) bool {
|
|
15
|
+
if (target.requiresLibC()) return true;
|
|
16
|
+
return switch (target.os.tag) {
|
|
17
|
+
.linux => switch (target.cpu.arch) {
|
|
18
|
+
// https://codeberg.org/ziglang/zig/issues/30940
|
|
19
|
+
.alpha,
|
|
20
|
+
// https://codeberg.org/ziglang/zig/issues/30942
|
|
21
|
+
.csky,
|
|
22
|
+
// https://codeberg.org/ziglang/zig/issues/30943
|
|
23
|
+
.hppa,
|
|
24
|
+
.hppa64,
|
|
25
|
+
// https://codeberg.org/ziglang/zig/issues/30944
|
|
26
|
+
.microblaze,
|
|
27
|
+
.microblazeel,
|
|
28
|
+
// https://codeberg.org/ziglang/zig/issues/30946
|
|
29
|
+
.sh,
|
|
30
|
+
.sheb,
|
|
31
|
+
// https://codeberg.org/ziglang/zig/issues/30945
|
|
32
|
+
.sparc,
|
|
33
|
+
// https://codeberg.org/ziglang/zig/issues/30947
|
|
34
|
+
.xtensa,
|
|
35
|
+
.xtensaeb,
|
|
36
|
+
=> true,
|
|
37
|
+
else => false,
|
|
38
|
+
},
|
|
39
|
+
.freebsd => true, // https://codeberg.org/ziglang/zig/issues/30981
|
|
40
|
+
.netbsd => true, // https://codeberg.org/ziglang/zig/issues/30980
|
|
41
|
+
.openbsd => true, // https://codeberg.org/ziglang/zig/issues/30982
|
|
42
|
+
else => false,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// Returns whether the Zig standard library requires libc in order to interface
|
|
47
|
+
/// with the operating system on the current target.
|
|
48
|
+
pub fn requiresLibC() bool {
|
|
49
|
+
return targetRequiresLibC(&builtin.target);
|
|
50
|
+
}
|
|
51
|
+
|
|
11
52
|
test {
|
|
12
53
|
_ = linux;
|
|
13
54
|
if (native_os == .uefi) _ = uefi;
|
package/std/pdb.zig
CHANGED
|
@@ -314,11 +314,9 @@ pub const SymbolKind = enum(u16) {
|
|
|
314
314
|
|
|
315
315
|
pub const TypeIndex = u32;
|
|
316
316
|
|
|
317
|
-
// TODO According to this header:
|
|
318
|
-
// https://github.com/microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/include/cvinfo.h#L3722
|
|
319
|
-
// we should define RecordPrefix as part of the ProcSym structure.
|
|
320
|
-
// This might be important when we start generating PDB in self-hosted with our own PE linker.
|
|
321
317
|
pub const ProcSym = extern struct {
|
|
318
|
+
record_len: u16,
|
|
319
|
+
record_kind: SymbolKind,
|
|
322
320
|
parent: u32,
|
|
323
321
|
end: u32,
|
|
324
322
|
next: u32,
|
|
@@ -508,3 +506,144 @@ pub const SuperBlock = extern struct {
|
|
|
508
506
|
// implement it so we're kind of safe making this assumption for now.
|
|
509
507
|
block_map_addr: u32,
|
|
510
508
|
};
|
|
509
|
+
|
|
510
|
+
pub const IpiStreamVersion = enum(u32) {
|
|
511
|
+
v40 = 19950410,
|
|
512
|
+
v41 = 19951122,
|
|
513
|
+
v50 = 19961031,
|
|
514
|
+
v70 = 19990903,
|
|
515
|
+
v80 = 20040203,
|
|
516
|
+
_,
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
pub const IpiStreamHeader = extern struct {
|
|
520
|
+
version: IpiStreamVersion,
|
|
521
|
+
header_size: u32,
|
|
522
|
+
type_index_begin: u32,
|
|
523
|
+
type_index_end: u32,
|
|
524
|
+
type_record_bytes: u32,
|
|
525
|
+
hash_stream_index: u16,
|
|
526
|
+
hash_aux_stream_index: u16,
|
|
527
|
+
hash_key_size: u32,
|
|
528
|
+
num_hash_buckets: u32,
|
|
529
|
+
hash_value_buffer_offset: i32,
|
|
530
|
+
hash_value_buffer_length: u32,
|
|
531
|
+
index_offset_buffer_offset: i32,
|
|
532
|
+
index_offset_buffer_length: u32,
|
|
533
|
+
hash_adj_buffer_offset: i32,
|
|
534
|
+
hash_adj_buffer_length: u32,
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
pub const LfRecordPrefix = extern struct {
|
|
538
|
+
len: u16,
|
|
539
|
+
kind: LfRecordKind,
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
pub const LfRecordKind = enum(u16) {
|
|
543
|
+
pointer = 0x1002,
|
|
544
|
+
modifier = 0x1001,
|
|
545
|
+
procedure = 0x1008,
|
|
546
|
+
mfunction = 0x1009,
|
|
547
|
+
label = 0x000e,
|
|
548
|
+
arglist = 0x1201,
|
|
549
|
+
fieldlist = 0x1203,
|
|
550
|
+
array = 0x1503,
|
|
551
|
+
class = 0x1504,
|
|
552
|
+
structure = 0x1505,
|
|
553
|
+
interface = 0x1519,
|
|
554
|
+
@"union" = 0x1506,
|
|
555
|
+
@"enum" = 0x1507,
|
|
556
|
+
typeserver2 = 0x1515,
|
|
557
|
+
vftable = 0x151d,
|
|
558
|
+
vtshape = 0x000a,
|
|
559
|
+
bitfield = 0x1205,
|
|
560
|
+
func_id = 0x1601,
|
|
561
|
+
mfunc_id = 0x1602,
|
|
562
|
+
buildinfo = 0x1603,
|
|
563
|
+
substr_list = 0x1604,
|
|
564
|
+
string_id = 0x1605,
|
|
565
|
+
udt_src_line = 0x1606,
|
|
566
|
+
udt_mod_src_line = 0x1607,
|
|
567
|
+
methodlist = 0x1206,
|
|
568
|
+
precomp = 0x1509,
|
|
569
|
+
endprecomp = 0x0014,
|
|
570
|
+
bclass = 0x1400,
|
|
571
|
+
binterface = 0x151a,
|
|
572
|
+
vbclass = 0x1401,
|
|
573
|
+
ivbclass = 0x1402,
|
|
574
|
+
vfunctab = 0x1409,
|
|
575
|
+
stmember = 0x150e,
|
|
576
|
+
method = 0x150f,
|
|
577
|
+
member = 0x150d,
|
|
578
|
+
nesttype = 0x1510,
|
|
579
|
+
onemethod = 0x1511,
|
|
580
|
+
enumerate = 0x1502,
|
|
581
|
+
index = 0x1404,
|
|
582
|
+
pad0 = 0xf0,
|
|
583
|
+
_,
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
pub const LfFuncId = extern struct {
|
|
587
|
+
len: u16,
|
|
588
|
+
kind: LfRecordKind,
|
|
589
|
+
scope_id: u32,
|
|
590
|
+
type: u32,
|
|
591
|
+
name: [1]u8, // null-terminated
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
pub const LfMFuncId = extern struct {
|
|
595
|
+
len: u16,
|
|
596
|
+
kind: LfRecordKind,
|
|
597
|
+
parent_type: u32,
|
|
598
|
+
type: u32,
|
|
599
|
+
name: [1]u8, // null-terminated
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
pub const InlineSiteSym = extern struct {
|
|
603
|
+
record_len: u16,
|
|
604
|
+
record_kind: SymbolKind,
|
|
605
|
+
parent: u32,
|
|
606
|
+
end: u32,
|
|
607
|
+
inlinee: u32,
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
pub const InlineSiteSym2 = extern struct {
|
|
611
|
+
record_len: u16,
|
|
612
|
+
record_kind: SymbolKind,
|
|
613
|
+
parent: u32,
|
|
614
|
+
end: u32,
|
|
615
|
+
inlinee: u32,
|
|
616
|
+
invocations: u32,
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
pub const InlineeSourceLineSignature = enum(u32) { normal = 0, ex = 1, _ };
|
|
620
|
+
|
|
621
|
+
pub const InlineeSourceLine = extern struct {
|
|
622
|
+
inlinee: u32,
|
|
623
|
+
file_id: u32,
|
|
624
|
+
source_line_num: u32,
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
pub const InlineeSourceLineEx = extern struct {
|
|
628
|
+
inlinee: u32,
|
|
629
|
+
file_id: u32,
|
|
630
|
+
source_line_num: u32,
|
|
631
|
+
count_of_extra_files: u32,
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
pub const BinaryAnnotationOpcode = enum(u8) {
|
|
635
|
+
invalid = 0,
|
|
636
|
+
code_offset = 1,
|
|
637
|
+
change_code_offset_base = 2,
|
|
638
|
+
change_code_offset = 3,
|
|
639
|
+
change_code_length = 4,
|
|
640
|
+
change_file = 5,
|
|
641
|
+
change_line_offset = 6,
|
|
642
|
+
change_line_end_delta = 7,
|
|
643
|
+
change_range_kind = 8,
|
|
644
|
+
change_column_start = 9,
|
|
645
|
+
change_column_end_delta = 10,
|
|
646
|
+
change_code_offset_and_line_offset = 11,
|
|
647
|
+
change_code_length_and_code_offset = 12,
|
|
648
|
+
change_column_end = 13,
|
|
649
|
+
};
|
package/std/posix.zig
CHANGED
|
@@ -513,6 +513,9 @@ pub const GetSockNameError = error{
|
|
|
513
513
|
SocketNotBound,
|
|
514
514
|
|
|
515
515
|
FileDescriptorNotASocket,
|
|
516
|
+
|
|
517
|
+
/// The socket is not connected (connection-oriented sockets only).
|
|
518
|
+
SocketUnconnected,
|
|
516
519
|
} || UnexpectedError;
|
|
517
520
|
|
|
518
521
|
pub fn getpeername(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSockNameError!void {
|
|
@@ -529,6 +532,7 @@ pub fn getpeername(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSock
|
|
|
529
532
|
.INVAL => unreachable, // invalid parameters
|
|
530
533
|
.NOTSOCK => return error.FileDescriptorNotASocket,
|
|
531
534
|
.NOBUFS => return error.SystemResources,
|
|
535
|
+
.NOTCONN => return error.SocketUnconnected,
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
538
|
}
|
|
@@ -682,7 +686,7 @@ pub fn munmap(memory: []align(page_size_min) const u8) void {
|
|
|
682
686
|
.SUCCESS => return,
|
|
683
687
|
.INVAL => unreachable, // Invalid parameters.
|
|
684
688
|
.NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping.
|
|
685
|
-
else => |e| if (unexpected_error_tracing) {
|
|
689
|
+
else => |e| if (std.options.unexpected_error_tracing) {
|
|
686
690
|
std.debug.panic("unexpected errno: {d} ({t})", .{ @intFromEnum(e), e });
|
|
687
691
|
} else unreachable,
|
|
688
692
|
}
|
|
@@ -1658,22 +1662,12 @@ pub fn name_to_handle_atZ(
|
|
|
1658
1662
|
|
|
1659
1663
|
pub const lfs64_abi = native_os == .linux and builtin.link_libc and (builtin.abi.isGnu() or builtin.abi.isAndroid());
|
|
1660
1664
|
|
|
1661
|
-
/// Whether or not `error.Unexpected` will print its value and a stack trace.
|
|
1662
|
-
///
|
|
1663
|
-
/// If this happens the fix is to add the error code to the corresponding
|
|
1664
|
-
/// switch expression, possibly introduce a new error in the error set, and
|
|
1665
|
-
/// send a patch to Zig.
|
|
1666
|
-
pub const unexpected_error_tracing = builtin.mode == .Debug and switch (builtin.zig_backend) {
|
|
1667
|
-
.stage2_llvm, .stage2_x86_64 => true,
|
|
1668
|
-
else => false,
|
|
1669
|
-
};
|
|
1670
|
-
|
|
1671
1665
|
pub const UnexpectedError = std.Io.UnexpectedError;
|
|
1672
1666
|
|
|
1673
1667
|
/// Call this when you made a syscall or something that sets errno
|
|
1674
1668
|
/// and you get an unexpected error.
|
|
1675
1669
|
pub fn unexpectedErrno(err: E) UnexpectedError {
|
|
1676
|
-
if (unexpected_error_tracing) {
|
|
1670
|
+
if (std.options.unexpected_error_tracing) {
|
|
1677
1671
|
std.debug.print("unexpected errno: {d}\n", .{@intFromEnum(err)});
|
|
1678
1672
|
std.debug.dumpCurrentStackTrace(.{});
|
|
1679
1673
|
}
|
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/process/Child.zig
CHANGED
package/std/process/Environ.zig
CHANGED
|
@@ -24,7 +24,7 @@ pub const empty: Environ = .{ .block = .empty };
|
|
|
24
24
|
/// operating system `void` is also used.
|
|
25
25
|
pub const Block = switch (native_os) {
|
|
26
26
|
.windows => GlobalBlock,
|
|
27
|
-
.wasi => switch (builtin.link_libc) {
|
|
27
|
+
.wasi, .emscripten => switch (builtin.link_libc) {
|
|
28
28
|
false => GlobalBlock,
|
|
29
29
|
true => PosixBlock,
|
|
30
30
|
},
|
package/std/process.zig
CHANGED
|
@@ -130,7 +130,7 @@ pub fn posixGetUserInfo(io: Io, name: []const u8) !UserInfo {
|
|
|
130
130
|
return posixGetUserInfoPasswdStream(name, &file_reader.interface) catch |err| switch (err) {
|
|
131
131
|
error.ReadFailed => return file_reader.err.?,
|
|
132
132
|
error.EndOfStream => return error.UserNotFound,
|
|
133
|
-
error.CorruptPasswordFile => return
|
|
133
|
+
error.CorruptPasswordFile => |e| return e,
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
package/std/sort.zig
CHANGED
|
@@ -749,9 +749,9 @@ test partitionPoint {
|
|
|
749
749
|
|
|
750
750
|
/// Returns a tuple of the lower and upper indices in `items` between which all
|
|
751
751
|
/// elements return `.eq` when given to `compareFn`.
|
|
752
|
-
///
|
|
753
|
-
///
|
|
754
|
-
///
|
|
752
|
+
/// If no element in `items` returns `.eq`, both indices are the index of the
|
|
753
|
+
/// first element in `items` which returns `.gt`, or if no element returns `.gt`,
|
|
754
|
+
/// both indices are `items.len`.
|
|
755
755
|
///
|
|
756
756
|
/// `items` must be sorted in ascending order with respect to `compareFn`:
|
|
757
757
|
/// ```
|
package/std/start.zig
CHANGED
|
@@ -631,6 +631,7 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [:null]?[*:0]u8)
|
|
|
631
631
|
if (std.Options.debug_threaded_io) |t| {
|
|
632
632
|
if (@sizeOf(std.Io.Threaded.Argv0) != 0) t.argv0.value = argv[0];
|
|
633
633
|
t.environ = .{ .process_environ = .{ .block = env_block } };
|
|
634
|
+
t.environ_initialized = env_block.isEmpty();
|
|
634
635
|
}
|
|
635
636
|
std.Thread.maybeAttachSignalStack();
|
|
636
637
|
std.debug.maybeEnableSegfaultHandler();
|
|
@@ -664,10 +665,22 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal
|
|
|
664
665
|
|
|
665
666
|
fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int {
|
|
666
667
|
const argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@intCast(c_argc)];
|
|
667
|
-
|
|
668
|
-
|
|
668
|
+
const environ: [:null]?[*:0]u8 = switch (builtin.os.tag) {
|
|
669
|
+
.wasi, .emscripten => environ: {
|
|
670
|
+
const c_environ = std.c.environ;
|
|
671
|
+
var env_count: usize = 0;
|
|
672
|
+
while (c_environ[env_count] != null) : (env_count += 1) {}
|
|
673
|
+
break :environ c_environ[0..env_count :null];
|
|
674
|
+
},
|
|
675
|
+
else => &.{},
|
|
676
|
+
};
|
|
677
|
+
const env_block: std.process.Environ.Block = .{ .slice = environ };
|
|
678
|
+
if (std.Options.debug_threaded_io) |t| {
|
|
679
|
+
if (@sizeOf(std.Io.Threaded.Argv0) != 0) t.argv0.value = argv[0];
|
|
680
|
+
t.environ = .{ .process_environ = .{ .block = env_block } };
|
|
681
|
+
t.environ_initialized = env_block.isEmpty();
|
|
669
682
|
}
|
|
670
|
-
return callMain(argv,
|
|
683
|
+
return callMain(argv, env_block);
|
|
671
684
|
}
|
|
672
685
|
|
|
673
686
|
/// General error message for a malformed return type
|
|
@@ -748,7 +761,7 @@ inline fn wrapMain(result: anytype) u8 {
|
|
|
748
761
|
std.log.err("{t}", .{err});
|
|
749
762
|
switch (native_os) {
|
|
750
763
|
.freestanding, .other => {},
|
|
751
|
-
else => if (@errorReturnTrace()) |trace| std.debug.
|
|
764
|
+
else => if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace),
|
|
752
765
|
}
|
|
753
766
|
return 1;
|
|
754
767
|
};
|
package/std/std.zig
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
|
|
2
|
-
pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged;
|
|
3
|
-
pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap;
|
|
4
|
-
pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged;
|
|
5
1
|
pub const AutoHashMap = hash_map.AutoHashMap;
|
|
6
2
|
pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged;
|
|
7
3
|
pub const BitStack = @import("BitStack.zig");
|
|
@@ -31,14 +27,19 @@ pub const SinglyLinkedList = @import("SinglyLinkedList.zig");
|
|
|
31
27
|
pub const StaticBitSet = bit_set.StaticBitSet;
|
|
32
28
|
pub const StringHashMap = hash_map.StringHashMap;
|
|
33
29
|
pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
|
|
34
|
-
pub const StringArrayHashMap = array_hash_map.StringArrayHashMap;
|
|
35
|
-
pub const StringArrayHashMapUnmanaged = array_hash_map.StringArrayHashMapUnmanaged;
|
|
36
30
|
pub const Target = @import("Target.zig");
|
|
37
31
|
pub const Thread = @import("Thread.zig");
|
|
38
32
|
pub const Treap = @import("treap.zig").Treap;
|
|
39
33
|
pub const Tz = tz.Tz;
|
|
40
34
|
pub const Uri = @import("Uri.zig");
|
|
41
35
|
|
|
36
|
+
/// Deprecated; use `array_hash_map.Custom`.
|
|
37
|
+
pub const ArrayHashMapUnmanaged = array_hash_map.Custom;
|
|
38
|
+
/// Deprecated; use `array_hash_map.Auto`.
|
|
39
|
+
pub const AutoArrayHashMapUnmanaged = array_hash_map.Auto;
|
|
40
|
+
/// Deprecated; use `array_hash_map.String`.
|
|
41
|
+
pub const StringArrayHashMapUnmanaged = array_hash_map.String;
|
|
42
|
+
|
|
42
43
|
/// A contiguous, growable list of items in memory. This is a wrapper around a
|
|
43
44
|
/// slice of `T` values.
|
|
44
45
|
///
|
|
@@ -164,6 +165,8 @@ pub const Options = struct {
|
|
|
164
165
|
/// * `debug.dumpCurrentStackTrace`
|
|
165
166
|
/// * `debug.writeStackTrace`
|
|
166
167
|
/// * `debug.dumpStackTrace`
|
|
168
|
+
/// * `debug.writeErrorReturnTrace`
|
|
169
|
+
/// * `debug.dumpErrorReturnTrace`
|
|
167
170
|
///
|
|
168
171
|
/// Stack traces can generally be collected and printed when debug info is stripped, but are
|
|
169
172
|
/// often less useful since they usually cannot be mapped to source locations and/or have bad
|
|
@@ -177,6 +180,16 @@ pub const Options = struct {
|
|
|
177
180
|
/// Allows disabling networking in std.Io implementations.
|
|
178
181
|
networking: bool = true,
|
|
179
182
|
|
|
183
|
+
/// Whether or not `error.Unexpected` will print its value and a stack trace.
|
|
184
|
+
///
|
|
185
|
+
/// If this happens the fix is to add the error code to the corresponding
|
|
186
|
+
/// switch expression, possibly introduce a new error in the error set, and
|
|
187
|
+
/// send a patch to Zig.
|
|
188
|
+
unexpected_error_tracing: bool = @import("builtin").mode == .Debug and switch (@import("builtin").zig_backend) {
|
|
189
|
+
.stage2_llvm, .stage2_x86_64 => true,
|
|
190
|
+
else => false,
|
|
191
|
+
},
|
|
192
|
+
|
|
180
193
|
/// TODO This is a separate decl instead of a field as a workaround around
|
|
181
194
|
/// compilation errors due to zig not being lazy enough.
|
|
182
195
|
pub const logTerminalMode: fn () Io.Terminal.Mode = log.defaultTerminalMode;
|
|
@@ -65,7 +65,7 @@ fn alloc(
|
|
|
65
65
|
if (self.alloc_index == self.fail_index) {
|
|
66
66
|
if (!self.has_induced_failure) {
|
|
67
67
|
const st = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &self.stack_addresses);
|
|
68
|
-
@memset(self.stack_addresses[@min(st.
|
|
68
|
+
@memset(self.stack_addresses[@min(st.return_addresses.len, self.stack_addresses.len)..], 0);
|
|
69
69
|
self.has_induced_failure = true;
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
@@ -131,15 +131,15 @@ fn free(
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/// Only valid once `has_induced_failure == true`
|
|
134
|
-
pub fn getStackTrace(self: *FailingAllocator) std.
|
|
134
|
+
pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace {
|
|
135
135
|
std.debug.assert(self.has_induced_failure);
|
|
136
136
|
var len: usize = 0;
|
|
137
137
|
while (len < self.stack_addresses.len and self.stack_addresses[len] != 0) {
|
|
138
138
|
len += 1;
|
|
139
139
|
}
|
|
140
140
|
return .{
|
|
141
|
-
.
|
|
142
|
-
.
|
|
141
|
+
.return_addresses = self.stack_addresses[0..len],
|
|
142
|
+
.skipped = if (len == self.stack_addresses.len) .unknown else .none,
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
|