579 Commits

Author SHA1 Message Date
Matthew Lugg 72d954e7d3 compiler: remove array multiplication from the language
Resolves: https://github.com/ziglang/zig/issues/24738
2026-04-30 09:03:58 +01:00
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
Matthew Lugg e67c344fc0 compiler,tests,tools: remove uses of capturing errdefer
In preparation for its removal, as accepted in
https://github.com/ziglang/zig/issues/23734.
2026-04-29 23:27:58 +01:00
Alex Rønne Petersen 9f2f6aaef5 drop support for powerpc64-linux-gnu
glibc has never officially supported ELFv2 on big-endian PowerPC, and we do not
(and likely never will) support linking ELFv1. So just drop this target instead
of pretending we actually have anything resembling usable support for it. This
is a dying target anyway; IBM have been pushing people to powerpc64le for years
now, and most distros have dropped big endian.

glibc headers and abilists are not updated as part of this; I'll just let that
happen automatically on the next glibc update. Size savings are expected to be
very minimal anyway since there's large overlap between powerpc64 and
powerpc64le.

This commit also fixes a couple of bad assumptions in std.Target:

* The dynamic linker path should be /lib64/ld64.so.1. We should get this right
  even if the Zig compiler doesn't support the target.
* cCallingConvention() was picking powerpc64_elf_v2 only for musl targets. In
  reality, for the targets we support in std.Target, it should pick v2 for all
  except powerpc64-linux-gnu.

Finally, this switches LLVM codegen to use ELFv2 data layout for all targets
except ps3.
2026-04-26 19:24:46 +02:00
Alex Rønne Petersen 9aaebf67d2 zig cc: update options data to LLVM 22 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen ca0b3318a0 std.Target: update CPU and feature data to LLVM 22 2026-04-25 21:54:47 +02:00
Andrew Kelley b047641f26 distribute the lldb pretty printers
rather than having them only in the source tree in tools/, distribute
them to zig users.

gdb ones are too outdated, delete them.

stage1 also is useless now.
2026-04-22 16:11:02 -07:00
Andrew Kelley 49fe3f887e tools: rename stage2 to compiler 2026-04-22 16:11:02 -07:00
Andrew Kelley 00a11421e6 remove stage1 debug helpers python code 2026-04-22 16:11:02 -07:00
andrew.kraevskii bbab366b78 Audit usages of toOwnedSlice (#32001)
Followup to #30769

I grepped for `try .*toOwnedSlice` and checked all of them by hand.

Fixes a bunch of memory leaks removes usages or `errdefer` and `vars` in some places. I also switched array_list.Managed to ArrayList where it was convenient.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32001
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-22 19:35:46 +02:00
Andrew Kelley 67a5b6e5e8 delete @cImport from the language
closes #20630
2026-04-15 17:43:53 -07: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
regp b6aebc4117 tools: fix outdated filename in std_gdb_pretty_printers.py comment 2026-04-11 17:27:02 +03:00
Alex Rønne Petersen d6f43caadf Merge pull request 'audit: handle process.Child.Term exhaustively and give useful exit information on process exit' (#31018) from murtaza/zig:child.term-audit into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31018
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-11 00:59:11 +02:00
Andrew Kelley c3a862522b std: remove managed array hash map variants
And deprecate all the API names except for:
* `std.array_hash_map.Auto`
* `std.array_hash_map.String`
* `std.array_hash_map.Custom`
2026-04-10 17:39:45 +02:00
murtaza 4a1383d987 process.Child: use std.posix.SIG instead of u32 for Child.Term stopped field 2026-04-07 10:27:21 +02:00
murtaza 07b49c61ff audit: handle process.Child.Term exhaustively and give useful exit information 2026-04-07 10:27:01 +02:00
Andrew Kelley abd131e336 zig cc: make --version use the full clang CLI lowering code path
because clang wants to parse the -target argument with clang -target
syntax.

closes #30178
2026-03-25 18:29:19 -07:00
Nathan Bourgeois c824ce954e misc: Add allegrex CPU & features, run tool, update semver 2026-03-21 19:39:04 -04:00
Andrew Kelley 06b85a4fd0 CLI: use zon format for clang options
- plain old data ftw
- 177K -> 151K
- data bypasses Sema

This change is not really important but it was nice to explore best
practices for data like this.

When I measured building the compiler, I found no statistically
significant difference in compilation time.
2026-03-20 06:46:13 +01:00
Jacob Young 9ac1386c10 std.Io.Threaded: windows networking without ws2_32 2026-03-18 20:13:59 -04:00
Meghan Denny b483ec28e3 tools: better detect '=' in clang options 2026-03-17 18:57:07 +01:00
Meghan Denny bd5dc75068 std: remove GeneralPurposeAllocator alias 2026-03-11 01:55:49 +01:00
Matthew Lugg c2b42383eb compiler,std: various little fixes 2026-03-10 10:26:14 +00:00
Matthew Lugg c91b06ef52 incr-check: fix successful -fno-emit-bin updates 2026-03-10 10:26:09 +00:00
Matthew Lugg 1826ba69d8 compiler: make dependency loop errors good 2026-03-10 10:26:09 +00:00
Alex Rønne Petersen bc282a6389 generate_linux_syscalls: add loongarch32 2026-02-09 23:54:30 +01:00
Alex Rønne Petersen 81ef502f08 generate_linux_syscalls: add hexagon abi name 2026-02-09 23:54:30 +01:00
Alex Rønne Petersen 65c073b147 generate_linux_syscalls: update usage text 2026-02-09 23:46:19 +01:00
Ryan Liptak 05346e123b Add process.Child.Cwd, use it for cwd and remove cwd_dir field
The user must now explicitly choose between inheriting the current CWD, passing a path for the CWD, or passing a Dir for the CWD.
2026-02-02 01:41:35 -08:00
Andrew Kelley ec74d650fe incr-check: update to std.Io.File.MultiReader
from std.Io.poll
2026-01-30 22:03:14 -08:00
Andrew Kelley a901ea23b0 update doctest API usage 2026-01-30 22:03:14 -08:00
Andrew Kelley 54241bc770 tools: update for std.process API changes 2026-01-30 22:03:14 -08:00
Andrew Kelley b1d1806fef std.process: currentDir -> currentPath
In Zig standard library, Dir means an open directory handle. path
represents a file system identifier string. This function is better
named after "current path" than "current dir". "get" and "working" are
superfluous.
2026-01-29 18:47:58 -08:00
Andrew Kelley 649aaf4814 std: migrate getcwd to Io
progress towards #30150
2026-01-29 18:40:55 -08:00
Andrew Kelley 1f1381a866 update API usage of std.crypto.random to io.random 2026-01-07 11:03:36 -08:00
Alex Rønne Petersen d0ad76c03c update_openbsd_libc: add tool for updating openbsd libc startup code 2026-01-05 16:50:44 +01:00
Alex Rønne Petersen 834ac8122b process_headers: add openbsd support 2026-01-05 14:52:48 +01:00
Andrew Kelley 1070c2a71a rename env_map to environ_map
For naming consistency with `std.process.Environ.Map`.
2026-01-04 00:27:09 -08:00
Andrew Kelley 17c7a339d8 incr-check: update to new APIs 2026-01-04 00:27:08 -08:00
Andrew Kelley d97e4ca0d1 documentation should be descriptive not prescriptive 2026-01-04 00:27:08 -08:00
Andrew Kelley 77087f6f31 langref: update to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley 4afed3e9ef test-standalone: update the rest of the cases to new API 2026-01-04 00:27:08 -08:00
Andrew Kelley bf74827ddb test-standalone: update more cases to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley f28802a9c6 zig libc: fix subcommand
This branch regressed the child process "run" mechanism because it
didn't pass the correct stdin, stdout, stderr values to process.spawn

Fixed now.
2026-01-04 00:27:08 -08:00
Andrew Kelley f9585ad01f update tests and tools to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley d6a1e73142 std: start wrangling environment variables and process args
this commit is unfinished. It marks a spot where I wanted to start
moving child process stuff below the std.Io.VTable
2026-01-04 00:27:07 -08:00
Matthew Lugg 4de33579d8 incr-check: make sure to always show the target
Change the log implementation to prepend the current target and update
to all logs which happen during an update.

Makes progress on https://github.com/ziglang/zig/issues/22510, but does
not fully resolve it.
2026-01-03 15:45:11 +00:00
Andrew Kelley 2adfd4d107 std.Io: fix and improve Group API
Rename `wait` to `await` to be consistent with Future API. The
convention here is that this set of functionality goes together:
* async/concurrent
* await/cancel

Also rename Select `wait` to `await` for the same reason.

`Group.await` now can return `error.Canceled`. Furthermore,
`Group.await` does not auto-propagate cancelation. Instead, users should
follow the pattern of `defer group.cancel(io);` after initialization,
and doing `try group.await(io);` at the end of the success path.
Advanced logic can choose to do something other than this pattern in the
event of cancelation.

Additionally, fixes a bug in `std.Io.Threaded` future await, in which it
swallowed an `error.Canceled`. Now if a task is canceled while awaiting
a future, after propagating the cancel request, it also recancels,
meaning that the awaiting task will properly detect its own cancelation
at the next cancelation point.

Furthermore, fixes a bug in the compiler where `error.Canceled` was
being swallowed in `dispatchPrelinkWork`.

Finally, fixes std.crypto code that inappropriately used
`catch unreachable` in response to cancelation without even so much as a
comment explaining why it was believed to be unreachable. Now, those
functions have `error.Canceled` in the error set and propagate
cancelation properly.

With this way of doing things, `Group.await` has a nice property: even if
all tasks in the group are CPU bound and without cancelation points, the
`Group.await` can still be canceled. In such case, the task that was
waiting for `await` wakes up with a chance to do some more resource
cleanup tasks, such as canceling more things, before entering the
deferred `Group.cancel` call at which point it has to suspend until the
canceled but uninterruptible CPU bound tasks complete.

closes #30601
2025-12-29 22:47:34 -08:00
Andrew Kelley 3ad9a6a604 incr-check: more general --debug-log CLI 2025-12-26 19:58:56 -08:00