@zigc/lib 0.16.0 → 0.17.0-dev.135
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/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +46 -122
- 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/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +2 -2
- package/compiler/aro/aro/CodeGen.zig +5 -6
- package/compiler/aro/aro/Compilation.zig +17 -14
- package/compiler/aro/aro/Driver.zig +14 -13
- package/compiler/aro/aro/Parser.zig +20 -15
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor.zig +9 -6
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +4 -4
- package/compiler/build_runner.zig +0 -2
- package/compiler/reduce/Walk.zig +7 -7
- package/compiler/test_runner.zig +2 -2
- package/compiler/translate-c/Translator.zig +6 -2
- package/compiler/translate-c/main.zig +1 -1
- package/compiler_rt/cos.zig +0 -2
- 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 +876 -15
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +0 -2
- package/compiler_rt/sincos.zig +0 -2
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +0 -2
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/fuzzer.zig +2 -0
- package/libc/include/aarch64-linux-any/asm/hwcap.h +1 -0
- package/libc/include/aarch64-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/any-linux-any/asm-generic/errno.h +2 -0
- package/libc/include/any-linux-any/asm-generic/unistd.h +4 -1
- package/libc/include/any-linux-any/drm/amdgpu_drm.h +20 -6
- package/libc/include/any-linux-any/drm/amdxdna_accel.h +8 -0
- package/libc/include/any-linux-any/drm/drm_fourcc.h +6 -6
- package/libc/include/any-linux-any/drm/panfrost_drm.h +75 -1
- package/libc/include/any-linux-any/drm/panthor_drm.h +154 -3
- package/libc/include/any-linux-any/drm/rocket_accel.h +74 -24
- package/libc/include/any-linux-any/drm/xe_drm.h +89 -6
- package/libc/include/any-linux-any/linux/android/binder.h +1 -1
- package/libc/include/any-linux-any/linux/bpf.h +28 -0
- package/libc/include/any-linux-any/linux/btrfs.h +1 -0
- package/libc/include/any-linux-any/linux/btrfs_tree.h +32 -2
- package/libc/include/any-linux-any/linux/dma-buf.h +1 -0
- package/libc/include/any-linux-any/linux/dpll.h +1 -0
- package/libc/include/any-linux-any/linux/elf.h +2 -0
- package/libc/include/any-linux-any/linux/ethtool.h +21 -5
- package/libc/include/any-linux-any/linux/fs.h +1 -0
- package/libc/include/any-linux-any/linux/hyperv.h +1 -1
- package/libc/include/any-linux-any/linux/idxd.h +134 -134
- package/libc/include/any-linux-any/linux/if_alg.h +1 -1
- package/libc/include/any-linux-any/linux/if_link.h +1 -0
- package/libc/include/any-linux-any/linux/input-event-codes.h +4 -0
- package/libc/include/any-linux-any/linux/io_uring/bpf_filter.h +68 -0
- package/libc/include/any-linux-any/linux/io_uring/query.h +5 -1
- package/libc/include/any-linux-any/linux/io_uring.h +33 -2
- package/libc/include/any-linux-any/linux/iommufd.h +39 -0
- package/libc/include/any-linux-any/linux/kfd_ioctl.h +13 -3
- package/libc/include/any-linux-any/linux/kfd_sysfs.h +2 -1
- package/libc/include/any-linux-any/linux/kvm.h +30 -6
- package/libc/include/any-linux-any/linux/landlock.h +22 -8
- package/libc/include/any-linux-any/linux/magic.h +1 -0
- package/libc/include/any-linux-any/linux/mempolicy.h +3 -0
- package/libc/include/any-linux-any/linux/mount.h +11 -2
- package/libc/include/any-linux-any/linux/mptcp_pm.h +1 -1
- package/libc/include/any-linux-any/linux/mshv.h +2 -0
- package/libc/include/any-linux-any/linux/netfilter_bridge.h +5 -4
- package/libc/include/any-linux-any/linux/netfilter_ipv4.h +4 -5
- package/libc/include/any-linux-any/linux/netfilter_ipv6.h +3 -4
- package/libc/include/any-linux-any/linux/nfs.h +1 -1
- package/libc/include/any-linux-any/linux/nfsd_netlink.h +1 -0
- package/libc/include/any-linux-any/linux/nilfs2_api.h +2 -2
- package/libc/include/any-linux-any/linux/nilfs2_ondisk.h +97 -66
- package/libc/include/any-linux-any/linux/nl80211.h +104 -3
- package/libc/include/any-linux-any/linux/pci.h +7 -0
- package/libc/include/any-linux-any/linux/pci_regs.h +65 -6
- package/libc/include/any-linux-any/linux/pcitest.h +1 -0
- package/libc/include/any-linux-any/linux/perf_event.h +24 -3
- package/libc/include/any-linux-any/linux/pkt_sched.h +1 -0
- package/libc/include/any-linux-any/linux/prctl.h +30 -0
- package/libc/include/any-linux-any/linux/rseq.h +62 -5
- package/libc/include/any-linux-any/linux/shm.h +0 -1
- package/libc/include/any-linux-any/linux/stddef.h +4 -0
- package/libc/include/any-linux-any/linux/sysctl.h +1 -2
- package/libc/include/any-linux-any/linux/taskstats.h +12 -1
- package/libc/include/any-linux-any/linux/tcp.h +23 -3
- package/libc/include/any-linux-any/linux/typelimits.h +8 -0
- package/libc/include/any-linux-any/linux/ublk_cmd.h +120 -1
- package/libc/include/any-linux-any/linux/v4l2-controls.h +63 -0
- package/libc/include/any-linux-any/linux/vbox_vmmdev_types.h +2 -2
- package/libc/include/any-linux-any/linux/vduse.h +80 -5
- package/libc/include/any-linux-any/linux/version.h +3 -3
- package/libc/include/any-linux-any/linux/vfio.h +4 -0
- package/libc/include/any-linux-any/linux/videodev2.h +3 -0
- package/libc/include/any-linux-any/linux/virtio_ring.h +1 -2
- package/libc/include/any-linux-any/linux/vmclock-abi.h +20 -0
- package/libc/include/any-linux-any/rdma/bnxt_re-abi.h +16 -0
- package/libc/include/any-linux-any/rdma/ib_user_ioctl_cmds.h +16 -0
- package/libc/include/any-linux-any/rdma/mana-abi.h +3 -0
- package/libc/include/any-linux-any/scsi/scsi_bsg_ufs.h +8 -9
- package/libc/include/any-linux-any/sound/sof/tokens.h +6 -0
- package/libc/include/arc-linux-any/asm/swab.h +0 -63
- package/libc/include/arc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/arm-linux-any/asm/ptrace.h +0 -9
- package/libc/include/arm-linux-any/asm/unistd-eabi.h +1 -0
- package/libc/include/arm-linux-any/asm/unistd-oabi.h +1 -0
- package/libc/include/csky-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/hexagon-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/loongarch-linux-any/asm/hwcap.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm_para.h +1 -0
- package/libc/include/loongarch-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/loongarch-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/m68k-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/mips-linux-any/asm/errno.h +2 -0
- package/libc/include/mips-linux-any/asm/unistd_n32.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_n64.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_o32.h +1 -0
- package/libc/include/powerpc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/powerpc-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/riscv-linux-any/asm/hwprobe.h +4 -0
- package/libc/include/riscv-linux-any/asm/kvm.h +3 -0
- package/libc/include/riscv-linux-any/asm/ptrace.h +37 -0
- package/libc/include/riscv-linux-any/asm/sigcontext.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/s390x-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/sparc-linux-any/asm/errno.h +2 -0
- package/libc/include/sparc-linux-any/asm/ioctls.h +4 -4
- package/libc/include/sparc-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/sparc-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/x86-linux-any/asm/auxvec.h +0 -4
- package/libc/include/x86-linux-any/asm/kvm.h +13 -8
- package/libc/include/x86-linux-any/asm/svm.h +16 -16
- package/libc/include/x86-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_x32.h +1 -0
- package/libc/include/xtensa-linux-any/asm/unistd_32.h +1 -0
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/package.json +1 -1
- package/std/Build/Cache.zig +6 -6
- package/std/Build/Step/Compile.zig +0 -1
- package/std/Build/Step/Run.zig +2 -2
- package/std/Build/Step.zig +2 -4
- package/std/Build/WebServer.zig +2 -2
- package/std/Build.zig +0 -3
- package/std/Io/Dir.zig +7 -2
- package/std/Io/Dispatch.zig +3 -13
- package/std/Io/File/Writer.zig +8 -6
- 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 +171 -37
- package/std/Io/Uring.zig +13 -15
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +90 -26
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target.zig +50 -5
- package/std/array_hash_map.zig +9 -18
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +89 -7
- package/std/compress/flate/Decompress.zig +2 -3
- package/std/compress/zstd/Decompress.zig +2 -4
- 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/base64_hex_ct.zig +2 -4
- 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/Pdb.zig +1 -1
- package/std/debug.zig +4 -3
- package/std/fmt.zig +8 -3
- package/std/fs/path.zig +6 -4
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +21 -24
- package/std/http.zig +3 -4
- package/std/json/Scanner.zig +2 -2
- package/std/os/emscripten.zig +1 -1
- 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/syscalls.zig +26 -1
- 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 +412 -436
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os.zig +41 -0
- package/std/process.zig +1 -1
- package/std/sort.zig +3 -3
- package/std/zig/Ast/Render.zig +3 -3
- package/std/zig/AstGen.zig +44 -98
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/LibCInstallation.zig +4 -3
- package/std/zig/Parse.zig +7 -7
- package/std/zig/WindowsSdk.zig +13 -13
- package/std/zig/Zir.zig +50 -63
- package/std/zig/ZonGen.zig +6 -5
- package/std/zig/llvm/Builder.zig +12 -12
- package/std/zig.zig +1 -10
- package/std/zip.zig +5 -5
- package/zig.h +340 -1
- package/libc/include/hexagon-linux-any/asm/signal.h +0 -29
- package/libc/include/s390x-linux-any/asm/tape390.h +0 -103
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- 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/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
package/c/unistd.zig
CHANGED
|
@@ -21,6 +21,8 @@ comptime {
|
|
|
21
21
|
symbol(&chrootLinux, "chroot");
|
|
22
22
|
symbol(&ctermidLinux, "ctermid");
|
|
23
23
|
symbol(&dupLinux, "dup");
|
|
24
|
+
symbol(&dup2Linux, "dup2");
|
|
25
|
+
symbol(&dup3Linux, "dup3");
|
|
24
26
|
|
|
25
27
|
symbol(&getegidLinux, "getegid");
|
|
26
28
|
symbol(&geteuidLinux, "geteuid");
|
|
@@ -101,6 +103,31 @@ fn dupLinux(fd: c_int) callconv(.c) c_int {
|
|
|
101
103
|
return errno(linux.dup(fd));
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
fn dup2Linux(old: c_int, new: c_int) callconv(.c) c_int {
|
|
107
|
+
const busy: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.BUSY)));
|
|
108
|
+
var res = busy;
|
|
109
|
+
while (res == busy) res = linux.dup2(old, new);
|
|
110
|
+
return errno(res);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
fn dup3Linux(old: c_int, new: c_int, flags: c_int) callconv(.c) c_int {
|
|
114
|
+
const busy: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.BUSY)));
|
|
115
|
+
var res = busy;
|
|
116
|
+
|
|
117
|
+
if (@hasField(linux.SYS, "dup3")) {
|
|
118
|
+
while (res == busy) res = linux.dup3(old, new, @intCast(flags));
|
|
119
|
+
} else if (@hasField(linux.SYS, "dup2")) {
|
|
120
|
+
const cloexec: c_int = @bitCast(linux.O{ .CLOEXEC = true });
|
|
121
|
+
const inval: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.INVAL)));
|
|
122
|
+
if (old == new or (flags & ~cloexec != 0)) return errno(inval);
|
|
123
|
+
while (res == busy) res = linux.dup2(old, new);
|
|
124
|
+
_ = if (res >= 0 and (flags & cloexec == cloexec)) linux.fcntl(new, linux.F.SETFD, linux.FD_CLOEXEC);
|
|
125
|
+
} else {
|
|
126
|
+
return errno(@bitCast(-@as(isize, @intFromEnum(linux.E.NOSYS))));
|
|
127
|
+
}
|
|
128
|
+
return errno(res);
|
|
129
|
+
}
|
|
130
|
+
|
|
104
131
|
fn getegidLinux() callconv(.c) linux.gid_t {
|
|
105
132
|
return linux.getegid();
|
|
106
133
|
}
|
|
@@ -206,32 +233,6 @@ fn swab(noalias src_ptr: *const anyopaque, noalias dest_ptr: *anyopaque, n: isiz
|
|
|
206
233
|
}
|
|
207
234
|
}
|
|
208
235
|
|
|
209
|
-
test swab {
|
|
210
|
-
var a: [4]u8 = undefined;
|
|
211
|
-
@memset(a[0..], '\x00');
|
|
212
|
-
swab("abcd", &a, 4);
|
|
213
|
-
try std.testing.expectEqualSlices(u8, "badc", &a);
|
|
214
|
-
|
|
215
|
-
// Partial copy
|
|
216
|
-
@memset(a[0..], '\x00');
|
|
217
|
-
swab("abcd", &a, 2);
|
|
218
|
-
try std.testing.expectEqualSlices(u8, "ba\x00\x00", &a);
|
|
219
|
-
|
|
220
|
-
// n < 1
|
|
221
|
-
@memset(a[0..], '\x00');
|
|
222
|
-
swab("abcd", &a, 0);
|
|
223
|
-
try std.testing.expectEqualSlices(u8, "\x00" ** 4, &a);
|
|
224
|
-
swab("abcd", &a, -1);
|
|
225
|
-
try std.testing.expectEqualSlices(u8, "\x00" ** 4, &a);
|
|
226
|
-
|
|
227
|
-
// Odd n
|
|
228
|
-
@memset(a[0..], '\x00');
|
|
229
|
-
swab("abcd", &a, 1);
|
|
230
|
-
try std.testing.expectEqualSlices(u8, "\x00" ** 4, &a);
|
|
231
|
-
swab("abcd", &a, 3);
|
|
232
|
-
try std.testing.expectEqualSlices(u8, "ba\x00\x00", &a);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
236
|
fn close(fd: std.c.fd_t) callconv(.c) c_int {
|
|
236
237
|
const signed: isize = @bitCast(linux.close(fd));
|
|
237
238
|
if (signed < 0) {
|
package/c/wchar.zig
CHANGED
|
@@ -5,6 +5,7 @@ const wint_t = std.c.wint_t;
|
|
|
5
5
|
const wchar_t = std.c.wchar_t;
|
|
6
6
|
|
|
7
7
|
const symbol = @import("../c.zig").symbol;
|
|
8
|
+
const c = std.c;
|
|
8
9
|
|
|
9
10
|
comptime {
|
|
10
11
|
if (builtin.target.isMuslLibC() or builtin.target.isWasiLibC()) {
|
|
@@ -30,6 +31,7 @@ comptime {
|
|
|
30
31
|
symbol(&wcspbrk, "wcspbrk");
|
|
31
32
|
symbol(&wcstok, "wcstok");
|
|
32
33
|
symbol(&wcsstr, "wcsstr");
|
|
34
|
+
symbol(&wcsdup, "wcsdup");
|
|
33
35
|
symbol(&wcswcs, "wcswcs");
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -189,3 +191,11 @@ fn wcsstr(noalias haystack: [*:0]const wchar_t, noalias needle: [*:0]const wchar
|
|
|
189
191
|
fn wcswcs(noalias haystack: [*:0]const wchar_t, noalias needle: [*:0]const wchar_t) callconv(.c) ?[*:0]wchar_t {
|
|
190
192
|
return wcsstr(haystack, needle);
|
|
191
193
|
}
|
|
194
|
+
|
|
195
|
+
fn wcsdup(str: [*:0]const wchar_t) callconv(.c) ?[*:0]wchar_t {
|
|
196
|
+
const len = wcslen(str);
|
|
197
|
+
const size = (len + 1) * @sizeOf(wchar_t);
|
|
198
|
+
const d_opaque = c.malloc(size) orelse return null;
|
|
199
|
+
const d: [*]wchar_t = @ptrCast(@alignCast(d_opaque));
|
|
200
|
+
return @ptrCast(wmemcpy(d, str, len + 1));
|
|
201
|
+
}
|
package/c.zig
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
//! bundled libcs.
|
|
3
3
|
//!
|
|
4
4
|
//! mingw-w64 libc is not fully statically linked, so some symbols don't need
|
|
5
|
-
//! to be exported.
|
|
6
|
-
//! dependency on msvcrt dll even when linking libc and targeting Windows.
|
|
5
|
+
//! to be exported.
|
|
7
6
|
|
|
8
7
|
const builtin = @import("builtin");
|
|
9
8
|
const std = @import("std");
|
|
@@ -69,6 +68,7 @@ comptime {
|
|
|
69
68
|
_ = @import("c/malloc.zig");
|
|
70
69
|
}
|
|
71
70
|
_ = @import("c/math.zig");
|
|
71
|
+
_ = @import("c/pthread.zig");
|
|
72
72
|
_ = @import("c/search.zig");
|
|
73
73
|
_ = @import("c/stdlib.zig");
|
|
74
74
|
_ = @import("c/string.zig");
|
|
@@ -54,8 +54,9 @@ return_label: Ir.Ref = undefined,
|
|
|
54
54
|
compound_assign_dummy: ?Ir.Ref = null,
|
|
55
55
|
|
|
56
56
|
fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } {
|
|
57
|
-
var
|
|
58
|
-
|
|
57
|
+
var bfa_buf: [u8]1024 = undefined;
|
|
58
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, c.comp.gpa);
|
|
59
|
+
const allocator = bfa.allocator();
|
|
59
60
|
var buf: std.ArrayList(u8) = .empty;
|
|
60
61
|
defer buf.deinit(allocator);
|
|
61
62
|
|
|
@@ -101,14 +102,12 @@ pub fn genIr(tree: *const Tree) Compilation.Error!Ir {
|
|
|
101
102
|
.function => |function| {
|
|
102
103
|
if (function.body == null) continue;
|
|
103
104
|
c.genFn(function) catch |err| switch (err) {
|
|
104
|
-
error.FatalError => return
|
|
105
|
-
error.OutOfMemory => return error.OutOfMemory,
|
|
105
|
+
error.FatalError, error.OutOfMemory => |e| return e,
|
|
106
106
|
};
|
|
107
107
|
},
|
|
108
108
|
|
|
109
109
|
.variable => |variable| c.genVar(variable) catch |err| switch (err) {
|
|
110
|
-
error.FatalError => return
|
|
111
|
-
error.OutOfMemory => return error.OutOfMemory,
|
|
110
|
+
error.FatalError, error.OutOfMemory => |e| return e,
|
|
112
111
|
},
|
|
113
112
|
.global_asm => {
|
|
114
113
|
return c.fail("TODO global assembly", .{});
|
|
@@ -1761,8 +1761,9 @@ fn addToSearchPath(comp: *Compilation, include: Include, verbose: bool) !void {
|
|
|
1761
1761
|
try comp.search_path.append(comp.gpa, include);
|
|
1762
1762
|
}
|
|
1763
1763
|
fn removeDuplicateSearchPaths(comp: *Compilation, start: usize, verbose: bool) !void {
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1764
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1765
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa);
|
|
1766
|
+
const allocator = bfa.allocator();
|
|
1766
1767
|
var seen_includes: std.StringHashMapUnmanaged(void) = .empty;
|
|
1767
1768
|
defer seen_includes.deinit(allocator);
|
|
1768
1769
|
var seen_frameworks: std.StringHashMapUnmanaged(void) = .empty;
|
|
@@ -1976,10 +1977,11 @@ const FindInclude = struct {
|
|
|
1976
1977
|
) Allocator.Error!?Result {
|
|
1977
1978
|
const comp = find.comp;
|
|
1978
1979
|
|
|
1979
|
-
var
|
|
1980
|
-
|
|
1981
|
-
const
|
|
1982
|
-
|
|
1980
|
+
var bfa_buf: [path_buf_stack_limit]u8 = undefined;
|
|
1981
|
+
var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa);
|
|
1982
|
+
const bfa = bfa_state.allocator();
|
|
1983
|
+
const header_path = try std.fmt.allocPrint(bfa, format, args);
|
|
1984
|
+
defer bfa.free(header_path);
|
|
1983
1985
|
find.comp.normalizePath(header_path);
|
|
1984
1986
|
|
|
1985
1987
|
const source = comp.addSourceFromPathExtra(header_path, kind) catch |err| switch (err) {
|
|
@@ -2068,36 +2070,37 @@ pub fn findEmbed(
|
|
|
2068
2070
|
}
|
|
2069
2071
|
}
|
|
2070
2072
|
|
|
2071
|
-
var
|
|
2072
|
-
|
|
2073
|
+
var bfa_buf: [path_buf_stack_limit]u8 = undefined;
|
|
2074
|
+
var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, comp.gpa);
|
|
2075
|
+
const bfa = bfa_state.allocator();
|
|
2073
2076
|
|
|
2074
2077
|
switch (include_type) {
|
|
2075
2078
|
.quotes, .cli => {
|
|
2076
2079
|
const dir = std.fs.path.dirname(comp.getSource(includer_token_source).path) orelse ".";
|
|
2077
|
-
const path = try std.fs.path.join(
|
|
2078
|
-
defer
|
|
2080
|
+
const path = try std.fs.path.join(bfa, &.{ dir, filename });
|
|
2081
|
+
defer bfa.free(path);
|
|
2079
2082
|
comp.normalizePath(path);
|
|
2080
2083
|
if (comp.getPathContents(path, limit)) |some| {
|
|
2081
2084
|
errdefer comp.gpa.free(some);
|
|
2082
2085
|
if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
|
|
2083
2086
|
return some;
|
|
2084
2087
|
} else |err| switch (err) {
|
|
2085
|
-
error.OutOfMemory => return
|
|
2088
|
+
error.OutOfMemory => |e| return e,
|
|
2086
2089
|
else => {},
|
|
2087
2090
|
}
|
|
2088
2091
|
},
|
|
2089
2092
|
.angle_brackets => {},
|
|
2090
2093
|
}
|
|
2091
2094
|
for (comp.embed_dirs.items) |embed_dir| {
|
|
2092
|
-
const path = try std.fs.path.join(
|
|
2093
|
-
defer
|
|
2095
|
+
const path = try std.fs.path.join(bfa, &.{ embed_dir, filename });
|
|
2096
|
+
defer bfa.free(path);
|
|
2094
2097
|
comp.normalizePath(path);
|
|
2095
2098
|
if (comp.getPathContents(path, limit)) |some| {
|
|
2096
2099
|
errdefer comp.gpa.free(some);
|
|
2097
2100
|
if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
|
|
2098
2101
|
return some;
|
|
2099
2102
|
} else |err| switch (err) {
|
|
2100
|
-
error.OutOfMemory => return
|
|
2103
|
+
error.OutOfMemory => |e| return e,
|
|
2101
2104
|
else => {},
|
|
2102
2105
|
}
|
|
2103
2106
|
}
|
|
@@ -947,8 +947,9 @@ fn addImacros(d: *Driver, path: []const u8) !void {
|
|
|
947
947
|
}
|
|
948
948
|
|
|
949
949
|
pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void {
|
|
950
|
-
var
|
|
951
|
-
var
|
|
950
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
951
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa);
|
|
952
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
952
953
|
defer allocating.deinit();
|
|
953
954
|
|
|
954
955
|
Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory;
|
|
@@ -956,8 +957,9 @@ pub fn err(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void {
|
|
|
956
957
|
}
|
|
957
958
|
|
|
958
959
|
pub fn warn(d: *Driver, fmt: []const u8, args: anytype) Compilation.Error!void {
|
|
959
|
-
var
|
|
960
|
-
var
|
|
960
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
961
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa);
|
|
962
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
961
963
|
defer allocating.deinit();
|
|
962
964
|
|
|
963
965
|
Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory;
|
|
@@ -1101,8 +1103,9 @@ fn parseTarget(d: *Driver, arch_os_abi: []const u8, opt_cpu_features: ?[]const u
|
|
|
1101
1103
|
}
|
|
1102
1104
|
|
|
1103
1105
|
pub fn fatal(d: *Driver, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } {
|
|
1104
|
-
var
|
|
1105
|
-
var
|
|
1106
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1107
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, d.comp.gpa);
|
|
1108
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
1106
1109
|
defer allocating.deinit();
|
|
1107
1110
|
|
|
1108
1111
|
Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory;
|
|
@@ -1179,8 +1182,7 @@ pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_
|
|
|
1179
1182
|
var stdout = std.Io.File.stdout().writer(d.comp.io, &stdout_buf);
|
|
1180
1183
|
if (parseArgs(d, &stdout.interface, ¯o_buf, args) catch |er| switch (er) {
|
|
1181
1184
|
error.WriteFailed => return d.fatal("failed to write to stdout: {s}", .{errorDescription(er)}),
|
|
1182
|
-
error.OutOfMemory => return
|
|
1183
|
-
error.FatalError => return error.FatalError,
|
|
1185
|
+
error.OutOfMemory, error.FatalError => |e| return e,
|
|
1184
1186
|
}) return;
|
|
1185
1187
|
if (macro_buf.items.len > std.math.maxInt(u32)) {
|
|
1186
1188
|
return d.fatal("user provided macro source exceeded max size", .{});
|
|
@@ -1204,12 +1206,11 @@ pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_
|
|
|
1204
1206
|
};
|
|
1205
1207
|
|
|
1206
1208
|
tc.discover() catch |er| switch (er) {
|
|
1207
|
-
error.OutOfMemory => return
|
|
1209
|
+
error.OutOfMemory => |e| return e,
|
|
1208
1210
|
error.TooManyMultilibs => return d.fatal("found more than one multilib with the same priority", .{}),
|
|
1209
1211
|
};
|
|
1210
1212
|
tc.defineSystemIncludes() catch |er| switch (er) {
|
|
1211
|
-
error.OutOfMemory => return
|
|
1212
|
-
error.FatalError => return error.FatalError,
|
|
1213
|
+
error.OutOfMemory, error.FatalError => |e| return e,
|
|
1213
1214
|
};
|
|
1214
1215
|
try d.comp.initSearchPath(d.includes.items, d.verbose_search_path);
|
|
1215
1216
|
|
|
@@ -1522,8 +1523,8 @@ fn processSource(
|
|
|
1522
1523
|
render_errors.deinit(gpa);
|
|
1523
1524
|
}
|
|
1524
1525
|
|
|
1525
|
-
var obj = ir.render(gpa, d.comp.target.toZigTarget(), &render_errors) catch |
|
|
1526
|
-
error.OutOfMemory => return
|
|
1526
|
+
var obj = ir.render(gpa, d.comp.target.toZigTarget(), &render_errors) catch |er| switch (er) {
|
|
1527
|
+
error.OutOfMemory => |e| return e,
|
|
1527
1528
|
error.LowerFail => {
|
|
1528
1529
|
return d.fatal(
|
|
1529
1530
|
"unable to render Ir to machine code: {s}",
|
|
@@ -215,8 +215,9 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca
|
|
|
215
215
|
assert(codepoint >= 0x80);
|
|
216
216
|
|
|
217
217
|
const prev_total = p.diagnostics.total;
|
|
218
|
-
var
|
|
219
|
-
var
|
|
218
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
219
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa);
|
|
220
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
220
221
|
defer allocating.deinit();
|
|
221
222
|
|
|
222
223
|
if (!char_info.isC99IdChar(codepoint)) {
|
|
@@ -429,8 +430,9 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype)
|
|
|
429
430
|
if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return;
|
|
430
431
|
if (p.diagnostics.effectiveKind(diagnostic) == .off) return;
|
|
431
432
|
|
|
432
|
-
var
|
|
433
|
-
var
|
|
433
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
434
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa);
|
|
435
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
434
436
|
defer allocating.deinit();
|
|
435
437
|
|
|
436
438
|
p.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory;
|
|
@@ -1537,8 +1539,9 @@ fn staticAssert(p: *Parser) Error!bool {
|
|
|
1537
1539
|
}
|
|
1538
1540
|
} else {
|
|
1539
1541
|
if (!res.val.toBool(p.comp)) {
|
|
1540
|
-
var
|
|
1541
|
-
var
|
|
1542
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1543
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa);
|
|
1544
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
1542
1545
|
defer allocating.deinit();
|
|
1543
1546
|
|
|
1544
1547
|
if (p.staticAssertMessage(res_node, str, &allocating) catch return error.OutOfMemory) |message| {
|
|
@@ -4837,8 +4840,9 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
|
|
|
4837
4840
|
const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names
|
|
4838
4841
|
const bytes_needed = expected_items * @sizeOf(Tree.Node.AsmStmt.Operand) + expected_items * 2 * @sizeOf(Node.Index);
|
|
4839
4842
|
|
|
4840
|
-
var
|
|
4841
|
-
|
|
4843
|
+
var bfa_buf: [bytes_needed]u8 = undefined;
|
|
4844
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa);
|
|
4845
|
+
const allocator = bfa.allocator();
|
|
4842
4846
|
|
|
4843
4847
|
var operands: std.ArrayList(Tree.Node.AsmStmt.Operand) = .empty;
|
|
4844
4848
|
defer operands.deinit(allocator);
|
|
@@ -5721,9 +5725,8 @@ fn returnStmt(p: *Parser) Error!?Node.Index {
|
|
|
5721
5725
|
// ====== expressions ======
|
|
5722
5726
|
|
|
5723
5727
|
pub fn macroExpr(p: *Parser) Compilation.Error!bool {
|
|
5724
|
-
const res = p.expect(condExpr) catch |
|
|
5725
|
-
error.OutOfMemory => return
|
|
5726
|
-
error.FatalError => return error.FatalError,
|
|
5728
|
+
const res = p.expect(condExpr) catch |er| switch (er) {
|
|
5729
|
+
error.OutOfMemory, error.FatalError => |e| return e,
|
|
5727
5730
|
error.ParsingFailed => return false,
|
|
5728
5731
|
};
|
|
5729
5732
|
return res.val.toBool(p.comp);
|
|
@@ -9922,8 +9925,9 @@ fn primaryExpr(p: *Parser) Error!?Result {
|
|
|
9922
9925
|
if (p.func.pretty_ident) |some| {
|
|
9923
9926
|
qt = some.qt;
|
|
9924
9927
|
} else if (p.func.qt) |func_qt| {
|
|
9925
|
-
var
|
|
9926
|
-
var
|
|
9928
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
9929
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa);
|
|
9930
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
9927
9931
|
defer allocating.deinit();
|
|
9928
9932
|
|
|
9929
9933
|
func_qt.printNamed(p.tokSlice(p.func.name), p.comp, &allocating.writer) catch return error.OutOfMemory;
|
|
@@ -10212,8 +10216,9 @@ fn charLiteral(p: *Parser) Error!?Result {
|
|
|
10212
10216
|
};
|
|
10213
10217
|
|
|
10214
10218
|
const max_chars_expected = 4;
|
|
10215
|
-
var
|
|
10216
|
-
|
|
10219
|
+
var bfa_buf: [max_chars_expected]u32 = undefined;
|
|
10220
|
+
var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&bfa_buf), gpa);
|
|
10221
|
+
const allocator = bfa.allocator();
|
|
10217
10222
|
var chars: std.ArrayList(u32) = .empty;
|
|
10218
10223
|
defer chars.deinit(allocator);
|
|
10219
10224
|
|
|
@@ -212,8 +212,9 @@ pub const Diagnostic = struct {
|
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
pub fn err(pp: *Preprocessor, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) Compilation.Error!void {
|
|
215
|
-
var
|
|
216
|
-
var
|
|
215
|
+
var buf: [1024]u8 = undefined;
|
|
216
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&buf, pp.comp.gpa);
|
|
217
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
217
218
|
defer allocating.deinit();
|
|
218
219
|
|
|
219
220
|
Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory;
|
|
@@ -1023,8 +1023,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C
|
|
|
1023
1023
|
defer pp.diagnostics.state.suppress_system_headers = old_suppress_system;
|
|
1024
1024
|
if (diagnostic.show_in_system_headers) pp.diagnostics.state.suppress_system_headers = false;
|
|
1025
1025
|
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1026
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1027
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa);
|
|
1028
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
1028
1029
|
defer allocating.deinit();
|
|
1029
1030
|
|
|
1030
1031
|
Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory;
|
|
@@ -1052,8 +1053,9 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C
|
|
|
1052
1053
|
}
|
|
1053
1054
|
|
|
1054
1055
|
fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error {
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1056
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1057
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa);
|
|
1058
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
1057
1059
|
defer allocating.deinit();
|
|
1058
1060
|
|
|
1059
1061
|
Diagnostics.formatArgs(&allocating.writer, fmt, args) catch return error.OutOfMemory;
|
|
@@ -1074,8 +1076,9 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con
|
|
|
1074
1076
|
pp.diagnostics.state.fatal_errors = true;
|
|
1075
1077
|
defer pp.diagnostics.state.fatal_errors = old;
|
|
1076
1078
|
|
|
1077
|
-
var
|
|
1078
|
-
|
|
1079
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
1080
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa);
|
|
1081
|
+
const allocator = bfa.allocator();
|
|
1079
1082
|
var buf: std.ArrayList(u8) = .empty;
|
|
1080
1083
|
defer buf.deinit(allocator);
|
|
1081
1084
|
|
|
@@ -44,8 +44,9 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra
|
|
|
44
44
|
|
|
45
45
|
const diagnostic: Pragma.Diagnostic = .pragma_message;
|
|
46
46
|
|
|
47
|
-
var
|
|
48
|
-
var
|
|
47
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
48
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, pp.comp.gpa);
|
|
49
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
49
50
|
defer allocating.deinit();
|
|
50
51
|
|
|
51
52
|
Diagnostics.formatArgs(&allocating.writer, diagnostic.fmt, .{str}) catch return error.OutOfMemory;
|
|
@@ -315,8 +315,9 @@ pub const Parser = struct {
|
|
|
315
315
|
if (p.errored) return;
|
|
316
316
|
if (p.comp.diagnostics.effectiveKind(diagnostic) == .off) return;
|
|
317
317
|
|
|
318
|
-
var
|
|
319
|
-
var
|
|
318
|
+
var bfa_buf: [1024]u8 = undefined;
|
|
319
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, p.comp.gpa);
|
|
320
|
+
var allocating: std.Io.Writer.Allocating = .init(bfa.allocator());
|
|
320
321
|
defer allocating.deinit();
|
|
321
322
|
|
|
322
323
|
formatArgs(&allocating.writer, diagnostic.fmt, args) catch return error.OutOfMemory;
|
|
@@ -68,8 +68,9 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void {
|
|
|
68
68
|
pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error {
|
|
69
69
|
const loc: Source.Location = c.tree.tokens.items(.loc)[tok];
|
|
70
70
|
|
|
71
|
-
var
|
|
72
|
-
|
|
71
|
+
var bfa_buf: [u8]1024 = undefined;
|
|
72
|
+
var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, c.comp.gpa);
|
|
73
|
+
const allocator = bfa.allocator();
|
|
73
74
|
var buf: std.ArrayList(u8) = .empty;
|
|
74
75
|
defer buf.deinit(allocator);
|
|
75
76
|
|
|
@@ -149,8 +150,7 @@ pub fn genAsm(tree: *const Tree) Error!Assembly {
|
|
|
149
150
|
|
|
150
151
|
codegen.genDecls() catch |err| switch (err) {
|
|
151
152
|
error.WriteFailed => return error.OutOfMemory,
|
|
152
|
-
error.OutOfMemory => return
|
|
153
|
-
error.FatalError => return error.FatalError,
|
|
153
|
+
error.OutOfMemory, error.FatalError => |e| return e,
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const text_slice = try text.toOwnedSlice();
|
|
@@ -333,8 +333,6 @@ pub fn main(init: process.Init.Minimal) !void {
|
|
|
333
333
|
builder.verbose_llvm_ir = arg["--verbose-llvm-ir=".len..];
|
|
334
334
|
} else if (mem.startsWith(u8, arg, "--verbose-llvm-bc=")) {
|
|
335
335
|
builder.verbose_llvm_bc = arg["--verbose-llvm-bc=".len..];
|
|
336
|
-
} else if (mem.eql(u8, arg, "--verbose-cimport")) {
|
|
337
|
-
builder.verbose_cimport = true;
|
|
338
336
|
} else if (mem.eql(u8, arg, "--verbose-cc")) {
|
|
339
337
|
builder.verbose_cc = true;
|
|
340
338
|
} else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) {
|
package/compiler/reduce/Walk.zig
CHANGED
|
@@ -6,9 +6,9 @@ const BuiltinFn = std.zig.BuiltinFn;
|
|
|
6
6
|
|
|
7
7
|
ast: *const Ast,
|
|
8
8
|
transformations: *std.array_list.Managed(Transformation),
|
|
9
|
-
unreferenced_globals: std.
|
|
10
|
-
in_scope_names: std.
|
|
11
|
-
replace_names: std.
|
|
9
|
+
unreferenced_globals: std.array_hash_map.String(Ast.Node.Index),
|
|
10
|
+
in_scope_names: std.array_hash_map.String(u32),
|
|
11
|
+
replace_names: std.array_hash_map.String(u32),
|
|
12
12
|
gpa: std.mem.Allocator,
|
|
13
13
|
arena: std.mem.Allocator,
|
|
14
14
|
|
|
@@ -63,9 +63,9 @@ pub fn findTransformations(
|
|
|
63
63
|
.transformations = transformations,
|
|
64
64
|
.gpa = transformations.allocator,
|
|
65
65
|
.arena = arena,
|
|
66
|
-
.unreferenced_globals = .
|
|
67
|
-
.in_scope_names = .
|
|
68
|
-
.replace_names = .
|
|
66
|
+
.unreferenced_globals = .empty,
|
|
67
|
+
.in_scope_names = .empty,
|
|
68
|
+
.replace_names = .empty,
|
|
69
69
|
};
|
|
70
70
|
defer {
|
|
71
71
|
walk.unreferenced_globals.deinit(walk.gpa);
|
|
@@ -607,7 +607,7 @@ fn walkBlock(
|
|
|
607
607
|
{
|
|
608
608
|
try w.transformations.append(.{ .delete_var_decl = .{
|
|
609
609
|
.var_decl_node = stmt,
|
|
610
|
-
.references = .
|
|
610
|
+
.references = .empty,
|
|
611
611
|
} });
|
|
612
612
|
const name_tok = var_decl.ast.mut_token + 1;
|
|
613
613
|
const name_bytes = ast.tokenSlice(name_tok);
|
package/compiler/test_runner.zig
CHANGED
|
@@ -488,7 +488,7 @@ var fuzz_runner: if (builtin.fuzz) struct {
|
|
|
488
488
|
fn inputPoller() Io.Cancelable!void {
|
|
489
489
|
@disableInstrumentation();
|
|
490
490
|
switch (inputPollerInner()) {
|
|
491
|
-
error.Canceled => return
|
|
491
|
+
error.Canceled => |e| return e,
|
|
492
492
|
error.ReadFailed => {
|
|
493
493
|
if (stdin_reader.err.? == error.Canceled) return error.Canceled;
|
|
494
494
|
panic("failed to read from stdin: {t}", .{stdin_reader.err.?});
|
|
@@ -563,7 +563,7 @@ pub fn fuzz(
|
|
|
563
563
|
const stderr = std.debug.lockStderr(&.{}).terminal();
|
|
564
564
|
p: {
|
|
565
565
|
if (@errorReturnTrace()) |trace| {
|
|
566
|
-
std.debug.
|
|
566
|
+
std.debug.writeErrorReturnTrace(trace, stderr) catch break :p;
|
|
567
567
|
}
|
|
568
568
|
stderr.writer.print("failed with error.{t}\n", .{err}) catch break :p;
|
|
569
569
|
}
|
|
@@ -475,8 +475,12 @@ pub const builtin_typedef_map = std.StaticStringMap([]const u8).initComptime(.{
|
|
|
475
475
|
.{ "int8_t", "i8" },
|
|
476
476
|
.{ "uint16_t", "u16" },
|
|
477
477
|
.{ "int16_t", "i16" },
|
|
478
|
+
.{ "uint24_t", "u24" },
|
|
479
|
+
.{ "int24_t", "i24" },
|
|
478
480
|
.{ "uint32_t", "u32" },
|
|
479
481
|
.{ "int32_t", "i32" },
|
|
482
|
+
.{ "uint48_t", "u48" },
|
|
483
|
+
.{ "int48_t", "i48" },
|
|
480
484
|
.{ "uint64_t", "u64" },
|
|
481
485
|
.{ "int64_t", "i64" },
|
|
482
486
|
.{ "intptr_t", "isize" },
|
|
@@ -1293,7 +1297,7 @@ fn transType(t: *Translator, scope: *Scope, qt: QualType, source_loc: TokenIndex
|
|
|
1293
1297
|
error.SelfReferential => {},
|
|
1294
1298
|
error.UnsupportedTranslation => {},
|
|
1295
1299
|
error.UnsupportedType => {},
|
|
1296
|
-
error.OutOfMemory => return
|
|
1300
|
+
error.OutOfMemory => |e| return e,
|
|
1297
1301
|
}
|
|
1298
1302
|
}
|
|
1299
1303
|
continue :loop typeof_ty.base.type(t.comp);
|
|
@@ -4095,7 +4099,7 @@ fn createIntNode(t: *Translator, int: aro.Value) !ZigNode {
|
|
|
4095
4099
|
big.positive = true;
|
|
4096
4100
|
|
|
4097
4101
|
const str = big.toStringAlloc(t.arena, 10, .lower) catch |err| switch (err) {
|
|
4098
|
-
error.OutOfMemory => return
|
|
4102
|
+
error.OutOfMemory => |e| return e,
|
|
4099
4103
|
};
|
|
4100
4104
|
const res = try ZigTag.integer_literal.create(t.arena, str);
|
|
4101
4105
|
if (is_negative) return ZigTag.negate.create(t.arena, res);
|
|
@@ -225,7 +225,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: []const [:0]const u8, zig
|
|
|
225
225
|
const source = d.inputs.items[0];
|
|
226
226
|
|
|
227
227
|
tc.discover() catch |er| switch (er) {
|
|
228
|
-
error.OutOfMemory => return
|
|
228
|
+
error.OutOfMemory => |e| return e,
|
|
229
229
|
error.TooManyMultilibs => return d.fatal("found more than one multilib with the same priority", .{}),
|
|
230
230
|
};
|
|
231
231
|
try tc.defineSystemIncludes();
|
package/compiler_rt/cos.zig
CHANGED
|
@@ -173,8 +173,6 @@ pub fn cosq(x: f128) callconv(.c) f128 {
|
|
|
173
173
|
|
|
174
174
|
pub fn cosl(x: c_longdouble) callconv(.c) c_longdouble {
|
|
175
175
|
switch (@typeInfo(c_longdouble).float.bits) {
|
|
176
|
-
16 => return cosh(x),
|
|
177
|
-
32 => return cosf(x),
|
|
178
176
|
64 => return cos(x),
|
|
179
177
|
80 => return cosx(x),
|
|
180
178
|
128 => return cosq(x),
|