33004 Commits

Author SHA1 Message Date
Andrew Kelley
b31c32879d WIP 2025-03-27 17:21:16 -07:00
Matthew Lugg
d0911786c9
Merge pull request #22397 from Techatrix/type-safe-ast
improve type safety of std.zig.Ast
2025-03-12 02:22:41 +00:00
mlugg
a0401cf3e4 Zcu: rename skip_analysis_errors to skip_analysis_this_update and respect it
On updates with failed files, we should refrain from doing any semantic
analysis, or even touching codegen/link. That way, incremental
compilation state is untouched for when the user fixes the AstGen
errors.

Resolves: #23205
2025-03-11 23:38:32 +00:00
mlugg
24db007cde std.mem.Allocator.remap: fix incorrect doc comment (part 2) 2025-03-11 22:15:43 +00:00
孙冰
77395457fe std.c: fix sysconf names (std.c._SC) for android api
c.f. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/bits/sysconf.h
2025-03-11 21:41:58 +01:00
Andrew Kelley
982c500be5
Merge pull request #23188 from jacobly0/fix-23143
x86_64: fix crashes with symbols
2025-03-11 16:11:09 -04:00
Linus Groh
f660675467 std: Add support for SerenityOS in various places
Not nearly the entire downstream patchset but these are completely
uncontroversial and known to work.
2025-03-11 14:59:42 +00:00
Linus Groh
79a0de2a2f std.c: Add definitions for SerenityOS 2025-03-11 14:59:29 +00:00
mlugg
423907c270 Sema: fix handling of @This() on opaques
Resolves: #22869
2025-03-11 13:13:52 +00:00
Mathias Lafeldt
7e751e8040
Merge pull request #23193 from mlafeldt/fix-macho-detection
Fetch: enhance Mach-O executable detection for modern Macs

closes #21044
2025-03-11 06:12:13 +00:00
mlugg
5ffd8bf5f6 std.mem.Allocator.remap: fix incorrect doc comment
Resolves: #23194
2025-03-11 04:15:38 +00:00
Jacob Young
cff90e3ae0 x86_64: implement select of register mask 2025-03-10 10:38:33 -04:00
Jacob Young
0ef3250c34 x86_64: fix symbol bugs
Closes #23143
2025-03-10 10:38:30 -04:00
Jacob Young
e83607f52c Dwarf: remove comptime parameters from generic origin functions
Since generic instantiations are missing comptime arguments in Air, they
must be removed from the generic origins too.
2025-03-10 08:46:00 -04:00
Pat Tullmann
8e0a4ca4b3 Enable compiler-rt tests for wasm32-wasi
I think the underlying issue was the same as
https://github.com/ziglang/zig/issues/13258 and that has a work-around in
LLVM 19 (see https://github.com/llvm/llvm-project/issues/58557).

Fixes #15325
2025-03-10 06:15:12 +01:00
Andrew Kelley
539f3effd3
Merge pull request #21933 from kcbanner/comptime_nan_comparison
Fix float vector comparisons with signed zero and NaN, add test coverage
2025-03-09 15:06:25 -04:00
Alex Rønne Petersen
9840157c18 std.Target.Query: Don't append glibc version in zigTriple() if ABI isn't GNU. 2025-03-09 19:50:13 +01:00
Carmen
17b40b1d68 lib/std/os/uefi/status.zig: add error to enum conversion fn 2025-03-09 10:54:21 +00:00
Meghan Denny
0f6056903b std: Abi.default: only require an os tag 2025-03-09 09:44:11 +01:00
Pat Tullmann
eace31c6b3 std/lib: {fs,io,posix} test clean up
* use `tmp.dir.realpathAlloc()` to get full path into tmpDir instances
* use `testing.allocator` where that simplifies things (vs. manual ArenaAllocator for 1 or 2 allocs)
* Trust `TmpDir.cleanup()` to clean up contained files and sub-trees
* Remove some unnecessary absolute paths (enabling WASI to run the tests)
* Drop some no-longer necessary `[_][]const u8` casts
* Add scopes to reduce `var` usage in favor of `const`
2025-03-09 07:41:06 +01:00
remeh
02f63fdee9 std/containers: improve consistency using gpa parameter name for allocator. 2025-03-09 07:39:20 +01:00
Andrew Kelley
1eb729b9b9 Reapply "build: Don't check parent directories for git tag"
This reverts commit 7e0c25eccd8d9bc5b77953dbc9a39a26e383c550.

The `--git-dir` argument is relative to the `-C` argument, making this
patch OK after all.

I added a comment to go along with this since I found it confusing.

Apologies for the revert.
2025-03-08 12:34:13 -08:00
Ian Johnson
0bce4a4e05 Sema: handle generated tag enums in union field order check
Fixes #23059

The "note: enum field here" now references the field in the base union type rather than crashing.
2025-03-08 14:29:20 -05:00
Andrew Kelley
61c588d726
Merge pull request #22998 from jacobly0/x86_64-rewrite
x86_64: rewrite aggregate init
2025-03-08 14:27:57 -05:00
Jeremy Hertel
801a95035c std.time.epoch: change getDaysInMonth to accept the year as an argument 2025-03-08 14:25:28 -05:00
Jacob Young
a5900e310e compiler-rt: fix signed min int from float 2025-03-08 14:21:22 -05:00
Andrew Kelley
7e0c25eccd Revert "build: Don't check parent directories for git tag"
This reverts commit 21620f3c652bc874776acc7251f05b25d2838019.

This breaks running `zig build` from subdirectories.
2025-03-08 11:15:44 -08:00
LN Liberda
21620f3c65 build: Don't check parent directories for git tag
Sometimes Zig is built not from a git repository (e.g. from tarball), but inside another git repository (e.g. distro package repository). Make sure that the version check tries to parse a tag of Zig, and not of a parent directory.
2025-03-08 17:54:50 +00:00
Alex Rønne Petersen
3b3c18909d Compilation: Fix -fno-rtlib-defaultlib unused argument warning in ReleaseSafe.
Closes #23138.
2025-03-08 13:26:09 +01:00
Alex Rønne Petersen
5466a2f72d llvm: Replace DataLayoutBuilder with a simple target -> string switch.
This should be a lot easier to maintain. It's also a small step towards
eventually making the builder API parse the data layout string in order to
answer layout questions that we need to ask during code generation.
2025-03-08 12:16:13 +01:00
Alex Rønne Petersen
5c57e90ffb test: Disable test-elf-ld-script-path-error for now.
https://github.com/ziglang/zig/issues/23125
2025-03-08 07:04:27 +01:00
Jacob Young
5d115632d4 x86_64: reuse single register code during register write splitting 2025-03-07 23:59:38 -05:00
Jacob Young
54ed62755f x86_64: implement write register splitting 2025-03-07 23:59:31 -05:00
Jacob Young
f8f2a3ea6f x86_64: rewrite aggregate init 2025-03-07 23:59:09 -05:00
Pat Tullmann
214750fcfe lib/std/Build/Cache.zig: remove .wasi SkipZigTest checks
The build Cache test pass on Wasi now.

Fixes #5437
2025-03-08 04:38:29 +01:00
Alex Rønne Petersen
db77e46b49 zig cc: Don't pass -mabi for assembly files when targeting arm.
Clang's integrated Arm assembler doesn't understand -mabi yet, so this results
in "unused command line argument" warnings when building musl code and glibc
stubs, for example.
2025-03-08 03:52:28 +01:00
Techatrix
4129f7ff5a
std.zig.Ast: store lbrace and rbrace token in data of .error_set_decl
This makes the `.data` field the better choice over the `.main_token` for this tag.
2025-03-07 22:22:01 +01:00
Techatrix
d84055f9c6
std.zig.Ast: don't set the data field on .error_value and .enum_literal
The main_token already has the necessary information.
2025-03-07 22:22:01 +01:00
Techatrix
ba74af2ae8
std.zig.Ast: update doc comments of Node.Tag
The existing comment are incomplete, outdated and sometimes incorrect.
2025-03-07 22:22:01 +01:00
Techatrix
ca6fb30e99
std.zig.Ast: improve type safety
This commits adds the following distinct integer types to std.zig.Ast:
- OptionalTokenIndex
- TokenOffset
- OptionalTokenOffset
- Node.OptionalIndex
- Node.Offset
- Node.OptionalOffset

The `Node.Index` type has also been converted to a distinct type while
`TokenIndex` remains unchanged.

`Ast.Node.Data` has also been changed to a (untagged) union to provide
safety checks.
2025-03-07 22:22:01 +01:00
Techatrix
6dcd8f4f75
std.zig.Ast: add blockStatements and builtinCallParams 2025-03-07 22:20:35 +01:00
Techatrix
de9c889a0e
aro_translate_c: fix ast lowering of continue node
fixes #22601
2025-03-07 22:20:35 +01:00
Techatrix
e6596cbbf0
add a reference to #21690 2025-03-07 22:20:35 +01:00
Techatrix
c19f4c4402
fix ZonGen error message when encountering an array access 2025-03-07 22:20:35 +01:00
Techatrix
ad38af77fa
remove unreachable code paths from std.zig.Ast.lastToken
This function checks for various possibilities that are never produced
by the parser.
Given that lastToken is unsafe to call on an Ast with errors, I also
removed code paths that would be reachable on an Ast with errors.
2025-03-07 22:20:34 +01:00
Andrew Kelley
5765736867 fix InstallArtifact opening empty string
this appears to have been a problem since 43f73af3595c3174b8e67e9f2792c3774f2192e9
2025-03-07 15:21:40 -05:00
Andrew Kelley
4cefd1bd1b
Merge pull request #23097 from ziggoon/master
std.heap.PageAllocator updates to fix race condition and utilize NtAllocateVirtualMemory / NtFreeVirtualMemory instead of VirtualAlloc / VirtualFree
2025-03-06 14:39:09 -05:00
190n
1e0739f0c6 std.enums.tagName: preserve sentinel in return value 2025-03-06 08:41:51 +01:00
Kiëd Llaentenn
5f7dfc3577 langref: update splat section 2025-03-06 07:26:19 +01:00
kcbanner
144d69b571 test: add comptime memoization tests for bit-for-bit float equality 2025-03-04 23:31:12 -05:00