6467 Commits

Author SHA1 Message Date
Ryan Liptak
6e22b63edb windows: Extract RtlEqualUnicodeString usage into to a helper function 2022-12-17 22:06:47 -08:00
Techatrix
4809e0ea7f
fix potential integer underflow in std.zig.Ast.fullCall 2022-12-18 04:59:43 +00:00
Veikka Tuominen
901c3e9636
Merge pull request #13552 from hryx/comparus-tautologicus
Sema: elide integer comparisons with guaranteed outcomes
2022-12-18 01:57:49 +02:00
Evin Yulo
3367f19078 Make std.tz namespace accessible
Closes #13978
2022-12-18 01:41:56 +02:00
Andrew Kelley
11b57470d0
Merge pull request #13983 from squeek502/windows-childprocess-exec-retry
`ChildProcess.spawnWindows`: `PATH` search fixes + optimizations
2022-12-17 18:25:50 -05:00
r00ster91
aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
r00ster91
7350ea3e2d std.builtin: rename Type.Fn's args to params
This was a poor naming choice; these are parameters, not arguments.
Parameters specify what kind of arguments are expected, whereas the arguments are the actual values passed.
2022-12-17 14:11:33 +01:00
r00ster91
20d3fd901e std.builtin: rename Type.Fn.Param's arg_type to type
It's the type of a parameter, not an argument, but the prefix is redundant either way.
2022-12-17 14:11:33 +01:00
Ryan Liptak
9e8ac2b666 spawnWindows: Don't search PATH if app path is absolute 2022-12-17 03:36:45 -08:00
Ryan Liptak
d3242408d4 spawnWindows: If an exe is found but fails to exec, retry with PATHEXT values appended
This matches `cmd.exe` behavior. For example, if there is only a file named `mycommand` in the cwd but it is a Linux executable, then running the command `mycommand` will result in:

'mycommand' is not recognized as an internal or external command, operable program or batch file.

However, if there is *both* a `mycommand` (that is a Linux executable) and a `mycommand.exe` that is a valid Windows exe, then running the command `mycommand` will successfully run `mycommand.exe`.
2022-12-17 03:36:45 -08:00
Ryan Liptak
5843b7987e Add error.InvalidExe to CreateProcessW error set and handle it in ChildProcess.spawnWindows 2022-12-17 03:36:45 -08:00
Veikka Tuominen
9bb1104e37 implement defining C variadic functions 2022-12-17 13:22:09 +02:00
Steven Kabbes
90477e5c10
std.IndexedSet.iterator: allow iteration on const EnumSet 2022-12-17 11:37:03 +02:00
Jakub Konka
270b6c4c2f
Merge pull request #13964 from ziglang/issue-11737
Misc MachO linker improvements and link-tests refactor
2022-12-17 10:26:56 +01:00
Ryan Liptak
b362cbbc9f ChildProcess.spawnWindows: Drastically reduce the amount of allocation during FileNotFound recovery
Avoid a lot of unnecessary utf8 -> utf16 conversion and use a single ArrayList buffer for all the joined paths instead of a separate allocation for each join
2022-12-16 21:42:39 -08:00
Ryan Liptak
6a1021fb7d ChildProcess.spawnWindows: Fix PATH search when the ext is in the command
For example, if the command is specified as `something.exe`, the retry will now try:

```
C:\some\path\something.exe
C:\some\path\something.exe.COM
C:\some\path\something.exe.EXE
C:\some\path\something.exe.BAT
... etc ...
```

whereas before it would only try the versions with an added extension from `PATHEXT`, which would cause the retry to fail on things that it should find.
2022-12-16 21:42:39 -08:00
yujiri8
68d2f68ed8
zig fmt: fix extra whitespace with multiline strings
Fixes #13937
2022-12-17 00:24:58 +02:00
zooster
8da9cc85af std.meta: remove bitCount 2022-12-17 00:15:47 +02:00
Jakub Konka
9ad24a4aee macho: add uuid link test 2022-12-16 18:31:48 +01:00
Jakub Konka
09dee74414 macho: store LC headers to often updated LINKEDIT sections 2022-12-16 18:05:58 +01:00
Ganesan Rajagopal
aa3964477f c.zig: Add definition for pthread_key_t
Add missing definition for pthread_key_t

Closes #13950
2022-12-16 18:14:12 +02:00
Andrew Kelley
0d92fcf6a5 std.debug: disable sporadically failing test
see tracking issue #13963
2022-12-15 15:56:13 -07:00
Meghan
1704971666
std: make builtin.Type.{Int,Float}.bits a u16 instead of comptime_int 2022-12-15 23:08:51 +02:00
Ivan Velickovic
88b49ed00d std.leb128: Re-enable test for riscv64
These were previously disabled due to a LLVM 14 regression, see
https://github.com/ziglang/zig/issues/12031 for more details. This has been fixed
in LLVM 15.
2022-12-15 09:00:42 -05:00
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
Felix "xq" Queißner
108b3c5673 Improves the comment formatting. 2022-12-15 10:16:28 +01:00
Stevie Hryciw
69b784ff52 std: add CompareOperator.reverse 2022-12-15 00:56:26 -08: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
Felix "xq" Queißner
e28f4a1d85 Implements std.heap.MemoryPool and friends. 2022-12-15 09:27:23 +01: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