Commit graph

7449 commits

Author SHA1 Message Date
Matthew Lugg
c76f451abc
Merge pull request #22979 from mlugg/remove-legacy-coercions
Sema: remove legacy coercion
2025-03-03 22:18:28 +00:00
mlugg
501e84a96a incremental: invalidate namespace dependencies when a name changes visibility
We could have more fine-grained dependencies here, but I think this is
fine for now.
2025-03-03 22:18:02 +00:00
Jacob Young
a6525c1762
Merge pull request #22529 from xtexx/x86-64/shl-sat-int
x86_64: Implement integer saturating left shifting codegen
2025-03-02 02:51:36 -05:00
Bingwu Zhang
1da909a1e2
x86_64: add behavior tests for saturating shift left
Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
Signed-off-by: Bingwu Zhang <xtex@aosc.io>
2025-03-02 10:30:43 +08:00
xtex
4e32193de3
x86_64: implement integer saturating left shifting codegen
Simliarly to shl_with_overflow, we first SHL/SAL the integer, then
SHR/SAR it back to compare if overflow happens.
If overflow happened, set result to the upper limit to make it saturating.

Bug: #17645
Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
Signed-off-by: Bingwu Zhang <xtex@aosc.io>
2025-03-02 10:30:32 +08:00
Jacob Young
50b40c9621 x86_64: rewrite wrapping add/sub 2025-03-01 16:29:22 -05:00
Andrew Kelley
6b6c1b1b0e Revert "Merge pull request #22898 from kristoff-it/deprecated-proposal"
This reverts commit dea72d15da, reversing
changes made to ab381933c8.

The changeset does not work as advertised and does not have sufficient
test coverage.

Reopens #22822
2025-02-28 01:37:10 -08:00
Andrew Kelley
f74a856d84 reword deprecated error slightly
"found" -> "reached" to match "reached unreachable code"
2025-02-26 14:41:33 -05:00
Andrew Kelley
7c2649f89d langref: fix whitespace 2025-02-26 14:41:33 -05:00
Loris Cro
25790e95f1 @deprecated: remove per-module flag in Build
This implementation looks at the builder of each
module in the build graph instead of storing a
boolean for each module.
2025-02-26 14:41:33 -05:00
Loris Cro
c75fdd96d2 @deprecated: add tests 2025-02-26 14:41:33 -05:00
Andrew Kelley
c45dcd013b
Merge pull request #22488 from Rexicon226/ubsan-rt
implement a ubsan runtime for better error messages
2025-02-26 03:08:36 -05:00
mlugg
3aaf394249
test: remove dependencies on legacy coercion 2025-02-26 00:17:09 +00:00
mlugg
84da520c44
Sema: remove legacy coercion
This was meant to be removed in #21817, but was somehow missed.
2025-02-26 00:17:09 +00:00
mlugg
3fcb4408a5 AstGen: improve 'file cannot be a tuple' source location
Instead of just reporting this on token 0, report it on the first
tuple-like field.
2025-02-25 22:28:47 +00:00
David Rubin
ca83f52fd9 ubsan: update wording 2025-02-25 11:22:33 -08:00
David Rubin
44d3b5a6e4 build: add comments explaining why we disable ubsan 2025-02-25 11:22:33 -08:00
David Rubin
35b9db3b15 correct some bugs 2025-02-25 11:22:33 -08:00
Ali Cheraghi
aec0f9b3e7
test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
Ali Cheraghi
181a89e728
build: add spirv to test matrix
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
2025-02-24 19:12:38 +01:00
mlugg
5e20e9b449 Sema: allow @ptrCast of slices changing the length
Also, refactor `Sema.ptrCastFull` to not be a horrifying hellscape.
2025-02-23 08:28:58 +00:00
Jacob Young
220f80e71d Dwarf: fix lowering of comptime-only optional pointer null values
Closes #22974
2025-02-22 22:47:32 -05:00
David Rubin
84aac8b6c7 Type: resolve union tag type before checking for runtime bits 2025-02-22 22:22:55 -05:00
Andrew Kelley
eb3c7f5706 zig build fmt 2025-02-22 17:09:20 -08:00
mlugg
b6a1fdd3fa tests: disable failing tests
These were previously incremental tests, so weren't running. They didn't
*need* to be incremental. They worked under the old runner because of
how it directly integrated with the compiler so tracked error messages
differently.
2025-02-23 00:52:50 +00:00
mlugg
a3b3a33d7a cases: remove old incremental case system
We now run incremental tests with `tools/incr-check.zig` (with the
actual cases being in `test/incremental/`).
2025-02-23 00:52:50 +00:00
Pavel Verigo
b25d93e7d9 stage2-wasm: implement switch_dispatch + handle > 32 bit integers in switches
Updated solution is future proof for arbitary size integer handling for both strategies .br_table lowering if switch case is dense, .br_if base jump table if values are too sparse.
2025-02-22 18:34:00 -05:00
Andrew Kelley
61b69a418d
Merge pull request #22659 from ifreund/linker-script-fix
link: fix ambiguous names in linker scripts
2025-02-22 18:18:24 -05:00
David Rubin
36fc2d2607 AstGen: make layout specifiers on opaque containers a compile error 2025-02-22 17:21:34 -05:00
Alex Rønne Petersen
f87b443af1 link.MachO: Add support for the -x flag (discard local symbols).
This can also be extended to ELF later as it means roughly the same thing there.

This addresses the main issue in #21721 but as I don't have a macOS machine to
do further testing on, I can't confirm whether zig cc is able to pass the entire
cgo test suite after this commit. It can, however, cross-compile a basic program
that uses cgo to x86_64-macos-none which previously failed due to lack of -x
support. Unlike previously, the resulting symbol table does not contain local
symbols (such as C static functions).

I believe this satisfies the related donor bounty: https://ziglang.org/news/second-donor-bounty
2025-02-22 06:35:19 +01:00
Andrew Kelley
a7467b9bb2
Merge pull request #22941 from Techatrix/config-header
std.Build.Step.ConfigHeader: improve handling of autoconf style headers
2025-02-22 00:25:09 -05:00
Jacob Young
300cb4881f x86_64: rewrite scalar @bitReverse 2025-02-22 00:05:47 -05:00
Alex Rønne Petersen
fc7a0c4878 Sema: Fix fnptr alignment safety checks to account for potential ISA tag.
As seen on e.g. Arm/Thumb and MIPS (MIPS16/microMIPS).

Fixes #22888.
2025-02-22 04:12:46 +01:00
Benjamin Thompson
a8d3760c5b
added compile_error test coverage for issue 17166 2025-02-21 07:00:37 +01:00
Alex Rønne Petersen
253e641ea3 test: Disable packet timeout for debugger tests.
On my machine, the defaults are 5 seconds (LLDB) and 2 seconds (GDB). These are
too low on the CI machines during high load, and the CI system itself already
enforces a timeout on jobs anyway, so just disable the timeout altogether.
2025-02-20 21:39:54 +01:00
Christian Fillion
dbc886fd04 translate-c: fix division and modulo of >8-bit stdint.h types in macros
Broke in c616141241 and e64eef366c
2025-02-20 13:33:59 +02:00
Andrew Kelley
bd237bced4
Merge pull request #22932 from jacobly0/x86_64-rewrite
x86_64: start rewriting bit counting operations
2025-02-19 11:37:40 -08:00
Techatrix
c1c6f08296
std.Build.Step.ConfigHeader: permit inserting enum values 2025-02-19 09:34:46 +01:00
Techatrix
344db9e26b
std.Build.Step.ConfigHeader: skip trailing whitespace in autoconf header 2025-02-19 09:34:26 +01:00
Techatrix
7e548af8b1
std.Build.Step.ConfigHeader: allow using autoconf values multiple times 2025-02-19 09:34:26 +01:00
Techatrix
c390f55e72
add a standalone test for autoconf style addConfigHeader 2025-02-19 09:34:25 +01:00
Jacob Young
7d70d7b215 x86_64: rewrite scalar @popCount 2025-02-18 09:47:44 -05:00
Jacob Young
ebea56d279 x86_64: rewrite scalar @ctz 2025-02-18 09:47:44 -05:00
Ali Cheraghi
d5e1cb3ea2
spirv: ziggify and remove unknown spirv features
`OpCapability` and `OpExtension` now can also be emitted from inline assembly
2025-02-18 18:08:47 +03:30
Andrew Kelley
d2e70ef84a
Merge pull request #22913 from jacobly0/x86_64-rewrite
x86_64: rewrite unsafe int vector multiplication
2025-02-17 16:13:22 -08:00
Alex Rønne Petersen
faccd79ca5
test: Update some compiler-internal type names in expected output. 2025-02-17 19:18:20 +01:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Alex Rønne Petersen
9c015e6c2b
std.builtin: Remove CallingConvention.arm_(apcs,aapcs16_vfp).
* arm_apcs is the long dead "OABI" which we never had working support for.
* arm_aapcs16_vfp is for arm-watchos-none which is a dead target that we've
  dropped support for.
2025-02-17 19:17:56 +01:00
Jacob Young
82eedf56d7 x86_64: rewrite scalar @byteSwap 2025-02-17 05:36:18 -05:00
Jacob Young
cec6867d76 x86_64: rewrite unsafe int vector multiplication 2025-02-17 00:10:24 -05:00