Commit Graph

8283 Commits

Author SHA1 Message Date
Andrew Kelley bea4ea5ff8 Merge pull request 'zigc: long double: call double function if long double and double are equivalent' (#31775) from rpkak/zig:zigc-long-double into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31775
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-16 19:57:54 +02:00
mlugg d0226ac301 Merge pull request 'incremental: fix tracking of nested container declarations (and of opaque types)' (#31889) from dont-track-children-if-lost-parent into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31889
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-16 09:50:26 +02:00
rpkak f564a7733c remove code, which is only reached if c_longdouble is only 16 or 32 bits big 2026-04-16 07:05:31 +02:00
Andrew Kelley 67a5b6e5e8 delete @cImport from the language
closes #20630
2026-04-15 17:43:53 -07:00
badayvedat a05a25e2bb zig libc: export fdiml and fdimf (#31759)
Exports `fdiml` and `fdimf` in zig libc and removes from from musl and mingw libc.

Contributes to: https://codeberg.org/ziglang/zig/issues/30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31759
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: badayvedat <badayvedat@gmail.com>
Co-committed-by: badayvedat <badayvedat@gmail.com>
2026-04-16 01:11:04 +02:00
K4 bf40264941 add test for comptime-only functions 2026-04-16 01:04:41 +02:00
Matthew Lugg 6608b65100 incremental: fix tracking of nested container declarations
...but not in the way you'd expect. We were actually tracking them in
cases where we shouldn't have been! We cannot track a declaration if its
parent namespace has been lost, because that will cause analysis
failures immediately, but if we excluded a type from the mapping due to
a major change (such as a struct turning into a union, or a field being
added), we were still including any trackable instructions inside the
container's field expressions (e.g. struct field type expressions). This
meant we were tracking a type declaration while losing tracking on its
parent namespace, with predictably disastrous results.

Oh, also, tracking for opaque types was just totally wrong (I think this
was a typo from a while back). We could map it to things other than
opaque declarations, and we never mapped declarations inside opaques.
So, uh, I fixed that too.
2026-04-16 00:00:44 +01:00
Andrew Kelley e00b5daa1f Merge pull request 'stage2-wasm: finish bigint support' (#31784) from pavelverigo/zig:wasm-bigint-finish into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31784
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-15 23:07:40 +02:00
Pavel Verigo c32f7a4513 stage2-wasm: support assembly 2026-04-15 22:57:41 +02:00
Matthew Lugg 291addadf8 tests: move incremental target matrix out of manifests
Having the matrix of test targets for incremental compilation in the
individual test manifests has turned out to be inconvenient for a few
reasons: the tests are almost certain to accidentally get out of sync,
disabling targets entirely is annoying to do, and incr-check needs to
take care to print the target in all error messages (which currently
does not always happen).

If I recall correctly, I originally designed it this way because it
allows targets to be disabled at the granularity of individual tests,
but there's an easier approach to that: just let a test manifest that it
should be *skipped* on a certain target! As skipping is the rare case,
and also the case you want readers to notice, it makes sense for *it* to
be explicitly specified, like how unit tests use `error.SkipZigTest`.

So, `incr-check` no longer runs through a list of targets specified in
the manifest. Instead, it accepts (and, in fact, requires) a single
target on the command line, and runs the test for that specific target.
If the file contains a `#skip_target` directive for that target, then
`incr-check` exits immediately, so we can still disable targets at
individual test granularity, but you can also disable a target for all
tests by just commenting it out of the matrix in `test/tests.zig`.

As a nice bonus, this also allows the build system to run different
incremental test targets in parallel, because the targets are now
different steps.

This definitely seems like a better way to split the work between the
build system and incr-check---sorry for getting this wrong initially!
2026-04-15 00:06:18 +02:00
Mason Remaley 6707a5efee Arena allocates text 2026-04-13 01:30:14 -07:00
Mason Remaley df2413cf69 Removes dead code, updates some tests, fixes typos in comments, formats 2026-04-12 04:01:30 -07:00
Mason Remaley 541bd6c369 Updates more failing tests 2026-04-12 04:01:30 -07:00
Mason Remaley ac207073f3 Reverts renaming of builtin.StackTrace -> ErrorReturnTrace
We can defer this change until the next time zig1 needs to be updated
2026-04-12 04:01:30 -07:00
Mason Remaley 9edbf00ddf Enables disabled error trace test on Windows 2026-04-12 04:01:30 -07:00
Mason Remaley 825ba5a350 Adds tests for inline traces 2026-04-12 04:01:30 -07:00
Mason Remaley dcdb562c15 Adds support for running the trace tests through darling, fixes compilation errors in MachO due to interface change 2026-04-12 04:01:30 -07:00
Mason Remaley 492efd4c06 Adds support for running stack and error trace tests through Wine
Also fixes minor bug that was preventing existing tests from passing on
32 bit Windows
2026-04-12 04:01:30 -07:00
Mason Remaley 94ff38af87 Separates error return traces from stack traces
Doesn't commit the changes to stage1, we can generate those at the end
once we're not making any more changes to it to avoid wasting storage.
2026-04-12 04:01:29 -07:00
David Rubin 06ab4f702e llvm: correctly bitcast for memset intrinsic path 2026-04-12 05:28:54 +02:00
Andrew Kelley 2322d45d80 Merge pull request 'Implement variadic functions for Win64 in the x86_64 backend' (#31672) from kcbanner/zig:win64_varargs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31672
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-12 01:34:16 +02:00
Carl Åstholm c61e18006f Add standalone tests for debug I/O color detection 2026-04-11 12:28:24 -07:00
kcbanner 91dce64d10 - Fixup != .stage2_x86_64 -> == .stage2_llvm in var_args tests 2026-04-11 14:53:55 -04:00
Andrew Kelley 29225ae11b Merge pull request 'x64_86 fix: RMI can accept imm16 only for imul r16,r/m16' (#31234) from mathk/zig:x64_86-misscompfix-rmi16 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31234
Reviewed-by: jacobly <jacobly@noreply.codeberg.org>
2026-04-11 18:08:07 +02:00
Andrew Kelley cbe468a787 Merge pull request 'Sema: allow @round, @floor, @ceil, and @trunc to coerce to integer types' (#30906) from adria/zig:sema-rounding-casts into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30906
2026-04-11 16:44:41 +02:00
Alex Rønne Petersen 8d42a86fb3 test: add powerpc64-ps3-none and x86_64-(ps4,ps5)-none to llvm_targets 2026-04-11 12:55:45 +02:00
Alex Rønne Petersen 3898c815ac test: add mipsel-psp-eabihf to llvm_targets 2026-04-11 12:55:45 +02:00
Alex Rønne Petersen d626dc84d9 test: add s390x-linux-musl to llvm_targets 2026-04-11 12:06:50 +02:00
Alex Rønne Petersen 13839127b9 test: disable incremental tests on wasm32-wasi-selfhosted
https://codeberg.org/ziglang/zig/issues/31810
2026-04-11 04:40:16 +02:00
glowsquid 8111d3d63c fix comptime @ptrcasting from a larger type to a smaller one (#31774)
closes #30180

Note from mlugg: this fix is very much a hack, but it definitely won't break anything and it demonstrably fixes one case, so I'm merging it for now with the expectation that I'll be replacing the broken code soon.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31774
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
Co-authored-by: glowsquid <sachabarsayuracko@gmail.com>
Co-committed-by: glowsquid <sachabarsayuracko@gmail.com>
2026-04-10 23:31:21 +02:00
David 2c6e5006ed Sema: fix comptime @ptrCast to optional slices 2026-04-10 23:27:13 +02:00
Mathieu Suen 244f5aafca fixup! Adding unwrapped error multiply regression test 2026-04-10 23:23:33 +02:00
Mathieu Suen 7addae8f7d Adding unwrapped error multiply regression test 2026-04-10 23:23:33 +02:00
Jacob Young 1552bc7ad0 x86_64: fix mir rmi signedness 2026-04-10 23:23:33 +02:00
Matthew Lugg 998b714708 Sema: push to error trace when returning from inline function
There is no reason `inline fn`s should not be subject to error tracing:
they are still functions! So, push to the error trace when we return
from one, and add a test checking that inline functions do appear in
error traces.

This also changes how we emit error trace pushes: we no longer duplicate
the AIR `ret` instruction in the "error" and "non-error" code paths. I
suspect this will lead to slightly better unoptimized codegen, but I may
be wrong---I'll take some performance measurements before I merge this.
2026-04-10 23:17:22 +02:00
Pavel Verigo 773def30c2 stage2-wasm: fix bug in big endian limb64 + tiny fixes 2026-04-09 00:15:33 +02:00
Pavel Verigo 5b5f828019 test: skip .stage2_c for > 128 bits tests + remove skip for x86_64 2026-04-09 00:14:09 +02:00
Pavel Verigo 07e3e50fd2 stage2-wasm: enabling bigint blocked tests + final fixes 2026-04-09 00:14:09 +02:00
Pavel Verigo f2a842db5c stage2-wasm: sat ops 2026-04-09 00:14:09 +02:00
Pavel Verigo aa7874657b stage2-wasm: bigint div mod rem 2026-04-09 00:14:09 +02:00
Pavel Verigo fff887874e stage2-wasm: @intFromFloat and @floatFromInt 2026-04-09 00:14:09 +02:00
Pavel Verigo df79ea941b stage2-wasm: bigint abs + test min/max 2026-04-09 00:14:09 +02:00
Pavel Verigo 0ebd270d90 stage2-wasm: bigint mulo 2026-04-09 00:14:08 +02:00
Pavel Verigo 58944586be stage2-wasm: bigint support bitops and intcast 2026-04-09 00:14:08 +02:00
pentuppup 6193470cee error on tuples in extern contexts 2026-04-08 15:22:48 +02:00
Neel 86853ba0a4 Add RISC-V ABI register alias names for inline asm clobbers 2026-04-08 14:37:48 +02:00
Jan200101 9fd63daff2 std.Build.Step.ConfigHeader: handle leading whitespace for cmake 2026-04-08 14:24:48 +02:00
Alex Rønne Petersen a38c6bbcc4 test: disable incremental tests on x86_64-windows-selfhosted
https://codeberg.org/ziglang/zig/issues/31773
2026-04-06 23:04:14 +02:00
Pavel Verigo ad7a028228 stage2-wasm: pass incremental tests
This PR enables all incremental tests under the `test/incremental` directory, except one: `change_exports`, which is currently ignored as it requires a non-trivial amount of work on the linker, since we do not currently support exporting data symbols.

To enable the other tests, the following fixes were needed:

1. `src/link/Wasm.zig`: instead of chasing function type through Nav, get it directly.
2. `src/target.zig`: `.panic_fn` appears to work fine with the wasm backend.
3. `src/codegen/wasm/CodeGen.zig`: there was a liveness related bug that caused some `ArenaAllocator` code to crash the backend.

More info on (3), the liveness and local reuse code in the backend for years in unfinished state. For example there is currently no branch merging and reuse happens only when inst die in same block level. I initially considered doing a large refactor to implement everything correctly, but aborted due to its sheer size and currently! no clear idea about how to do this efficiently.

Instead, I fixed the bug with minimal changes and removed useless code, keeping the old solution otherwise intact.
2026-04-04 15:21:35 +02:00
rpkak 90ccd6051c test-libc: do not skip search_hsearch on wasi-libc
emmalloc is not used anymore
2026-04-03 13:28:33 +02:00