6140 Commits

Author SHA1 Message Date
Ryan Liptak
077b003c50 std.compress: Improve tests, remove reliance on openDirAbsolute
- Previously, some of the compress tests used `@src()` in combination with `dirname` and `openDirAbsolute` to read test files at runtime, which both excludes platforms that `openDirAbsolute` is not implemented for (WASI) and platforms that `SourceLocation.file` is not absolute (this was true for me locally on Windows). Instead of converting the tests to use `fs.cwd().openDir`, they have been converted to use `@embedFile` to avoid any potential problems with the runtime cwd.
- In order to use `@embedFile`, some of the `[]u8` parameters needed to be changed to `[]const u8`; none of them needed to be non-const anyway
- The tests now use `expectEqual` and `expectEqualSlices` where appropriate for better diagnostics
2022-12-15 05:13:21 -05:00
Ryan Liptak
88d927a511 std.debug.TTY: Fix colors not resetting on Windows
This fixes a regression introduced in #12298 where colors would never reset in a Windows console because the attributes would be queried on every `setColor` call, and then try to 'reset' the attributes to what it just queried (i.e. it was essentially doing a complicated no-op on .Reset).

This fixes the problem while (I think) keeping with the spirit of the changes in #12298--that is, `TTY.Config` is not specifically tied to stderr like it was before #12298. To that end, detectTTYConfig now takes a `File` and that's what gets used to query the initial attributes to reset to.

(for context, before #12298, the first `setColor` call is where the reset attributes would get queried and it would always use stderr to do it)
2022-12-15 03:49:26 -05:00
Ryan Liptak
83e0e23f8a ArrayList.toOwnedSlice: Fix potential for leaks when using errdefer
#13666 introduced a footgun when using `toOwnedSlice` with `errdefer array_list.deinit()`, since `toOwnedSlice` could retain capacity if `resize` failed, meaning it would leak without `deinit` being called. This meant that the only correct way to use `toOwnedSlice` was with `defer` instead of `errdefer` to ensure that the ArrayList would get cleaned up.

Now, toOwnedSlice will now behave similarly to how it did before #13666, in that it will always clear the ArrayList's capacity if the resize/realloc succeeds.

This also reverts commit 05890a12f532ba9d58904a14381ec174b9efe473, which was contingent on the modified toOwnedSlice behavior.

Closes #13946
2022-12-15 02:56:24 -05:00
Andrew Kelley
bac4a5c196 std: remove a solved TODO comment 2022-12-14 14:26:02 -07:00
Andrew Kelley
353121d9d5 std.c.fstatat64: add noalias attributes 2022-12-14 14:26:02 -07:00
Andrew Kelley
a62c8d36d5 std.fs.Dir.statFile rework
* revert changes to Module because the error set is consistent across
   operating systems.
 * remove duplicated Stat.fromSystem code and use a less redundant name.
 * make fs.Dir.statFile follow symlinks, and avoid pointless control
   flow through the posix layer.
2022-12-14 14:26:02 -07:00
Philippe Pittoli
f65cdef7c8 std.fs.Dir.statFile: use fstatat
This avoids extra syscalls.
2022-12-14 14:11:59 -07:00
Andrew Kelley
4af305b30a
Merge pull request #13891 from Vexu/compile-errors
Organize and implement remaining stage1 compile errors
2022-12-14 12:08:08 -05:00
Andrew Kelley
3bf97bfd46 std: remove OOM workarounds
No longer needed since stage1 is deleted.
2022-12-14 11:42:28 -05:00
Jakub Konka
b27b17e253
Merge pull request #13935 from ziglang/mach-tasks
darwin: expose more Mach primitives, expose wrapped ptrace, and allow starting suspended for posix_spawn
2022-12-14 17:42:02 +01:00
Veikka Tuominen
014009a730 parser: fix usage of incorrect error tag
Closes #13921
2022-12-14 14:08:22 +02:00
IntegratedQuantum
0b4461d97b
Fix tautological big_int tests. 2022-12-14 00:29:25 +00:00
jackji
f1b536c44c expose VcpkgRoot so that build script can call exe.addVcpkgPath 2022-12-13 19:19:27 -05:00
Andrew Kelley
6378644d4e
Merge pull request #13907 from Vexu/call-merge
Remove `stack` option from `@call`
2022-12-13 18:15:18 -05:00
Jakub Konka
ec2697b7ea darwin: add even more wrappers for Mach syscalls
Rename `ThreadId` to `MachThread`.
2022-12-14 00:10:26 +01:00
Veikka Tuominen
65270cdc33
Merge pull request #12298 from r00ster91/debugerror
std.debug: handle some possible errors and resolve low-hanging TODOs
2022-12-14 00:42:31 +02:00
Andrew Kelley
9be5323e93 add zig objcopy subcommand
This commit moves the logic from `std.build.InstallRawStep` into `zig
objcopy`. The options here are limited, but we can add features as
needed.

closes #9261

New issues can be opened for specific objcopy flag support.
2022-12-13 15:37:52 -05:00
Jonathan Marler
5d3adc568c add std.mem.reverseIterator 2022-12-13 15:13:25 -05:00
Meghan
332020f310 std: add object format extension for dxcontainer
source: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst
2022-12-13 15:06:55 -05:00
Ganesan Rajagopal
21c2bca908 Allocator.zig: minor fixes
* Remove recursive call using null alignment, since it's no longer relevant.
* Fix comment
2022-12-13 15:04:03 -05:00
Frechdachs
478544239e
std: Fix update() method in PriorityQueue and PriorityDequeue (#13908)
Previously the update() method would iterate over its capacity, which may contain uninitialized memory or already removed elements.
2022-12-13 14:55:41 -05:00
Andrew Kelley
2e66b3be6e
Merge pull request #13910 from Luukdegram/wasm-simd 2022-12-13 14:11:22 -05:00
Jakub Konka
f5336a8fec darwin: add ability to dealloc obtained thread list for a task 2022-12-13 15:29:49 +01:00
Jakub Konka
f505cb96f4 darwin: add thread_act_t wrapper and helpers 2022-12-13 12:53:10 +01:00
Veikka Tuominen
08b2d491bc update usages of @call 2022-12-13 13:14:20 +02:00
Veikka Tuominen
7b2a936173 remove stack option from @call 2022-12-13 12:52:21 +02:00
Jakub Konka
2efd0eb884 darwin: wrap task_threads mach syscall 2022-12-13 11:36:00 +01:00
r00ster91
7561f63b5d std.debug: use OpenSelfDebugInfoError 2022-12-13 09:11:30 +01:00
r00ster91
d0d845a25b cleanup: inline color constants
Originally I just wanted to move these down because they seemed to be in some random position of the file,
but these constants look very old with their CASING and pretty unnecessary anyway so I just inlined them.
2022-12-13 09:11:30 +01:00
r00ster91
d8b4588d5f fix(terminal): handle some possible errors and resolve TODOs 2022-12-13 09:11:30 +01:00
Tom Maenan Read Cutting
d0eef26687 Add 0-length buffer checks to os.read & os.write
This helps prevent errors related to undefined pointers being passed
through to some OS apis when slices have 0 length.

Tests have also been added to catch these cases.
2022-12-12 15:10:59 -05:00
fsh
e0ba8b8ae5
std: fix bug in Pcg32 fill function (#13894)
The PCG32 fill function seems to have been copy-pasted from code using u64, so requesting `n` bytes where `(n & 7) > 4` bytes would cause the last few bytes to be all 0.
2022-12-12 14:19:49 -05:00
Jakub Konka
6f5eb9927d darwin: add more defs and wrappers 2022-12-12 20:04:46 +01:00
Luuk de Gram
c6d654f73b
wasm: implement the 'splat' instruction part 1
This implements `airSplat` for the native WebAssembly backend when
the features 'simd128' or 'relaxed-simd' are enabled. The commit
supports splat where the value lives in the linear memory segment,
as well as on the stack. This saves a lot of instruction cost.
When it detects the element type is not 8, 16, 32 or 64 bits,
the backend will instead use the same strategy as if the features
where disabled.
2022-12-12 17:42:00 +01:00
Luuk de Gram
5a6b6992d8
std: Add Wasm SIMD opcodes and value type
This adds the opcodes for both the simd128 and relaxed-simd features.
Those instructions are required by the self-hosted WebAssembly
backend. Additionally, this also adds the new `v128` Valtype which
is required to represent a 128bit simd value. SIMD values that do
not have exactly 128 bits will be represented differently.
2022-12-12 17:41:56 +01:00
yujiri8
d36cd49f0b
zig fmt: remove c_void -> anyopaque rewrite
TODO comments said to remove this
2022-12-12 10:46:28 +01:00
Jan Philipp Hafer
8a27df5355 std.os.linux: fix timerfd test
Remove timerfd timeout and fix timerfd_settime flag.
CI tests should not rely on timings to succeed.

Closes #13721.
2022-12-12 10:58:54 +02:00
Ronald Chen
959c10c5e5 std: added std.mem.window 2022-12-12 07:07:56 +02:00
Ronald Chen
4d23721395 std: implement subsetOf and supersetOf for EnumMultiset 2022-12-12 06:23:56 +02:00
Ronald Chen
552ecc286a std: implement subsetOf and supersetOf for DynamicBitSet 2022-12-12 06:23:56 +02:00
Jakub Konka
612b9f4da1 darwin: add defs and funcs for Mach exception handling 2022-12-12 00:13:37 +01:00
Andrew Kelley
e3ef01c6c7 disable failing windows std lib tests
See tracking issues #13892 and #13893
2022-12-11 12:48:18 -07:00
Andrew Kelley
59bd296328 std.build.InstallRawStep: fix compilation on wasm32-wasi 2022-12-11 12:48:17 -07:00
Andrew Kelley
dd4ca88ca7 std: fix compile error bitrot
These were revealed in an earlier commit in this branch that removed a
workaround disabling Windows std lib files from being tested.
2022-12-11 12:48:17 -07:00
Andrew Kelley
d1ad126e34 std.build.OptionsStep: fix regressed tests 2022-12-11 12:48:17 -07:00
Andrew Kelley
dd547f06c6 std.build: extract steps to separate files
There are intended to be no functional changes in this commit.
2022-12-11 12:48:17 -07:00
Jakub Konka
402dfb5fd3 darwin: wrap mach_port_insert_right kernel call 2022-12-11 18:27:10 +01:00
Pyrolistical
cd9af0f286
std: add EnumMultiSet 2022-12-11 19:10:54 +02:00
Mikael Berthe
05890a12f5 std: Update ArrayList documentation
Calling `deinit` might still be required after using `toOwnedSlice` now.
2022-12-11 17:42:26 +02:00
Jakub Konka
2a65971eb0 darwin: wrap allocating and deallocating mach ports for a task 2022-12-11 14:40:27 +01:00