@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.
Files changed (352) hide show
  1. package/LICENSE +19 -0
  2. package/c/fcntl.zig +6 -1
  3. package/c/inttypes.zig +0 -10
  4. package/c/math.zig +138 -114
  5. package/c/pthread.zig +57 -0
  6. package/c/search.zig +1 -27
  7. package/c/stdlib/drand48.zig +0 -57
  8. package/c/stdlib.zig +0 -100
  9. package/c/string.zig +20 -7
  10. package/c/strings.zig +0 -38
  11. package/c/stropts.zig +17 -0
  12. package/c/unistd.zig +27 -26
  13. package/c/wchar.zig +10 -0
  14. package/c.zig +3 -2
  15. package/compiler/aro/aro/Attribute/names.zig +604 -589
  16. package/compiler/aro/aro/Attribute.zig +202 -116
  17. package/compiler/aro/aro/Builtins/common.zig +874 -863
  18. package/compiler/aro/aro/Builtins/eval.zig +15 -7
  19. package/compiler/aro/aro/Builtins.zig +0 -1
  20. package/compiler/aro/aro/CodeGen.zig +8 -7
  21. package/compiler/aro/aro/Compilation.zig +137 -111
  22. package/compiler/aro/aro/Diagnostics.zig +21 -17
  23. package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
  24. package/compiler/aro/aro/Driver.zig +138 -63
  25. package/compiler/aro/aro/LangOpts.zig +12 -2
  26. package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
  27. package/compiler/aro/aro/Parser.zig +352 -153
  28. package/compiler/aro/aro/Pragma.zig +3 -2
  29. package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
  30. package/compiler/aro/aro/Preprocessor.zig +136 -62
  31. package/compiler/aro/aro/Target.zig +17 -12
  32. package/compiler/aro/aro/Tokenizer.zig +31 -14
  33. package/compiler/aro/aro/Toolchain.zig +4 -7
  34. package/compiler/aro/aro/Tree.zig +178 -148
  35. package/compiler/aro/aro/TypeStore.zig +82 -24
  36. package/compiler/aro/aro/Value.zig +13 -17
  37. package/compiler/aro/aro/features.zig +1 -0
  38. package/compiler/aro/aro/pragmas/message.zig +3 -2
  39. package/compiler/aro/aro/pragmas/once.zig +0 -1
  40. package/compiler/aro/aro/record_layout.zig +3 -3
  41. package/compiler/aro/aro/text_literal.zig +3 -2
  42. package/compiler/aro/assembly_backend/x86_64.zig +7 -8
  43. package/compiler/aro/backend/Assembly.zig +1 -2
  44. package/compiler/aro/backend/Interner.zig +2 -2
  45. package/compiler/aro/backend/Ir.zig +100 -92
  46. package/compiler/aro/include/ptrcheck.h +49 -0
  47. package/compiler/aro/main.zig +26 -10
  48. package/compiler/build_runner.zig +1 -2
  49. package/compiler/objdump.zig +93 -0
  50. package/compiler/reduce/Walk.zig +7 -7
  51. package/compiler/reduce.zig +5 -1
  52. package/compiler/resinator/compile.zig +2 -2
  53. package/compiler/resinator/main.zig +7 -1
  54. package/compiler/resinator/preprocess.zig +1 -3
  55. package/compiler/std-docs.zig +8 -1
  56. package/compiler/test_runner.zig +194 -62
  57. package/compiler/translate-c/MacroTranslator.zig +80 -11
  58. package/compiler/translate-c/PatternList.zig +1 -9
  59. package/compiler/translate-c/Scope.zig +43 -6
  60. package/compiler/translate-c/Translator.zig +369 -127
  61. package/compiler/translate-c/ast.zig +19 -11
  62. package/compiler/translate-c/main.zig +76 -17
  63. package/compiler_rt/cos.zig +140 -53
  64. package/compiler_rt/divmodei4.zig +40 -17
  65. package/compiler_rt/exp.zig +1 -6
  66. package/compiler_rt/exp2.zig +1 -6
  67. package/compiler_rt/exp_f128.zig +377 -0
  68. package/compiler_rt/fabs.zig +0 -2
  69. package/compiler_rt/fma.zig +0 -2
  70. package/compiler_rt/fmax.zig +0 -2
  71. package/compiler_rt/fmin.zig +0 -2
  72. package/compiler_rt/fmod.zig +0 -2
  73. package/compiler_rt/limb64.zig +1127 -0
  74. package/compiler_rt/log.zig +0 -2
  75. package/compiler_rt/log10.zig +0 -2
  76. package/compiler_rt/log2.zig +0 -2
  77. package/compiler_rt/long_double.zig +37 -0
  78. package/compiler_rt/mulXi3.zig +1 -1
  79. package/compiler_rt/mulo.zig +6 -1
  80. package/compiler_rt/rem_pio2l.zig +173 -0
  81. package/compiler_rt/round.zig +0 -2
  82. package/compiler_rt/sin.zig +139 -56
  83. package/compiler_rt/sincos.zig +277 -72
  84. package/compiler_rt/sqrt.zig +0 -2
  85. package/compiler_rt/ssp.zig +1 -1
  86. package/compiler_rt/tan.zig +117 -48
  87. package/compiler_rt/trig.zig +256 -6
  88. package/compiler_rt/trunc.zig +0 -2
  89. package/compiler_rt/udivmodei4.zig +28 -0
  90. package/compiler_rt.zig +2 -0
  91. package/fuzzer.zig +857 -307
  92. package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
  93. package/libc/musl/src/math/pow.c +343 -0
  94. package/package.json +1 -1
  95. package/std/Build/Cache.zig +6 -6
  96. package/std/Build/Fuzz.zig +6 -19
  97. package/std/Build/Module.zig +1 -1
  98. package/std/Build/Step/CheckObject.zig +3 -3
  99. package/std/Build/Step/Compile.zig +18 -1
  100. package/std/Build/Step/ConfigHeader.zig +49 -33
  101. package/std/Build/Step/InstallArtifact.zig +18 -0
  102. package/std/Build/Step/Run.zig +538 -89
  103. package/std/Build/Step/TranslateC.zig +0 -6
  104. package/std/Build/Step.zig +10 -19
  105. package/std/Build/WebServer.zig +31 -19
  106. package/std/Build/abi.zig +47 -11
  107. package/std/Build.zig +17 -17
  108. package/std/Io/Dir.zig +7 -2
  109. package/std/Io/Dispatch.zig +5 -13
  110. package/std/Io/File/Reader.zig +3 -1
  111. package/std/Io/File/Writer.zig +8 -6
  112. package/std/Io/File.zig +1 -0
  113. package/std/Io/Kqueue.zig +2 -2
  114. package/std/Io/Reader.zig +8 -9
  115. package/std/Io/Semaphore.zig +112 -17
  116. package/std/Io/Terminal.zig +1 -1
  117. package/std/Io/Threaded.zig +352 -180
  118. package/std/Io/Uring.zig +15 -16
  119. package/std/Io/Writer.zig +46 -42
  120. package/std/Io/net.zig +11 -11
  121. package/std/Io.zig +1052 -20
  122. package/std/SemanticVersion.zig +1 -1
  123. package/std/Target/Query.zig +2 -2
  124. package/std/Target.zig +53 -7
  125. package/std/Thread.zig +8 -3
  126. package/std/array_hash_map.zig +105 -573
  127. package/std/array_list.zig +22 -31
  128. package/std/bit_set.zig +22 -6
  129. package/std/builtin/assembly.zig +68 -0
  130. package/std/builtin.zig +4 -0
  131. package/std/c/haiku.zig +3 -0
  132. package/std/c/serenity.zig +1 -6
  133. package/std/c.zig +106 -24
  134. package/std/compress/flate/Compress.zig +3 -3
  135. package/std/compress/flate/Decompress.zig +2 -3
  136. package/std/compress/zstd/Decompress.zig +2 -4
  137. package/std/crypto/Certificate/Bundle.zig +15 -1
  138. package/std/crypto/Certificate.zig +13 -1
  139. package/std/crypto/ascon.zig +75 -33
  140. package/std/crypto/codecs/asn1/Oid.zig +12 -1
  141. package/std/crypto/codecs/asn1.zig +33 -18
  142. package/std/crypto/codecs/base64_hex_ct.zig +16 -8
  143. package/std/crypto/ml_kem.zig +2 -9
  144. package/std/crypto/tls/Client.zig +79 -4
  145. package/std/crypto/tls.zig +1 -1
  146. package/std/crypto.zig +1 -0
  147. package/std/debug/Dwarf.zig +29 -9
  148. package/std/debug/Info.zig +4 -0
  149. package/std/debug/MachOFile.zig +46 -8
  150. package/std/debug/Pdb.zig +540 -37
  151. package/std/debug/SelfInfo/Elf.zig +19 -18
  152. package/std/debug/SelfInfo/MachO.zig +18 -7
  153. package/std/debug/SelfInfo/Windows.zig +138 -36
  154. package/std/debug.zig +181 -66
  155. package/std/enums.zig +25 -19
  156. package/std/fmt.zig +8 -3
  157. package/std/fs/path.zig +6 -4
  158. package/std/heap/ArenaAllocator.zig +145 -154
  159. package/std/heap/BufferFirstAllocator.zig +165 -0
  160. package/std/heap/debug_allocator.zig +7 -7
  161. package/std/heap.zig +2 -126
  162. package/std/http/Client.zig +31 -30
  163. package/std/http.zig +14 -13
  164. package/std/json/Scanner.zig +2 -2
  165. package/std/json/Stringify.zig +3 -3
  166. package/std/json/dynamic.zig +4 -4
  167. package/std/math/big/int.zig +16 -17
  168. package/std/mem/Allocator.zig +4 -5
  169. package/std/mem.zig +48 -0
  170. package/std/os/emscripten.zig +2 -18
  171. package/std/os/linux/IoUring.zig +2 -0
  172. package/std/os/linux/aarch64.zig +41 -12
  173. package/std/os/linux/arc.zig +173 -0
  174. package/std/os/linux/arm.zig +41 -12
  175. package/std/os/linux/hexagon.zig +33 -11
  176. package/std/os/linux/loongarch32.zig +41 -13
  177. package/std/os/linux/loongarch64.zig +41 -12
  178. package/std/os/linux/m68k.zig +41 -13
  179. package/std/os/linux/mips.zig +67 -36
  180. package/std/os/linux/mips64.zig +60 -29
  181. package/std/os/linux/mipsn32.zig +60 -29
  182. package/std/os/linux/or1k.zig +41 -12
  183. package/std/os/linux/powerpc.zig +41 -12
  184. package/std/os/linux/powerpc64.zig +41 -12
  185. package/std/os/linux/riscv32.zig +41 -12
  186. package/std/os/linux/riscv64.zig +41 -12
  187. package/std/os/linux/s390x.zig +44 -7
  188. package/std/os/linux/sparc64.zig +83 -52
  189. package/std/os/linux/thumb.zig +52 -36
  190. package/std/os/linux/x32.zig +41 -12
  191. package/std/os/linux/x86.zig +42 -13
  192. package/std/os/linux/x86_64.zig +41 -12
  193. package/std/os/linux.zig +419 -438
  194. package/std/os/uefi/tables/boot_services.zig +9 -8
  195. package/std/os/windows.zig +2 -2
  196. package/std/os.zig +41 -0
  197. package/std/pdb.zig +143 -4
  198. package/std/posix.zig +6 -12
  199. package/std/priority_dequeue.zig +13 -12
  200. package/std/priority_queue.zig +5 -4
  201. package/std/process/Child.zig +1 -1
  202. package/std/process/Environ.zig +1 -1
  203. package/std/process.zig +1 -1
  204. package/std/sort.zig +3 -3
  205. package/std/start.zig +17 -4
  206. package/std/std.zig +19 -6
  207. package/std/testing/FailingAllocator.zig +4 -4
  208. package/std/testing/Smith.zig +37 -2
  209. package/std/zig/Ast/Render.zig +187 -459
  210. package/std/zig/Ast.zig +0 -4
  211. package/std/zig/AstGen.zig +86 -103
  212. package/std/zig/AstRlAnnotate.zig +0 -11
  213. package/std/zig/AstSmith.zig +2602 -0
  214. package/std/zig/BuiltinFn.zig +0 -32
  215. package/std/zig/Client.zig +8 -3
  216. package/std/zig/LibCInstallation.zig +4 -3
  217. package/std/zig/Parse.zig +90 -81
  218. package/std/zig/Server.zig +26 -0
  219. package/std/zig/WindowsSdk.zig +13 -13
  220. package/std/zig/Zir.zig +66 -62
  221. package/std/zig/ZonGen.zig +6 -5
  222. package/std/zig/c_translation/helpers.zig +14 -9
  223. package/std/zig/llvm/Builder.zig +119 -60
  224. package/std/zig/system.zig +20 -4
  225. package/std/zig/tokenizer.zig +2 -1
  226. package/std/zig.zig +7 -10
  227. package/std/zip.zig +5 -5
  228. package/zig.h +340 -1
  229. package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
  230. package/libc/mingw/complex/cabs.c +0 -48
  231. package/libc/mingw/complex/cabsf.c +0 -48
  232. package/libc/mingw/complex/cacos.c +0 -50
  233. package/libc/mingw/complex/cacosf.c +0 -50
  234. package/libc/mingw/complex/carg.c +0 -48
  235. package/libc/mingw/complex/cargf.c +0 -48
  236. package/libc/mingw/complex/casin.c +0 -50
  237. package/libc/mingw/complex/casinf.c +0 -50
  238. package/libc/mingw/complex/catan.c +0 -50
  239. package/libc/mingw/complex/catanf.c +0 -50
  240. package/libc/mingw/complex/ccos.c +0 -50
  241. package/libc/mingw/complex/ccosf.c +0 -50
  242. package/libc/mingw/complex/cexp.c +0 -48
  243. package/libc/mingw/complex/cexpf.c +0 -48
  244. package/libc/mingw/complex/cimag.c +0 -48
  245. package/libc/mingw/complex/cimagf.c +0 -48
  246. package/libc/mingw/complex/clog.c +0 -48
  247. package/libc/mingw/complex/clog10.c +0 -49
  248. package/libc/mingw/complex/clog10f.c +0 -49
  249. package/libc/mingw/complex/clogf.c +0 -48
  250. package/libc/mingw/complex/conj.c +0 -48
  251. package/libc/mingw/complex/conjf.c +0 -48
  252. package/libc/mingw/complex/cpow.c +0 -48
  253. package/libc/mingw/complex/cpowf.c +0 -48
  254. package/libc/mingw/complex/cproj.c +0 -48
  255. package/libc/mingw/complex/cprojf.c +0 -48
  256. package/libc/mingw/complex/creal.c +0 -48
  257. package/libc/mingw/complex/crealf.c +0 -48
  258. package/libc/mingw/complex/csin.c +0 -50
  259. package/libc/mingw/complex/csinf.c +0 -50
  260. package/libc/mingw/complex/csqrt.c +0 -48
  261. package/libc/mingw/complex/csqrtf.c +0 -48
  262. package/libc/mingw/complex/ctan.c +0 -50
  263. package/libc/mingw/complex/ctanf.c +0 -50
  264. package/libc/mingw/math/arm/s_rint.c +0 -86
  265. package/libc/mingw/math/arm/s_rintf.c +0 -51
  266. package/libc/mingw/math/arm/sincos.S +0 -30
  267. package/libc/mingw/math/arm-common/sincosl.c +0 -13
  268. package/libc/mingw/math/arm64/rint.c +0 -12
  269. package/libc/mingw/math/arm64/rintf.c +0 -12
  270. package/libc/mingw/math/arm64/sincos.S +0 -32
  271. package/libc/mingw/math/bsd_private_base.h +0 -148
  272. package/libc/mingw/math/fdiml.c +0 -24
  273. package/libc/mingw/math/frexpf.c +0 -13
  274. package/libc/mingw/math/frexpl.c +0 -71
  275. package/libc/mingw/math/x86/acosf.c +0 -29
  276. package/libc/mingw/math/x86/atanf.c +0 -23
  277. package/libc/mingw/math/x86/atanl.c +0 -18
  278. package/libc/mingw/math/x86/cos.def.h +0 -65
  279. package/libc/mingw/math/x86/cosl.c +0 -46
  280. package/libc/mingw/math/x86/cosl_internal.S +0 -55
  281. package/libc/mingw/math/x86/ldexp.c +0 -23
  282. package/libc/mingw/math/x86/scalbn.S +0 -41
  283. package/libc/mingw/math/x86/scalbnf.S +0 -40
  284. package/libc/mingw/math/x86/sin.def.h +0 -65
  285. package/libc/mingw/math/x86/sinl.c +0 -46
  286. package/libc/mingw/math/x86/sinl_internal.S +0 -58
  287. package/libc/mingw/math/x86/tanl.S +0 -62
  288. package/libc/mingw/misc/btowc.c +0 -28
  289. package/libc/mingw/misc/wcstof.c +0 -66
  290. package/libc/mingw/misc/wcstoimax.c +0 -132
  291. package/libc/mingw/misc/wcstoumax.c +0 -126
  292. package/libc/mingw/misc/wctob.c +0 -29
  293. package/libc/mingw/misc/winbs_uint64.c +0 -6
  294. package/libc/mingw/misc/winbs_ulong.c +0 -6
  295. package/libc/mingw/misc/winbs_ushort.c +0 -6
  296. package/libc/mingw/stdio/_Exit.c +0 -10
  297. package/libc/mingw/stdio/_findfirst64i32.c +0 -21
  298. package/libc/mingw/stdio/_findnext64i32.c +0 -21
  299. package/libc/mingw/stdio/_fstat64i32.c +0 -37
  300. package/libc/mingw/stdio/_stat64i32.c +0 -37
  301. package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
  302. package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
  303. package/libc/mingw/stdio/_wstat64i32.c +0 -37
  304. package/libc/mingw/winpthreads/spinlock.c +0 -82
  305. package/libc/musl/src/legacy/isastream.c +0 -7
  306. package/libc/musl/src/legacy/valloc.c +0 -8
  307. package/libc/musl/src/linux/tee.c +0 -8
  308. package/libc/musl/src/math/__cosl.c +0 -96
  309. package/libc/musl/src/math/__sinl.c +0 -78
  310. package/libc/musl/src/math/__tanl.c +0 -143
  311. package/libc/musl/src/math/aarch64/lrint.c +0 -10
  312. package/libc/musl/src/math/aarch64/lrintf.c +0 -10
  313. package/libc/musl/src/math/aarch64/rintf.c +0 -7
  314. package/libc/musl/src/math/cosl.c +0 -39
  315. package/libc/musl/src/math/fdim.c +0 -10
  316. package/libc/musl/src/math/fdimf.c +0 -10
  317. package/libc/musl/src/math/fdiml.c +0 -18
  318. package/libc/musl/src/math/finite.c +0 -7
  319. package/libc/musl/src/math/finitef.c +0 -7
  320. package/libc/musl/src/math/frexp.c +0 -23
  321. package/libc/musl/src/math/frexpf.c +0 -23
  322. package/libc/musl/src/math/frexpl.c +0 -29
  323. package/libc/musl/src/math/i386/lrint.c +0 -8
  324. package/libc/musl/src/math/i386/lrintf.c +0 -8
  325. package/libc/musl/src/math/i386/rintf.c +0 -7
  326. package/libc/musl/src/math/lrint.c +0 -72
  327. package/libc/musl/src/math/lrintf.c +0 -8
  328. package/libc/musl/src/math/powerpc64/lrint.c +0 -16
  329. package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
  330. package/libc/musl/src/math/rintf.c +0 -30
  331. package/libc/musl/src/math/s390x/rintf.c +0 -15
  332. package/libc/musl/src/math/sincosl.c +0 -60
  333. package/libc/musl/src/math/sinl.c +0 -41
  334. package/libc/musl/src/math/tanl.c +0 -29
  335. package/libc/musl/src/math/x32/lrint.s +0 -5
  336. package/libc/musl/src/math/x32/lrintf.s +0 -5
  337. package/libc/musl/src/math/x86_64/lrint.c +0 -8
  338. package/libc/musl/src/math/x86_64/lrintf.c +0 -8
  339. package/libc/musl/src/string/strdup.c +0 -10
  340. package/libc/musl/src/string/strndup.c +0 -12
  341. package/libc/musl/src/string/wcsdup.c +0 -10
  342. package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
  343. package/libc/musl/src/thread/pthread_spin_init.c +0 -6
  344. package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
  345. package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
  346. package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
  347. package/libc/musl/src/unistd/dup2.c +0 -20
  348. package/libc/musl/src/unistd/dup3.c +0 -26
  349. package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
  350. package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
  351. package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
  352. package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
@@ -47,7 +47,7 @@ pub fn find(
47
47
  error.InstallationNotFound => null,
48
48
  error.PathTooLong => null,
49
49
  error.VersionTooLong => null,
50
- error.OutOfMemory => return error.OutOfMemory,
50
+ error.OutOfMemory => |e| return e,
51
51
  };
52
52
  errdefer if (windows10sdk) |*w| w.free(gpa);
53
53
 
@@ -55,13 +55,13 @@ pub fn find(
55
55
  error.InstallationNotFound => null,
56
56
  error.PathTooLong => null,
57
57
  error.VersionTooLong => null,
58
- error.OutOfMemory => return error.OutOfMemory,
58
+ error.OutOfMemory => |e| return e,
59
59
  };
60
60
  errdefer if (windows81sdk) |*w| w.free(gpa);
61
61
 
62
62
  const msvc_lib_dir: ?[]const u8 = MsvcLibDir.find(gpa, io, &registry, arch, environ_map) catch |err| switch (err) {
63
63
  error.MsvcLibDirNotFound => null,
64
- error.OutOfMemory => return error.OutOfMemory,
64
+ error.OutOfMemory => |e| return e,
65
65
  };
66
66
  errdefer gpa.free(msvc_lib_dir);
67
67
 
@@ -498,7 +498,7 @@ pub const Installation = struct {
498
498
  error.StringNotFound,
499
499
  => return error.InstallationNotFound,
500
500
 
501
- error.OutOfMemory => return error.OutOfMemory,
501
+ error.OutOfMemory => |e| return e,
502
502
  };
503
503
  defer gpa.free(path_w_maybe_with_trailing_slash);
504
504
 
@@ -572,7 +572,7 @@ pub const Installation = struct {
572
572
  error.StringNotFound,
573
573
  => return error.InstallationNotFound,
574
574
 
575
- error.OutOfMemory => return error.OutOfMemory,
575
+ error.OutOfMemory => |e| return e,
576
576
  };
577
577
  defer gpa.free(path_w_maybe_with_trailing_slash);
578
578
 
@@ -593,7 +593,7 @@ pub const Installation = struct {
593
593
  error.StringNotFound,
594
594
  => return error.InstallationNotFound,
595
595
 
596
- error.OutOfMemory => return error.OutOfMemory,
596
+ error.OutOfMemory => |e| return e,
597
597
  };
598
598
  defer gpa.free(version_without_0);
599
599
 
@@ -664,7 +664,7 @@ const MsvcLibDir = struct {
664
664
  error.StringNotFound,
665
665
  => return error.PathNotFound,
666
666
 
667
- error.OutOfMemory => return error.OutOfMemory,
667
+ error.OutOfMemory => |e| return e,
668
668
  };
669
669
  defer gpa.free(packages_path);
670
670
 
@@ -708,7 +708,7 @@ const MsvcLibDir = struct {
708
708
  error.StringNotFound,
709
709
  => return error.PathNotFound,
710
710
 
711
- error.OutOfMemory => return error.OutOfMemory,
711
+ error.OutOfMemory => |e| return e,
712
712
  };
713
713
  defer gpa.free(dll_path);
714
714
 
@@ -1042,7 +1042,7 @@ const MsvcLibDir = struct {
1042
1042
  const config_key = root_key.open(config_path) catch continue;
1043
1043
 
1044
1044
  const source_directories_value = config_key.getString(gpa, .{ .name = L("Source Directories") }, .wtf8) catch |err| switch (err) {
1045
- error.OutOfMemory => return error.OutOfMemory,
1045
+ error.OutOfMemory => |e| return e,
1046
1046
  else => continue,
1047
1047
  };
1048
1048
 
@@ -1118,7 +1118,7 @@ const MsvcLibDir = struct {
1118
1118
  defer vs7_key.close();
1119
1119
  try_vs7_key: {
1120
1120
  const path_maybe_with_trailing_slash = vs7_key.getString(gpa, .{ .name = L("14.0") }, .wtf8) catch |err| switch (err) {
1121
- error.OutOfMemory => return error.OutOfMemory,
1121
+ error.OutOfMemory => |e| return e,
1122
1122
  else => break :try_vs7_key,
1123
1123
  };
1124
1124
 
@@ -1178,11 +1178,11 @@ const MsvcLibDir = struct {
1178
1178
  environ_map: *const Environ.Map,
1179
1179
  ) error{ OutOfMemory, MsvcLibDirNotFound }![]const u8 {
1180
1180
  const full_path = MsvcLibDir.findViaCOM(gpa, io, registry, arch, environ_map) catch |err1| switch (err1) {
1181
- error.OutOfMemory => return error.OutOfMemory,
1181
+ error.OutOfMemory => |e| return e,
1182
1182
  error.PathNotFound => MsvcLibDir.findViaRegistry(gpa, io, arch, environ_map) catch |err2| switch (err2) {
1183
- error.OutOfMemory => return error.OutOfMemory,
1183
+ error.OutOfMemory => |e| return e,
1184
1184
  error.PathNotFound => MsvcLibDir.findViaVs7Key(gpa, io, registry, arch, environ_map) catch |err3| switch (err3) {
1185
- error.OutOfMemory => return error.OutOfMemory,
1185
+ error.OutOfMemory => |e| return e,
1186
1186
  error.PathNotFound => return error.MsvcLibDirNotFound,
1187
1187
  },
1188
1188
  },
package/std/zig/Zir.zig CHANGED
@@ -1016,9 +1016,6 @@ pub const Inst = struct {
1016
1016
  /// Implements the `@max` builtin for 2 args.
1017
1017
  /// Uses the `pl_node` union field with payload `Bin`
1018
1018
  max,
1019
- /// Implements the `@cImport` builtin.
1020
- /// Uses the `pl_node` union field with payload `Block`.
1021
- c_import,
1022
1019
 
1023
1020
  /// Allocates stack local memory.
1024
1021
  /// Uses the `un_node` union field. The operand is the type of the allocated object.
@@ -1297,7 +1294,6 @@ pub const Inst = struct {
1297
1294
  .memset,
1298
1295
  .memmove,
1299
1296
  .min,
1300
- .c_import,
1301
1297
  .@"resume",
1302
1298
  .ret_err_value_code,
1303
1299
  .extended,
@@ -1577,7 +1573,6 @@ pub const Inst = struct {
1577
1573
  .builtin_call,
1578
1574
  .max,
1579
1575
  .min,
1580
- .c_import,
1581
1576
  .@"resume",
1582
1577
  .ret_err_value_code,
1583
1578
  .@"break",
@@ -1857,7 +1852,6 @@ pub const Inst = struct {
1857
1852
  .memset = .pl_node,
1858
1853
  .memmove = .pl_node,
1859
1854
  .min = .pl_node,
1860
- .c_import = .pl_node,
1861
1855
 
1862
1856
  .alloc = .un_node,
1863
1857
  .alloc_mut = .un_node,
@@ -2009,12 +2003,14 @@ pub const Inst = struct {
2009
2003
  /// `operand` is payload index to `BinNode`.
2010
2004
  /// `small` is unused.
2011
2005
  shl_with_overflow,
2012
- /// `operand` is payload index to `UnNode`.
2013
- c_undef,
2014
- /// `operand` is payload index to `UnNode`.
2015
- c_include,
2006
+ /// `@round`, `@floor`, `@ceil`, or `@trunc`, with a result type.
2016
2007
  /// `operand` is payload index to `BinNode`.
2017
- c_define,
2008
+ /// `small` is a `RoundOp` representing the specific operation being performed.
2009
+ round_op,
2010
+ /// Returns the type for the operand of a rounding op.
2011
+ /// `operand` is `UnNode`.
2012
+ /// `small` is unused.
2013
+ round_op_ty,
2018
2014
  /// `operand` is payload index to `UnNode`.
2019
2015
  wasm_memory_size,
2020
2016
  /// `operand` is payload index to `BinNode`.
@@ -3233,6 +3229,13 @@ pub const Inst = struct {
3233
3229
  string_to_union_field_attrs,
3234
3230
  };
3235
3231
 
3232
+ pub const RoundOp = enum(u16) {
3233
+ round,
3234
+ floor,
3235
+ ceil,
3236
+ trunc,
3237
+ };
3238
+
3236
3239
  pub const UnNode = struct {
3237
3240
  node: Ast.Node.Offset,
3238
3241
  operand: Ref,
@@ -4018,30 +4021,30 @@ pub const DeclContents = struct {
4018
4021
  /// This is a simple optional because ZIR guarantees that a `func`/`func_inferred`/`func_fancy` instruction
4019
4022
  /// can only occur once per `declaration`.
4020
4023
  func_decl: ?Inst.Index,
4021
- explicit_types: std.ArrayList(Inst.Index),
4024
+ type_decls: std.ArrayList(Inst.Index),
4022
4025
  other: std.ArrayList(Inst.Index),
4023
4026
 
4024
4027
  pub const init: DeclContents = .{
4025
4028
  .func_decl = null,
4026
- .explicit_types = .empty,
4029
+ .type_decls = .empty,
4027
4030
  .other = .empty,
4028
4031
  };
4029
4032
 
4030
4033
  pub fn clear(contents: *DeclContents) void {
4031
4034
  contents.func_decl = null;
4032
- contents.explicit_types.clearRetainingCapacity();
4035
+ contents.type_decls.clearRetainingCapacity();
4033
4036
  contents.other.clearRetainingCapacity();
4034
4037
  }
4035
4038
 
4036
4039
  pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
4037
- contents.explicit_types.deinit(gpa);
4040
+ contents.type_decls.deinit(gpa);
4038
4041
  contents.other.deinit(gpa);
4039
4042
  }
4040
4043
  };
4041
4044
 
4042
4045
  /// Find all tracked ZIR instructions, recursively, within a `declaration` instruction. Does not recurse through
4043
4046
  /// nested declarations; to find all declarations, call this function recursively on the type declarations discovered
4044
- /// in `contents.explicit_types`.
4047
+ /// in `contents.type_decls`.
4045
4048
  ///
4046
4049
  /// This populates an `ArrayList` because an iterator would need to allocate memory anyway.
4047
4050
  pub fn findTrackable(zir: Zir, gpa: Allocator, contents: *DeclContents, decl_inst: Zir.Inst.Index) !void {
@@ -4061,15 +4064,49 @@ pub fn findTrackable(zir: Zir, gpa: Allocator, contents: *DeclContents, decl_ins
4061
4064
  if (decl.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4062
4065
  }
4063
4066
 
4064
- /// Like `findTrackable`, but only considers the `main_struct_inst` instruction. This may return more than
4065
- /// just that instruction because it will also traverse fields.
4066
- pub fn findTrackableRoot(zir: Zir, gpa: Allocator, contents: *DeclContents) !void {
4067
+ /// `findTrackable` does not recurse into field expressions in a type. Instead, this function will
4068
+ /// scan specifically field expressions in a given type declaration for trackable ZIR instructions.
4069
+ pub fn findTrackableFields(
4070
+ zir: *const Zir,
4071
+ gpa: Allocator,
4072
+ contents: *DeclContents,
4073
+ type_decl_inst: Zir.Inst.Index,
4074
+ ) Allocator.Error!void {
4067
4075
  contents.clear();
4068
4076
 
4069
4077
  var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
4070
4078
  defer found_defers.deinit(gpa);
4071
4079
 
4072
- try zir.findTrackableInner(gpa, contents, &found_defers, .main_struct_inst);
4080
+ assert(zir.instructions.items(.tag)[@intFromEnum(type_decl_inst)] == .extended);
4081
+ switch (zir.instructions.items(.data)[@intFromEnum(type_decl_inst)].extended.opcode) {
4082
+ .struct_decl => {
4083
+ const struct_decl = zir.getStructDecl(type_decl_inst);
4084
+ var it = struct_decl.iterateFields();
4085
+ while (it.next()) |field| {
4086
+ try zir.findTrackableBody(gpa, contents, &found_defers, field.type_body);
4087
+ if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4088
+ if (field.default_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4089
+ }
4090
+ },
4091
+ .union_decl => {
4092
+ const union_decl = zir.getUnionDecl(type_decl_inst);
4093
+ var it = union_decl.iterateFields();
4094
+ while (it.next()) |field| {
4095
+ if (field.type_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4096
+ if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4097
+ if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4098
+ }
4099
+ },
4100
+ .enum_decl => {
4101
+ const enum_decl = zir.getEnumDecl(type_decl_inst);
4102
+ var it = enum_decl.iterateFields();
4103
+ while (it.next()) |field| {
4104
+ if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, &found_defers, b);
4105
+ }
4106
+ },
4107
+ .opaque_decl => {},
4108
+ else => unreachable,
4109
+ }
4073
4110
  }
4074
4111
 
4075
4112
  fn findTrackableInner(
@@ -4344,9 +4381,7 @@ fn findTrackableInner(
4344
4381
  .sub_with_overflow,
4345
4382
  .mul_with_overflow,
4346
4383
  .shl_with_overflow,
4347
- .c_undef,
4348
- .c_include,
4349
- .c_define,
4384
+ .round_op,
4350
4385
  .wasm_memory_size,
4351
4386
  .wasm_memory_grow,
4352
4387
  .prefetch,
@@ -4385,6 +4420,7 @@ fn findTrackableInner(
4385
4420
  .dbg_empty_stmt,
4386
4421
  .astgen_error,
4387
4422
  .float_op_result_ty,
4423
+ .round_op_ty,
4388
4424
  => return,
4389
4425
 
4390
4426
  // `@TypeOf` has a body.
@@ -4394,49 +4430,18 @@ fn findTrackableInner(
4394
4430
  try zir.findTrackableBody(gpa, contents, defers, body);
4395
4431
  },
4396
4432
 
4397
- // Reifications and opaque declarations need tracking, but have no bodies.
4433
+ // Reifications need tracking.
4398
4434
  .reify_enum,
4399
4435
  .reify_struct,
4400
4436
  .reify_union,
4401
- .opaque_decl,
4402
4437
  => return contents.other.append(gpa, inst),
4403
4438
 
4404
- // Struct declarations need tracking and have bodies.
4405
- .struct_decl => {
4406
- try contents.explicit_types.append(gpa, inst);
4407
-
4408
- const struct_decl = zir.getStructDecl(inst);
4409
- var it = struct_decl.iterateFields();
4410
- while (it.next()) |field| {
4411
- try zir.findTrackableBody(gpa, contents, defers, field.type_body);
4412
- if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4413
- if (field.default_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4414
- }
4415
- },
4416
-
4417
- // Union declarations need tracking and have bodies.
4418
- .union_decl => {
4419
- try contents.explicit_types.append(gpa, inst);
4420
-
4421
- const union_decl = zir.getUnionDecl(inst);
4422
- var it = union_decl.iterateFields();
4423
- while (it.next()) |field| {
4424
- if (field.type_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4425
- if (field.align_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4426
- if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4427
- }
4428
- },
4429
-
4430
- // Enum declarations need tracking and have bodies.
4431
- .enum_decl => {
4432
- try contents.explicit_types.append(gpa, inst);
4433
-
4434
- const enum_decl = zir.getEnumDecl(inst);
4435
- var it = enum_decl.iterateFields();
4436
- while (it.next()) |field| {
4437
- if (field.value_body) |b| try zir.findTrackableBody(gpa, contents, defers, b);
4438
- }
4439
- },
4439
+ // Type declarations need tracking.
4440
+ .struct_decl,
4441
+ .union_decl,
4442
+ .enum_decl,
4443
+ .opaque_decl,
4444
+ => return contents.type_decls.append(gpa, inst),
4440
4445
  }
4441
4446
  },
4442
4447
 
@@ -4515,7 +4520,6 @@ fn findTrackableInner(
4515
4520
 
4516
4521
  .block,
4517
4522
  .block_inline,
4518
- .c_import,
4519
4523
  .typeof_builtin,
4520
4524
  .loop,
4521
4525
  => {
@@ -427,10 +427,11 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator
427
427
  });
428
428
 
429
429
  // For short initializers, track the names on the stack rather than going through gpa.
430
- var sfba_state = std.heap.stackFallback(256, gpa);
431
- const sfba = sfba_state.get();
430
+ var bfa_buf: [256]u8 = undefined;
431
+ var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, gpa);
432
+ const bfa = bfa_state.allocator();
432
433
  var field_names: std.AutoHashMapUnmanaged(Zoir.NullTerminatedString, Ast.TokenIndex) = .empty;
433
- defer field_names.deinit(sfba);
434
+ defer field_names.deinit(bfa);
434
435
 
435
436
  var reported_any_duplicate = false;
436
437
 
@@ -438,7 +439,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator
438
439
  const name_token = tree.firstToken(elem_node) - 2;
439
440
  if (zg.identAsString(name_token)) |name_str| {
440
441
  zg.extra.items[extra_name_idx] = @intFromEnum(name_str);
441
- const gop = try field_names.getOrPut(sfba, name_str);
442
+ const gop = try field_names.getOrPut(bfa, name_str);
442
443
  if (gop.found_existing and !reported_any_duplicate) {
443
444
  reported_any_duplicate = true;
444
445
  const earlier_token = gop.value_ptr.*;
@@ -667,7 +668,7 @@ fn numberLiteral(zg: *ZonGen, num_node: Ast.Node.Index, src_node: Ast.Node.Index
667
668
  big_int.setString(@intFromEnum(base), num_without_prefix) catch |err| switch (err) {
668
669
  error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral`
669
670
  error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above
670
- error.OutOfMemory => return error.OutOfMemory,
671
+ error.OutOfMemory => |e| return e,
671
672
  };
672
673
  switch (sign) {
673
674
  .positive => {},
@@ -81,15 +81,20 @@ fn ToUnsigned(comptime T: type) type {
81
81
  }
82
82
 
83
83
  /// Constructs a [*c] pointer with the const and volatile annotations
84
- /// from Self for pointing to a C flexible array of Element.
85
- pub fn FlexibleArrayType(comptime Self: type, comptime Element: type) type {
86
- return switch (@typeInfo(Self)) {
87
- .pointer => |ptr| @Pointer(.c, .{
88
- .@"const" = ptr.is_const,
89
- .@"volatile" = ptr.is_volatile,
90
- }, Element, null),
91
- else => |info| @compileError("Invalid self type \"" ++ @tagName(info) ++ "\" for flexible array getter: " ++ @typeName(Self)),
92
- };
84
+ /// from SelfType for pointing to a C flexible array of ElementType.
85
+ pub fn FlexibleArrayType(comptime SelfType: type, comptime ElementType: type) type {
86
+ switch (@typeInfo(SelfType)) {
87
+ .pointer => |ptr| {
88
+ return @Pointer(.c, .{
89
+ .@"const" = ptr.is_const,
90
+ .@"volatile" = ptr.is_volatile,
91
+ .@"allowzero" = true,
92
+ .@"addrspace" = .generic,
93
+ .@"align" = null,
94
+ }, ElementType, null);
95
+ },
96
+ else => |info| @compileError("Invalid self type \"" ++ @tagName(info) ++ "\" for flexible array getter: " ++ @typeName(SelfType)),
97
+ }
93
98
  }
94
99
 
95
100
  /// Promote the type of an integer literal until it fits as C would.