Commit Graph

38088 Commits

Author SHA1 Message Date
Alex Rønne Petersen 72966e2a7b disable some tests that fail on x86_64-macos
These might be Rosetta 2 bugs, but I have no way to actually check since we no
longer have any native x86_64-macos CI machines.
2026-05-09 08:49:34 +02:00
Elaine Gibson a85a29ae4d std.zig.LibCDirs: add default haiku include directories 2026-05-07 21:45:59 +02:00
Matthew Lugg 989b6a1b93 std.Build: clear step inputs when resetting the step
Previously, when using `zig build -fincremental --watch some-run-step`,
if the binary initially builds fine but a future update introduces a
compile error, the old file system inputs of the `Step.Run`---containing
the executable file itself---would remain. This is a bug, because that
file *has* changed since the input was registered (due to incremental
compilation), and yet the `Run` step is not out-of-date because it was
skipped due to a transitive failure.

A simple reproduction for this issue was:

  $ zig init
  $ zig build test --watch -fincremental

Then, in another terminal, introduce a compile error:

  $ sed -i 's/const/onst/' src/main.zig

Before this commit, this would cause the `zig build` command to repeat
updates forever, separated only by the 50ms debounce interval.

To fix this, when we reset a step with intent to re-run it, we should
clear its inputs immediately, so that if the step is skipped, it is
correctly marked as having no inputs.

This relates to a more general problem with the file system watching
logic which is that the set of inputs includes files in the cache which
are actually artifacts of other steps. Eventually, the build system
should learn to identify such files and exclude them from the set of
file system inputs. In other words, the fact that a `Run` step depends
on the executable generated by a `Compile` step should be modeled by a
dependency in the build step graph, *not* by a dependency on the path
where the `Compile` step happens to have emitted its executable file.
2026-05-07 19:45:37 +02:00
Justus Klausecker 6d0b887972 Sema: disallow pointer cast from pointer to opaque type to slice
Fixes a regression where this conversion crashes. When the conversion was
still possible it would produce a slice with a length of zero, which doesn't
really make a lot of sense either. There's no way to determine the length
of the destination slice from a pointer to an opaque type, so it's a compile
error now. Users should just cast to a many-item pointer and slice to the
desired length manually instead.
2026-05-07 06:25:43 +02:00
Matthew Lugg fecd28371d Sema: fix crash bitcasting undefined to bitpack type
Resolves: https://codeberg.org/ziglang/zig/issues/31944
2026-05-07 06:22:47 +02:00
Matthew Lugg fc1c83a363 Air: fix legalization of packed struct init with OPV field
I have verified that this fixes *both* of the reproductions given in
https://codeberg.org/ziglang/zig/issues/31837 (they were the same bug).

Resolves: https://codeberg.org/ziglang/zig/issues/31837
2026-05-07 06:21:59 +02:00
Matthew Lugg 0bcf29aff6 compiler: correct ABI size of comptime-only optional type
Resolves: https://codeberg.org/ziglang/zig/issues/31603
2026-05-07 06:21:30 +02:00
Matthew Lugg 45ecd6a996 std.hash_map: fix removeByPtr with array key type
Resolves: https://codeberg.org/ziglang/zig/issues/32086
2026-05-07 06:20:58 +02:00
Jari Vetoniemi 52c5223bca std.os.linux: local variable for timeout in poll
The linux syscall ppoll modifies its second argument, thus using
`@constCast` here is not correct.
2026-05-07 05:45:20 +02:00
ahwayakchih 0ec456c785 Add missing BPF.TAX and BPF.TXA declarations
As described in #32112, two instructions were missing from bpf.zig. They're declared in `linux/filter.h` (not in `linux/bpf.h`).
2026-05-07 05:38:45 +02:00
pentuppup 6d98649f68 llvm: print linksection when formatting IR 2026-05-07 05:37:23 +02:00
Alex Rønne Petersen e445c0d63e zig cc: always enforce -mabi=ieeelongdouble for powerpc
closes https://codeberg.org/ziglang/zig/issues/30976
2026-05-07 05:32:04 +02:00
Alex Rønne Petersen 81a9bec442 ci: bump s390x-linux-debug timeout by 1 hour
The host machine for the VMs we have is oversubscribed. There's not currently
much that can be done about that, but a hardware upgrade is planned for later
this year.
2026-05-07 01:39:28 +02:00
Andrew Kelley cd23f7a814 Merge pull request 'std.meta: Remove Int/Tuple in favor of @Int/@Tuple' (#35188) from linus/zig:deprecated-std-meta into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35188
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-06 19:35:40 +02:00
Andrew Kelley 3d56df1716 Merge pull request 'std.fmt, std.mem.Allocator: Remove bufPrintZ()/dupeZ() in favor of bufPrintSentinel()/dupeSentinel()' (#35190) from linus/zig:deprecated-std-fmt-mem into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35190
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-06 19:34:52 +02:00
Alex Rønne Petersen 994547d19a std.debug: disable stack traces on avr
https://codeberg.org/ziglang/zig/issues/31127
2026-05-06 16:03:56 +02:00
Alex Rønne Petersen 3e0dfe83ce drop support for powerpc-linux-gnueabi(hf)
These are the last PowerPC cross targets that still use the IBM 128-bit long
double format. I'm not convinced anyone cares enough about them to justify
keeping them around, so this drops support. powerpc-linux-musleabi(hf), which
use the IEEE format, are still fully supported for people who want to use old
32-bit PowerPC hardware.
2026-05-06 15:50:45 +02:00
jeffkdev a2ab3132df wasm futex: fix invalid cast from u64 to i64 2026-05-06 15:47:04 +02:00
jeffkdev 73d20ecd6a emscripten: Use SIG for sigaction types 2026-05-06 15:46:31 +02:00
mlugg 7eb79daffb Merge pull request 'std.builtin -> std.lang migration progress' (#32182) from compiler-std-lang into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32182
2026-05-06 10:10:44 +02:00
Andrew Kelley ebff436985 langref: fix incorrect description of >> operation 2026-05-05 14:39:50 -07:00
Andrew Kelley 56265d6f99 std.Io: clarify Group semantics with respect to async tasks 2026-05-05 13:39:24 -07:00
Alex Rønne Petersen 3fafbd2e35 Merge pull request 'std: fix getCpuCount() for emscripten' (#35206) from jeffkdev/zig:fix-issue-31871 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35206
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-05 17:20:14 +02:00
johan0A 6a37df00ec Config.resolve: don't error on explicit dynamic linker for Lib/Obj outputs 2026-05-05 17:17:15 +02:00
jeffkdev 4402a7477a Add emscripten_num_logical_cores() 2026-05-05 08:14:03 -04:00
Linus Groh 0add2dfc41 std.Io.File: Remove deprecated option types 2026-05-05 04:12:52 +02:00
Sawyer X 32ea57af50 Add stat for darwin aarch64 (#32178)
This fixes #32176.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32178
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-05 03:56:45 +02:00
jeffkdev 0cdc2fa5fb fix getCpuCount() for emscripten 2026-05-04 16:56:48 -04:00
Pavel Verigo 3d1fb4fac8 stage2-wasm: disable std tests, add failing behavior tests 2026-05-04 07:40:02 +02:00
Linus Groh fcc0a5a913 std.mem.Allocator: Remove dupeZ() in favor of dupeSentinel() 2026-05-03 21:42:16 +01:00
Linus Groh cd10ce9a67 std.fmt: Remove bufPrintZ() in favor of bufPrintSentinel() 2026-05-03 21:42:16 +01:00
Linus Groh bf953c4d6a std.meta: Remove Tuple in favor of @Tuple 2026-05-03 21:42:06 +01:00
Linus Groh 991f56fd6b std.meta: Remove Int in favor of @Int 2026-05-03 21:42:06 +01:00
linus a794287573 Merge pull request 'std.zig.LibCInstallation: Add support for serenity' (#32172) from linus/zig:more-serenity into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32172
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-03 21:04:54 +02:00
Matthew Lugg e393962bc2 langref: use 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:30 +01:00
Matthew Lugg 4c330e053b compiler: use 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:30 +01:00
Matthew Lugg e133f793ee compiler: depend on 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:29 +01:00
Matthew Lugg 8df04e1444 std: actually rename std.builtin to std.lang
This is now the canonical name, and `std.builtin` is a deprecated alias.
2026-05-03 12:22:37 +01:00
Prokop Randáček 02097dff70 setKey shouldn't recompute the entire index
setKey used to just call rebuildIndex which allocates a new index and
inserts into it all entries. This is the only allocation that setKey
needed to do.

Instead I propose that setKey sets the key in the entries and then does
a remove of the old key from the index and insert of the new key into
the index. This eliminates the need for setKey to allocate and makes
it infallible

To achieve this I extracted a helper function for inserting a single
entry into the index. Function for removing one entry from the index
already exists. setKey now just calls these two functions.
2026-05-02 20:15:10 +02:00
Andrew Kelley 04481c76cb Merge pull request 'Export wrapper around Zig DllMain function when linking libc + add tests' (#32179) from squeek502/zig:windows-dlls into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32179
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-02 20:06:56 +02:00
Justus Klausecker 1f22b2cbb2 LowerZon: fix packed containers
Since `packed` containers are now internally represented by a `bitpack`,
they need special handling on initialization: they need to be either
bitpacked or bitcasted to their backing integer. `Sema` already did this,
but `LowerZon` didn't yet.
2026-05-02 20:05:33 +02:00
Ryan Liptak a450016eb1 Add tests for DllMain to windows_entry_points standalone test 2026-05-02 02:44:26 -07:00
Ryan Liptak 8b16160b6f DllMain symbols: use ptrCast to allow using non-std pointer type
`HINSTANCE` is `*opaque {}` so using a type that should be compatible from alternate bindings (zigwin32, for example) would be a (false positive) compile error without this ptrCast.
2026-05-02 02:44:26 -07:00
Ryan Liptak 5aeeb6a0a4 Conditionally export wrapper around Zig-defined DllMain function when linking libc
This logic exists for other main functions, so it makes sense to do it for DllMain, too.
2026-05-02 02:44:26 -07:00
Andrew Kelley 0db721ec2e std: alias lang to builtin
see #19690
2026-05-02 11:29:27 +02:00
Linus Groh 0f5de17d6d std.zig.LibCInstallation: Add support for serenity
Largely mirrors Haiku, Serenity provides crt0 and GCC the rest (though
only crtbegin/crtend are used as per serenity's toolchain patches[1]):

```
$ find Build/aarch64/Root -iname 'crt*.o'
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbeginS.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtend.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbegin.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtfastmath.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crti.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtn.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtendS.o
Build/aarch64/Root/usr/lib/crt0.o
```

Serenity has a GCC and LLVM toolchain that work equally well, support
for the latter may be added in the future.

[1]: https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Toolchain/Patches/gcc/0001-Add-a-gcc-driver-for-SerenityOS.patch#L120-L127
2026-05-02 01:28:30 +01:00
Linus Groh 89b0c634c1 compiler: Enable PIE by default for serenity
See:
- https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Meta/CMake/serenity_compile_options.cmake#L15
- https://github.com/llvm/llvm-project/blob/62418bee5b9679c5b3bd536fb1101913b1c4e4d5/clang/lib/Driver/ToolChains/Serenity.h#L65
2026-05-02 01:28:22 +01:00
Saurabh Mishra d02d0b879c std:ArrayList: Merge getLastOrNull into getLast (#32008)
This PR merges the functionality of the `getLastOrNull` method into `getLast`, which improves consistency as its
based on methods like `front`, `back`, and `peek` in the `Deque` and `PriorityQueue` containers.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32008
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-02 02:26:15 +02:00
pentuppup 845b6a8efe Zcu: remove optimizeMode(), fix usages 2026-05-01 10:39:43 +02:00
Andrew Kelley 95507faf13 llvm builder: add missing comma before predictable metadata 2026-05-01 06:31:38 +02:00