Commit graph

8009 commits

Author SHA1 Message Date
Justus Klausecker
06d08dabab Sema: fix illegal multi level pointer coercions
Moves a premature check that allowed pointers to mutable pointers to coerce
to any other pointer to a mutable pointer.
2025-11-14 23:25:54 +00:00
Matthew Lugg
c6b5945356 std.Build: don't force all children to inherit color option
The build runner was previously forcing child processes to have their
stderr colorization match the build runner by setting `CLICOLOR_FORCE`
or `NO_COLOR`. This is a nice idea in some cases---for instance a simple
`Run` step which we just expect to exit with code 0 and whose stderr is
not being programmatically inspected---but is a bad idea in others, for
instance if there is a check on stderr or if stderr is captured, in
which case forcing color on the child could cause checks to fail.

Instead, this commit adds a field to `std.Build.Step.Run` which
specifies a behavior for the build runner to employ in terms of
assigning the `CLICOLOR_FORCE` and `NO_COLOR` environment variables. The
default behavior is to set `CLICOLOR_FORCE` if the build runner's output
is colorized and the step's stderr is not captured, and to set
`NO_COLOR` otherwise. Alternatively, colors can be always enabled,
always disabled, always match the build runner, or the environment
variables can be left untouched so they can be manually controlled
through `env_map`.

Notably, this fixes a failure when running `zig build test-cli` in a
TTY (or with colors explicitly enabled). GitHub CI hadn't caught this
because it does not request color, but Codeberg CI now does, and we were
seeing a failure in the `zig init` test because the actual output had
color escape codes in it due to 6d280dc.
2025-11-14 21:50:24 +01:00
Alex Rønne Petersen
9ab7eec23e represent Mac Catalyst as aarch64-maccatalyst-none rather than aarch64-ios-macabi
Apple's own headers and tbd files prefer to think of Mac Catalyst as a distinct
OS target. Earlier, when DriverKit support was added to LLVM, it was represented
a distinct OS. So why Apple decided to only represent Mac Catalyst as an ABI in
the target triple is beyond me. But this isn't the first time they've ignored
established target triple norms (see: armv7k and aarch64_32) and it probably
won't be the last.

While doing this, I also audited all Darwin OS prongs throughout the codebase
and made sure they cover all the tags.
2025-11-14 11:33:35 +01:00
xdBronch
071453d5b9 fix 'redundant comptime keyword' error source location and add tests 2025-11-13 19:47:36 +00:00
Matthew Lugg
181b25ce4f
Merge pull request #25772 from mlugg/kill-dead-code
compiler: rewrite some legalizations, and remove a bunch of dead code
2025-11-12 23:14:02 +00:00
Alex Rønne Petersen
dfd7b7f233 std.Target: remove Abi.cygnus
There is approximately zero chance of the Zig team ever spending any effort on
supporting Cygwin; the MSVC and MinGW-w64 ABIs are superior in every way that
matters, and not least because they lead to binaries that just run natively on
Windows without needing a POSIX emulation environment installed.
2025-11-12 22:39:04 +01:00
So1aric
49e19fc94f
Sema: fix inline fn compiler crash (#25586)
Resolves: https://github.com/ziglang/zig/issues/25581
2025-11-12 19:21:28 +00:00
Matthew Lugg
532aa3c575
cbe: work around some miscompilations
The changes to `codegen.c` are blatant hacks, but the problem they work
around isn't a regression: it's an existing miscompilation. This branch
happened to *expose* that miscompilation in more cases by changing how
an incorrect result is *used*.
2025-11-12 16:00:16 +00:00
Matthew Lugg
99a7884308
behavior: disable test on cbe
This isn't so much a regression as it is foreshadowing of accepted
proposal https://github.com/ziglang/zig/issues/24657.
2025-11-12 16:00:16 +00:00
xdBronch
fb914a9a10 sema: print @panic message at comptime 2025-11-10 14:21:26 +00:00
Mateusz Poliwczak
d942f693c5 std.zig.AstGen: properly handle grouped_expression
This fixes an endless loop in the compiler.
2025-11-10 14:02:37 +00:00
Ryan Liptak
b31a03f134 Let CRT take care of the entry point for wWinMain if libc is linked
Fixes #7852

Before, the modified test would fail with:

```
error: lld-link: undefined symbol: wWinMain
    note: referenced by C:\Users\Ryan\Programming\Zig\zig-x86_64-windows-0.15.1\lib\libc\mingw\crt\crtexewin.c:66
    note:               libmingw32.lib(ucrtexewin.obj):(wmain)
```
2025-11-08 17:11:12 -08:00
Ryan Liptak
74d2536715
Merge pull request #25158 from castholm/subsystem
Misc. Windows subsystem refactorings
2025-11-07 18:56:52 -08:00
xdBronch
92f64899c1 sema: disallow slices of opaque types 2025-11-07 12:12:32 +00:00
skewb1k
26db54d69b zig fmt: fix extra whitespace in StructInit with multiline strings
68d2f68ed introduced special handling for StructInit fields
containing multiline strings to prevent inserting whitespace after =.
However, this logic didn't handle cases without a trailing comma,
which resulted in unwanted trailing whitespace.
2025-11-05 14:07:30 +02:00
Carl Åstholm
54f2a7c833 Move std.Target.SubSystem to std.zig.Subsystem
Also updates the field names to conform with the rest of std.
2025-11-05 01:31:26 +01:00
Jacob Young
459f3b7ede codegen: fix tuple padding
Closes #25797
2025-11-04 06:04:30 -05:00
Alex Rønne Petersen
a46c3a1582
test: remove some unsupported x86_64 darwin targets from llvm_targets 2025-10-31 15:36:17 +01:00
Jacob Young
402c14f86a
aarch64: implement optional comparisons 2025-10-30 09:31:30 +00:00
Jacob Young
52a029e503 x86_64: continue hacking around unimplemented linker logic
Closes #25666
2025-10-29 19:31:44 -04:00
Andrew Kelley
a072d821be
Merge pull request #25592 from ziglang/init-std.Io
std: Introduce `Io` Interface
2025-10-29 13:51:37 -07:00
Alex Rønne Petersen
a7119d4269 remove all IBM AIX and z/OS support
As with Solaris (dba1bf9353), we have no way to
actually audit contributions for these OSs. IBM also makes it even harder than
Oracle to actually obtain these OSs.

closes #23695
closes #23694
closes #3655
closes #23693
2025-10-29 14:25:51 +01:00
Andrew Kelley
030ddc7952 update standalone tests for ws2_32 dependency 2025-10-29 06:20:51 -07:00
Andrew Kelley
8b269f7e18 std: make signal numbers into an enum
fixes start logic for checking whether IO/POLL exist
2025-10-29 06:20:51 -07:00
Andrew Kelley
e6b4e1a5d0 disable self-hosted wasm test-cases
Tracked by #25684
2025-10-29 06:20:51 -07:00
Andrew Kelley
46f7e3ea9f std.Io.Threaded: add ioBasic which disables networking 2025-10-29 06:20:51 -07:00
Andrew Kelley
873bcb5aa6 fix some std.Io compilation failures 2025-10-29 06:20:51 -07:00
Andrew Kelley
aadd8d4a3e std: back out the StackTrace byval changes
Let's keep passing this thing by pointer
2025-10-29 06:20:50 -07:00
Andrew Kelley
67df66c26c update some tests and tools for new Io APIs 2025-10-29 06:20:50 -07:00
Andrew Kelley
3bf0ce65a5 fix miscellaneous compilation errors
- ILSEQ -> error.BadPathName
- implement dirStatPath for WASI
2025-10-29 06:20:50 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Alex Rønne Petersen
dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
Alex Rønne Petersen
6b4f57a257
test: enable tsan standalone test for x86_64-freebsd and aarch64-freebsd 2025-10-26 11:12:46 +01:00
Alex Rønne Petersen
e39b82bf4e
compiler: avoid using self-hosted backend on x86_64-solaris/illumos
https://github.com/ziglang/zig/issues/25699
2025-10-25 12:44:13 +02:00
Alex Rønne Petersen
beb507a1ed
std.builtin: add CallingConvention.x86_64_x32
This was forgotten during the refactoring of std.builtin.CallingConvention. It
mirrors mips64_n32 for MIPS.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
3e2daa509a
std.Target: add arceb and xtensaeb Cpu.Arch tags 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
ae789fa50a
test: enable dynamic hexagon-linux-musl with -Dtest-extra-targets 2025-10-23 09:27:16 +02:00
mlugg
7a5d2a196f
tweak tests to avoid timeouts 2025-10-18 09:28:42 +01:00
Alex Rønne Petersen
3091efaa18
Merge pull request #25609 from alexrp/test-targets
`test`: put some niche targets behind `-Dtest-extra-targets`
2025-10-17 10:53:46 +02:00
Alex Rønne Petersen
9ae8c48fdf
test: put soft float powerpc targets behind -Dtest-extra-targets 2025-10-17 02:15:48 +02:00
Alex Rønne Petersen
7215249aa9
test: put all n32 and x32 targets behind -Dtest-extra-targets 2025-10-17 02:13:31 +02:00
Alex Rønne Petersen
ca2da421dd
test: put all dynamic musl targets behind -Dtest-extra-targets 2025-10-17 02:03:02 +02:00
Alex Rønne Petersen
92b555a4ed
test: enable std tests for hexagon 2025-10-16 22:13:10 +02:00
xdBronch
f785e4745d detect invalid @bitCast with arrays 2025-10-16 19:36:11 +01:00
Alex Rønne Petersen
70c21fdbab
libc-test: disable utime.c
Fails under heavy load in CI; futimens() effects aren't reflected in the
subsequent fstat() call for some reason.
2025-10-15 10:58:30 +02:00
Jacob Young
cc3c4d1069 windows: workaround kernel race condition in more places 2025-10-14 23:16:36 -04:00
Alex Rønne Petersen
4edebf40d5
Merge pull request #25402 from alexrp/libc-test-ci
`ci`: enable running libc-test on `x86_64-linux-release`
2025-10-14 21:29:57 +02:00
Jacob Young
958faa7031 windows: workaround kernel race condition the most 2025-10-12 13:55:57 -04:00
Jacob Young
95242cc431 windows: workaround kernel race condition even more 2025-10-11 12:17:39 -04:00
Jacob Young
8efcfeaf1e windows: workaround kernel race condition better
Until I can do more testing, we bump the numbers until morale improves.
2025-10-11 10:01:17 -04:00