@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.
Files changed (268) hide show
  1. package/c/fcntl.zig +6 -1
  2. package/c/inttypes.zig +0 -10
  3. package/c/math.zig +46 -122
  4. package/c/pthread.zig +57 -0
  5. package/c/search.zig +1 -27
  6. package/c/stdlib/drand48.zig +0 -57
  7. package/c/stdlib.zig +0 -100
  8. package/c/string.zig +20 -7
  9. package/c/strings.zig +0 -38
  10. package/c/unistd.zig +27 -26
  11. package/c/wchar.zig +10 -0
  12. package/c.zig +2 -2
  13. package/compiler/aro/aro/CodeGen.zig +5 -6
  14. package/compiler/aro/aro/Compilation.zig +17 -14
  15. package/compiler/aro/aro/Driver.zig +14 -13
  16. package/compiler/aro/aro/Parser.zig +20 -15
  17. package/compiler/aro/aro/Pragma.zig +3 -2
  18. package/compiler/aro/aro/Preprocessor.zig +9 -6
  19. package/compiler/aro/aro/pragmas/message.zig +3 -2
  20. package/compiler/aro/aro/text_literal.zig +3 -2
  21. package/compiler/aro/assembly_backend/x86_64.zig +4 -4
  22. package/compiler/build_runner.zig +0 -2
  23. package/compiler/reduce/Walk.zig +7 -7
  24. package/compiler/test_runner.zig +2 -2
  25. package/compiler/translate-c/Translator.zig +6 -2
  26. package/compiler/translate-c/main.zig +1 -1
  27. package/compiler_rt/cos.zig +0 -2
  28. package/compiler_rt/divmodei4.zig +40 -17
  29. package/compiler_rt/exp.zig +1 -6
  30. package/compiler_rt/exp2.zig +1 -6
  31. package/compiler_rt/exp_f128.zig +377 -0
  32. package/compiler_rt/fabs.zig +0 -2
  33. package/compiler_rt/fma.zig +0 -2
  34. package/compiler_rt/fmax.zig +0 -2
  35. package/compiler_rt/fmin.zig +0 -2
  36. package/compiler_rt/fmod.zig +0 -2
  37. package/compiler_rt/limb64.zig +876 -15
  38. package/compiler_rt/log.zig +0 -2
  39. package/compiler_rt/log10.zig +0 -2
  40. package/compiler_rt/log2.zig +0 -2
  41. package/compiler_rt/mulXi3.zig +1 -1
  42. package/compiler_rt/round.zig +0 -2
  43. package/compiler_rt/sin.zig +0 -2
  44. package/compiler_rt/sincos.zig +0 -2
  45. package/compiler_rt/sqrt.zig +0 -2
  46. package/compiler_rt/ssp.zig +1 -1
  47. package/compiler_rt/tan.zig +0 -2
  48. package/compiler_rt/trunc.zig +0 -2
  49. package/compiler_rt/udivmodei4.zig +28 -0
  50. package/fuzzer.zig +2 -0
  51. package/libc/include/aarch64-linux-any/asm/hwcap.h +1 -0
  52. package/libc/include/aarch64-linux-any/asm/unistd_64.h +1 -0
  53. package/libc/include/any-linux-any/asm-generic/errno.h +2 -0
  54. package/libc/include/any-linux-any/asm-generic/unistd.h +4 -1
  55. package/libc/include/any-linux-any/drm/amdgpu_drm.h +20 -6
  56. package/libc/include/any-linux-any/drm/amdxdna_accel.h +8 -0
  57. package/libc/include/any-linux-any/drm/drm_fourcc.h +6 -6
  58. package/libc/include/any-linux-any/drm/panfrost_drm.h +75 -1
  59. package/libc/include/any-linux-any/drm/panthor_drm.h +154 -3
  60. package/libc/include/any-linux-any/drm/rocket_accel.h +74 -24
  61. package/libc/include/any-linux-any/drm/xe_drm.h +89 -6
  62. package/libc/include/any-linux-any/linux/android/binder.h +1 -1
  63. package/libc/include/any-linux-any/linux/bpf.h +28 -0
  64. package/libc/include/any-linux-any/linux/btrfs.h +1 -0
  65. package/libc/include/any-linux-any/linux/btrfs_tree.h +32 -2
  66. package/libc/include/any-linux-any/linux/dma-buf.h +1 -0
  67. package/libc/include/any-linux-any/linux/dpll.h +1 -0
  68. package/libc/include/any-linux-any/linux/elf.h +2 -0
  69. package/libc/include/any-linux-any/linux/ethtool.h +21 -5
  70. package/libc/include/any-linux-any/linux/fs.h +1 -0
  71. package/libc/include/any-linux-any/linux/hyperv.h +1 -1
  72. package/libc/include/any-linux-any/linux/idxd.h +134 -134
  73. package/libc/include/any-linux-any/linux/if_alg.h +1 -1
  74. package/libc/include/any-linux-any/linux/if_link.h +1 -0
  75. package/libc/include/any-linux-any/linux/input-event-codes.h +4 -0
  76. package/libc/include/any-linux-any/linux/io_uring/bpf_filter.h +68 -0
  77. package/libc/include/any-linux-any/linux/io_uring/query.h +5 -1
  78. package/libc/include/any-linux-any/linux/io_uring.h +33 -2
  79. package/libc/include/any-linux-any/linux/iommufd.h +39 -0
  80. package/libc/include/any-linux-any/linux/kfd_ioctl.h +13 -3
  81. package/libc/include/any-linux-any/linux/kfd_sysfs.h +2 -1
  82. package/libc/include/any-linux-any/linux/kvm.h +30 -6
  83. package/libc/include/any-linux-any/linux/landlock.h +22 -8
  84. package/libc/include/any-linux-any/linux/magic.h +1 -0
  85. package/libc/include/any-linux-any/linux/mempolicy.h +3 -0
  86. package/libc/include/any-linux-any/linux/mount.h +11 -2
  87. package/libc/include/any-linux-any/linux/mptcp_pm.h +1 -1
  88. package/libc/include/any-linux-any/linux/mshv.h +2 -0
  89. package/libc/include/any-linux-any/linux/netfilter_bridge.h +5 -4
  90. package/libc/include/any-linux-any/linux/netfilter_ipv4.h +4 -5
  91. package/libc/include/any-linux-any/linux/netfilter_ipv6.h +3 -4
  92. package/libc/include/any-linux-any/linux/nfs.h +1 -1
  93. package/libc/include/any-linux-any/linux/nfsd_netlink.h +1 -0
  94. package/libc/include/any-linux-any/linux/nilfs2_api.h +2 -2
  95. package/libc/include/any-linux-any/linux/nilfs2_ondisk.h +97 -66
  96. package/libc/include/any-linux-any/linux/nl80211.h +104 -3
  97. package/libc/include/any-linux-any/linux/pci.h +7 -0
  98. package/libc/include/any-linux-any/linux/pci_regs.h +65 -6
  99. package/libc/include/any-linux-any/linux/pcitest.h +1 -0
  100. package/libc/include/any-linux-any/linux/perf_event.h +24 -3
  101. package/libc/include/any-linux-any/linux/pkt_sched.h +1 -0
  102. package/libc/include/any-linux-any/linux/prctl.h +30 -0
  103. package/libc/include/any-linux-any/linux/rseq.h +62 -5
  104. package/libc/include/any-linux-any/linux/shm.h +0 -1
  105. package/libc/include/any-linux-any/linux/stddef.h +4 -0
  106. package/libc/include/any-linux-any/linux/sysctl.h +1 -2
  107. package/libc/include/any-linux-any/linux/taskstats.h +12 -1
  108. package/libc/include/any-linux-any/linux/tcp.h +23 -3
  109. package/libc/include/any-linux-any/linux/typelimits.h +8 -0
  110. package/libc/include/any-linux-any/linux/ublk_cmd.h +120 -1
  111. package/libc/include/any-linux-any/linux/v4l2-controls.h +63 -0
  112. package/libc/include/any-linux-any/linux/vbox_vmmdev_types.h +2 -2
  113. package/libc/include/any-linux-any/linux/vduse.h +80 -5
  114. package/libc/include/any-linux-any/linux/version.h +3 -3
  115. package/libc/include/any-linux-any/linux/vfio.h +4 -0
  116. package/libc/include/any-linux-any/linux/videodev2.h +3 -0
  117. package/libc/include/any-linux-any/linux/virtio_ring.h +1 -2
  118. package/libc/include/any-linux-any/linux/vmclock-abi.h +20 -0
  119. package/libc/include/any-linux-any/rdma/bnxt_re-abi.h +16 -0
  120. package/libc/include/any-linux-any/rdma/ib_user_ioctl_cmds.h +16 -0
  121. package/libc/include/any-linux-any/rdma/mana-abi.h +3 -0
  122. package/libc/include/any-linux-any/scsi/scsi_bsg_ufs.h +8 -9
  123. package/libc/include/any-linux-any/sound/sof/tokens.h +6 -0
  124. package/libc/include/arc-linux-any/asm/swab.h +0 -63
  125. package/libc/include/arc-linux-any/asm/unistd_32.h +1 -0
  126. package/libc/include/arm-linux-any/asm/ptrace.h +0 -9
  127. package/libc/include/arm-linux-any/asm/unistd-eabi.h +1 -0
  128. package/libc/include/arm-linux-any/asm/unistd-oabi.h +1 -0
  129. package/libc/include/csky-linux-any/asm/unistd_32.h +1 -0
  130. package/libc/include/hexagon-linux-any/asm/unistd_32.h +1 -0
  131. package/libc/include/loongarch-linux-any/asm/hwcap.h +1 -0
  132. package/libc/include/loongarch-linux-any/asm/kvm.h +1 -0
  133. package/libc/include/loongarch-linux-any/asm/kvm_para.h +1 -0
  134. package/libc/include/loongarch-linux-any/asm/unistd_32.h +2 -0
  135. package/libc/include/loongarch-linux-any/asm/unistd_64.h +2 -0
  136. package/libc/include/m68k-linux-any/asm/unistd_32.h +1 -0
  137. package/libc/include/mips-linux-any/asm/errno.h +2 -0
  138. package/libc/include/mips-linux-any/asm/unistd_n32.h +1 -0
  139. package/libc/include/mips-linux-any/asm/unistd_n64.h +1 -0
  140. package/libc/include/mips-linux-any/asm/unistd_o32.h +1 -0
  141. package/libc/include/powerpc-linux-any/asm/unistd_32.h +1 -0
  142. package/libc/include/powerpc-linux-any/asm/unistd_64.h +1 -0
  143. package/libc/include/riscv-linux-any/asm/hwprobe.h +4 -0
  144. package/libc/include/riscv-linux-any/asm/kvm.h +3 -0
  145. package/libc/include/riscv-linux-any/asm/ptrace.h +37 -0
  146. package/libc/include/riscv-linux-any/asm/sigcontext.h +1 -0
  147. package/libc/include/riscv-linux-any/asm/unistd_32.h +1 -0
  148. package/libc/include/riscv-linux-any/asm/unistd_64.h +1 -0
  149. package/libc/include/s390x-linux-any/asm/unistd_64.h +1 -0
  150. package/libc/include/sparc-linux-any/asm/errno.h +2 -0
  151. package/libc/include/sparc-linux-any/asm/ioctls.h +4 -4
  152. package/libc/include/sparc-linux-any/asm/unistd_32.h +2 -0
  153. package/libc/include/sparc-linux-any/asm/unistd_64.h +2 -0
  154. package/libc/include/x86-linux-any/asm/auxvec.h +0 -4
  155. package/libc/include/x86-linux-any/asm/kvm.h +13 -8
  156. package/libc/include/x86-linux-any/asm/svm.h +16 -16
  157. package/libc/include/x86-linux-any/asm/unistd_32.h +1 -0
  158. package/libc/include/x86-linux-any/asm/unistd_64.h +1 -0
  159. package/libc/include/x86-linux-any/asm/unistd_x32.h +1 -0
  160. package/libc/include/xtensa-linux-any/asm/unistd_32.h +1 -0
  161. package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
  162. package/package.json +1 -1
  163. package/std/Build/Cache.zig +6 -6
  164. package/std/Build/Step/Compile.zig +0 -1
  165. package/std/Build/Step/Run.zig +2 -2
  166. package/std/Build/Step.zig +2 -4
  167. package/std/Build/WebServer.zig +2 -2
  168. package/std/Build.zig +0 -3
  169. package/std/Io/Dir.zig +7 -2
  170. package/std/Io/Dispatch.zig +3 -13
  171. package/std/Io/File/Writer.zig +8 -6
  172. package/std/Io/Reader.zig +8 -9
  173. package/std/Io/Semaphore.zig +112 -17
  174. package/std/Io/Terminal.zig +1 -1
  175. package/std/Io/Threaded.zig +171 -37
  176. package/std/Io/Uring.zig +13 -15
  177. package/std/Io/Writer.zig +46 -42
  178. package/std/Io/net.zig +11 -11
  179. package/std/Io.zig +90 -26
  180. package/std/SemanticVersion.zig +1 -1
  181. package/std/Target/Query.zig +2 -2
  182. package/std/Target.zig +50 -5
  183. package/std/array_hash_map.zig +9 -18
  184. package/std/builtin.zig +4 -0
  185. package/std/c/haiku.zig +3 -0
  186. package/std/c/serenity.zig +1 -6
  187. package/std/c.zig +89 -7
  188. package/std/compress/flate/Decompress.zig +2 -3
  189. package/std/compress/zstd/Decompress.zig +2 -4
  190. package/std/crypto/Certificate.zig +13 -1
  191. package/std/crypto/ascon.zig +75 -33
  192. package/std/crypto/codecs/asn1/Oid.zig +12 -1
  193. package/std/crypto/codecs/base64_hex_ct.zig +2 -4
  194. package/std/crypto/ml_kem.zig +2 -9
  195. package/std/crypto/tls/Client.zig +79 -4
  196. package/std/crypto/tls.zig +1 -1
  197. package/std/crypto.zig +1 -0
  198. package/std/debug/Pdb.zig +1 -1
  199. package/std/debug.zig +4 -3
  200. package/std/fmt.zig +8 -3
  201. package/std/fs/path.zig +6 -4
  202. package/std/heap/BufferFirstAllocator.zig +165 -0
  203. package/std/heap.zig +2 -126
  204. package/std/http/Client.zig +21 -24
  205. package/std/http.zig +3 -4
  206. package/std/json/Scanner.zig +2 -2
  207. package/std/os/emscripten.zig +1 -1
  208. package/std/os/linux/IoUring.zig +2 -0
  209. package/std/os/linux/aarch64.zig +41 -12
  210. package/std/os/linux/arc.zig +173 -0
  211. package/std/os/linux/arm.zig +41 -12
  212. package/std/os/linux/hexagon.zig +33 -11
  213. package/std/os/linux/loongarch32.zig +41 -13
  214. package/std/os/linux/loongarch64.zig +41 -12
  215. package/std/os/linux/m68k.zig +41 -13
  216. package/std/os/linux/mips.zig +67 -36
  217. package/std/os/linux/mips64.zig +60 -29
  218. package/std/os/linux/mipsn32.zig +60 -29
  219. package/std/os/linux/or1k.zig +41 -12
  220. package/std/os/linux/powerpc.zig +41 -12
  221. package/std/os/linux/powerpc64.zig +41 -12
  222. package/std/os/linux/riscv32.zig +41 -12
  223. package/std/os/linux/riscv64.zig +41 -12
  224. package/std/os/linux/s390x.zig +44 -7
  225. package/std/os/linux/sparc64.zig +83 -52
  226. package/std/os/linux/syscalls.zig +26 -1
  227. package/std/os/linux/thumb.zig +52 -36
  228. package/std/os/linux/x32.zig +41 -12
  229. package/std/os/linux/x86.zig +42 -13
  230. package/std/os/linux/x86_64.zig +41 -12
  231. package/std/os/linux.zig +412 -436
  232. package/std/os/uefi/tables/boot_services.zig +9 -8
  233. package/std/os.zig +41 -0
  234. package/std/process.zig +1 -1
  235. package/std/sort.zig +3 -3
  236. package/std/zig/Ast/Render.zig +3 -3
  237. package/std/zig/AstGen.zig +44 -98
  238. package/std/zig/AstRlAnnotate.zig +0 -11
  239. package/std/zig/BuiltinFn.zig +0 -32
  240. package/std/zig/LibCInstallation.zig +4 -3
  241. package/std/zig/Parse.zig +7 -7
  242. package/std/zig/WindowsSdk.zig +13 -13
  243. package/std/zig/Zir.zig +50 -63
  244. package/std/zig/ZonGen.zig +6 -5
  245. package/std/zig/llvm/Builder.zig +12 -12
  246. package/std/zig.zig +1 -10
  247. package/std/zip.zig +5 -5
  248. package/zig.h +340 -1
  249. package/libc/include/hexagon-linux-any/asm/signal.h +0 -29
  250. package/libc/include/s390x-linux-any/asm/tape390.h +0 -103
  251. package/libc/mingw/math/fdiml.c +0 -24
  252. package/libc/mingw/winpthreads/spinlock.c +0 -82
  253. package/libc/musl/src/linux/tee.c +0 -8
  254. package/libc/musl/src/math/fdimf.c +0 -10
  255. package/libc/musl/src/math/fdiml.c +0 -18
  256. package/libc/musl/src/string/strdup.c +0 -10
  257. package/libc/musl/src/string/strndup.c +0 -12
  258. package/libc/musl/src/string/wcsdup.c +0 -10
  259. package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
  260. package/libc/musl/src/thread/pthread_spin_init.c +0 -6
  261. package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
  262. package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
  263. package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
  264. package/libc/musl/src/unistd/dup2.c +0 -20
  265. package/libc/musl/src/unistd/dup3.c +0 -26
  266. package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
  267. package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
  268. 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. However, a future enhancement could be eliminating Zig's
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 sf = std.heap.stackFallback(1024, c.comp.gpa);
58
- const allocator = sf.get();
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 error.FatalError,
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 error.FatalError,
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 sf = std.heap.stackFallback(1024, comp.gpa);
1765
- const allocator = sf.get();
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 stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa);
1980
- const sfa = stack_fallback.get();
1981
- const header_path = try std.fmt.allocPrint(sfa, format, args);
1982
- defer sfa.free(header_path);
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 stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa);
2072
- const sf_allocator = stack_fallback.get();
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(sf_allocator, &.{ dir, filename });
2078
- defer sf_allocator.free(path);
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 error.OutOfMemory,
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(sf_allocator, &.{ embed_dir, filename });
2093
- defer sf_allocator.free(path);
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 error.OutOfMemory,
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 sf = std.heap.stackFallback(1024, d.comp.gpa);
951
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, d.comp.gpa);
960
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, d.comp.gpa);
1105
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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, &macro_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 error.OutOfMemory,
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 error.OutOfMemory,
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 error.OutOfMemory,
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 |e| switch (e) {
1526
- error.OutOfMemory => return error.OutOfMemory,
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 sf = std.heap.stackFallback(1024, p.comp.gpa);
219
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, p.comp.gpa);
433
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, gpa);
1541
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 stack_fallback = std.heap.stackFallback(bytes_needed, gpa);
4841
- const allocator = stack_fallback.get();
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 |e| switch (e) {
5725
- error.OutOfMemory => return error.OutOfMemory,
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 sf = std.heap.stackFallback(1024, gpa);
9926
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), gpa);
10216
- const allocator = sf.get();
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 sf = std.heap.stackFallback(1024, pp.comp.gpa);
216
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, pp.comp.gpa);
1027
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, pp.comp.gpa);
1056
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, pp.comp.gpa);
1078
- const allocator = sf.get();
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 sf = std.heap.stackFallback(1024, pp.comp.gpa);
48
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, p.comp.gpa);
319
- var allocating: std.Io.Writer.Allocating = .init(sf.get());
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 sf = std.heap.stackFallback(1024, c.comp.gpa);
72
- const allocator = sf.get();
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 error.OutOfMemory,
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")) {
@@ -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.StringArrayHashMapUnmanaged(Ast.Node.Index),
10
- in_scope_names: std.StringArrayHashMapUnmanaged(u32),
11
- replace_names: std.StringArrayHashMapUnmanaged(u32),
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);
@@ -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 error.Canceled,
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.writeStackTrace(trace, stderr) catch break :p;
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 error.OutOfMemory,
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 error.OutOfMemory,
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 error.OutOfMemory,
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();
@@ -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),