0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

633 commits

Author SHA1 Message Date
Matthew Lugg
cecc3e1b91
incr-check: restore stderr printing logic
Jacob just hit this confusing panic while working on DWARF stuff. I'm
not sure how this was regressed---the code prior to build system rework
already handled this case correctly by `break`ing to code after the
loop, which was written specifically to handle this case. All we need to
do is restore that `break`, and everything works again.
2026-08-11 09:33:35 +01:00
Saurabh Mishra
21f2381438 std.ArrayListUnmanaged: last and lastPtr methods (#36318)
ArrayList:

- `getLastOrNull` has been deprecated and renamed to `last`
- `getLast` has been removed in favor of `last` combined with `.?`
- `lastPtr` has been added which returns `?*T`

Upgrade guide:

```zig
if (list.getLastOrNull()) |foo| {
    // ...
}
const foo = list.getLast();
```
⬇️
```zig
if (list.last()) |foo| {
    // ...
}
const foo = list.last().?;
```

Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36318
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
2026-08-07 07:30:10 +02:00
Krzysztof Wolicki
ab4028d579 Update usages of most deprecated APIs
In particular renames of `std.mem.indexOf` family to `std.mem.find`
and generic unmanaged containers
2026-08-05 03:40:30 +02:00
Andrew Kelley
5bf19f61ff Merge pull request 'Implement foundation of the build system protocol' (#36147) from Techatrix/zig:build-system-protocol into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36147
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-08-05 01:42:28 +02:00
Alex Rønne Petersen
086f8d7b22
update_glibc: exclude some 2.32 crt0 files 2026-08-02 09:48:22 +02:00
Alex Rønne Petersen
23aa045ef4
libc: update glibc headers to 2.44 2026-07-31 23:04:47 +02:00
Jacob Young
865f329e4f cbe: update for compiler_rt abi changes
* `tools/generate_c_size_and_align_checks.zig`: superceded by any cbe
   output artifact
 * `cTypePreferredAlignment`: no uses, if brought back, cbe should be
   updated to verify `__alignof`

Closes #19991
Closes #20881
Closes #35523
2026-07-27 14:35:12 -04:00
Techatrix
38efc69dc9
Maker: serve build status over protocol 2026-07-21 16:31:30 +02:00
Techatrix
54162b1b9d
Maker: implement build steps request 2026-07-21 16:31:29 +02:00
Techatrix
f58c93b566
Maker: implement build system protocol foundation 2026-07-21 16:31:04 +02:00
Techatrix
0b681ec6c3
std.zig.Client: introduction 2026-07-21 14:34:40 +02:00
Andrew Kelley
ae4e835a66 std.lang: rename OptimizeMode to Optimize
and remove "release" from the enum tag names.

no functional change, however, despite the addition of
backwards-compatibile declarations in this patch, it is breaking because
expressions that use `==` or `!=` operators will not able to use the
deprecated names.

I predict these names to survive until the 1.0 tag without any more
breakage.
2026-07-20 17:26:50 -07:00
Justus Klausecker
69a26976ed zig fmt
Converts usages of `@intFromEnum` and `@enumFromInt` to instead use the
new `@backingInt` and `@fromBackingInt` builtins.
2026-07-17 23:30:26 +02:00
Ryan Liptak
e07edda6e7 gen_parser_oracle: Handle CRLF line endings, fail on invalid grammar 2026-07-10 12:18:39 +02:00
Andrew Kelley
65073f3dc5 std.zig.Ast: move mode into ParseOptions 2026-07-08 18:26:18 -07:00
Isaac Freund
b2c3c33eef
build: check if parser oracle must be regenerated 2026-07-08 15:49:43 +02:00
Isaac Freund
06b1896a61
build: add gen-parser-oracle step 2026-07-08 15:49:43 +02:00
Isaac Freund
3e45baa60a
std.zig.Ast.parse: introduce options struct
This is a much cleaner way to expose the new option to disable recovery
added in 62720ad9f9. It also makes it possible to add further
options in the future without further breaking changes.
2026-07-08 15:49:18 +02:00
Isaac Freund
5bafdbf9d8
tools/gen_parser_oracle: gen recursion guards for all defs
More rules are being made recursive for efficiency reasons, see the
previous commit.
2026-07-08 11:49:02 +02:00
Isaac Freund
e6749167fe
tools: enforce Block max depth in parser oracle 2026-07-08 11:49:01 +02:00
Isaac Freund
775dac9149
tools: add max depth to parser oracle
This is useful to avoid unbounded recursion/iteration while fuzzing.
It's not interesting to learn that the parser hits a stack overflow when
fed a million open parens for example.
2026-07-08 11:49:00 +02:00
Isaac Freund
068d483780
grammar: fix doc comment at start of file
My attempt to handle this case in 6f151109b5fdf88eb8b has proven
insufficient, the test case added by this commit was failing.

Solve this with a "start of file" non-terminal in the PEG grammar,
which unfortunately isn't portable but much better reflects the actual
implementation and is much simpler.
2026-07-08 11:48:59 +02:00
Isaac Freund
ac6930544f
grammar: fix operator whitespace after multiline string literal
Currently the grammar fails to enforce matching whitespace or lack of
whitespace around operators that are immediately preceded by a multiline
string literal and terminating newline.
2026-07-08 11:48:58 +02:00
Isaac Freund
20a2485061
tools: add oracle generator for parser fuzzing
This script parses a PEG grammar definition and generates a simple
recursive descent parser that recognizes that grammar.

The intent is to use this tool to generate an oracle against which
std.zig.Ast.parse() can be fuzz tested.

Unfortunately, generating a "smith" that can produce all possible valid
source code according to the PEG grammar definition does not seem
feasible due to PEG semantics. In particular, modeling the ordered
choice operator ('/') with a smith is problematic and seems to have
worst-case exponential runtime. Consider that `A / B` is equivalent to
`A / !A B`, it is not sufficient for a smith to choose an option from
the ordered choice at random and generate an input matched by that
sub-expression.

The current handwritten AstSmith.zig implementation does not match the
exact semantics of the PEG grammar. It has some hacks (see the `not_*`
variables) to work around specific instances of the general problem
with ordered choice described above but that is not an acceptable
long term solution in my opinion.

Generating the oracle for the fuzz test automatically from the PEG
makes the oracle correct by construction and gives us a single source of
truth: the PEG definition in the language spec.
2026-07-08 11:48:57 +02:00
Isaac Freund
8229720726
langref: move grammar.peg to separate file
This improves the developer experience, especially with the new
gen_parser_oracle tool. My intent is for doc/langref/grammar.peg
to be the single source of truth, at least until we have an actual
language spec.

The separate copy in the separate zig-spec repo should not be considered
canonical as it is not tested against by CI.
2026-07-08 11:48:57 +02:00
Alex Rønne Petersen
3e6b2c6b03
std.Target: fix definition of generic_la64 CPU model
LLVM's generic_la64 model is clearly biased towards Loongson's current offerings
rather than actually reflecting a generic model in the architectural sense. So
fix it up on our side.
2026-07-06 23:27:58 +02:00
Linus Groh
2f7e082381 libc: Add missing macOS mach-o headers 2026-07-03 13:17:25 +02:00
Ali Cheraghi
be7634b828 Target.spirv: omit Linkage and friends caps/ext from cpu features
Keeping these in cpu features can cause conflict because these are automatically emitted by linker. Closes #35975
2026-06-30 11:58:33 +03:30
Ali Cheraghi
85b0259307 Target: chain spirv versions 2026-06-28 18:25:43 +02:00
Andrew Kelley
072534bb2a std.hash.crc: restore auto-generated status 2026-06-26 16:13:19 -07:00
Andrew Kelley
c646f0e182 std.hash.crc: embrace standard names 2026-06-26 16:07:53 -07:00
Andrew Kelley
030e7d3567 std.hash.crc: restore auto-generated status 2026-06-26 16:07:53 -07:00
David Rubin
2e1b172850 codegen: fix x86-64 backend crc32 inline asm 2026-06-24 02:12:43 -05:00
David Rubin
874b6e39db hash: implement fast crc32c 2026-06-24 02:12:43 -05:00
Ali Cheraghi
3a48f4bb40 spirv: drive capability and extension emission from target features
- Emitting `OpCapability` and `OpExtension` from assembly is no longer allowed (tbh it never was because we silently ignored them).
  They now `fail` with a message pointing users at `-mcpu`.

- `tools/gen_spirv_spec.zig` now also emits `Extension` and the `Capability.dependencies()`.
  Also To keep the feature set a reasonable size, the generator filters to an allowlist of `KHR` and `EXT` entries.
  We can decide which vendors to allow later if a use-case is found.

- `tools/update_cpu_features.zig` now uses the generated `spec.zig` and emits a  feature for every
  capability and extension, with the capability's `.deps` populated from `Capability.dependencies()`.

- `Module.finalize`, `Module.entryPoints`, `Module.addCapability`, `Module.addExtension`
  and `sections.capabilities`/`sections.extensions` are deleted.

- Linker now verifies that an `.spv` object declares the `Linkage` capability
2026-06-20 09:38:20 +02:00
Leon Lombar
84f84267c7 std.Target: add PSX
Adds target info for the PSX. Builds fine with the following:
```zig
const target = b.resolveTargetQuery(.{
    .os_tag = .psx,
    .cpu_arch = .mipsel,
});
```
the only "problem" being that it spits out an error from LLVM even
though generating an object file succeeds:
```sh
❯ zig build
install
└─ install generated to main.o
   └─ compile obj obj Debug mipsel-psx failure
error: warning: MIPS-I support is experimental
```
2026-06-19 04:22:55 +02:00
Ryan Liptak
a851256a98 mingw: Only preprocess .def.in files
The .def files don't have any preprocessor commands so running them through the preprocessor is useless work.
2026-06-17 20:07:43 -07:00
Arthur Teixeira
0b22111bc9 MinGW: remove dependency on a C preprocessor for MinGW .def.in files (#35679)
closes #31955

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35679
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
2026-06-18 00:01:17 +02:00
David Senoner
37651eea89
Replace usages of AutoArrayHashMapUnmanaged with array_hash_map.Auto 2026-06-10 16:14:58 +02:00
Alex Rønne Petersen
9475ff8a89
std.os.linux: generate syscalls for hppa, microblaze, sh 2026-06-04 15:15:14 +02:00
Krzysztof Wolicki
9e80795623
all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
Alex Rønne Petersen
f3a7a4c5e2 Merge pull request 'NetBSD 11.0 cross libc support' (#35464) from alexrp/zig:netbsd-11 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35464
2026-05-26 20:55:53 +02:00
Alex Rønne Petersen
1e2bac6153
libc: update NetBSD headers to 11.0 2026-05-26 15:40:40 +02:00
Alex Rønne Petersen
66bcba6b9d
drop powerpc-netbsd-eabi target support
Turns out this target is very poorly supported upstream and doesn't even build
in NetBSD 11, so let's not pretend to support it.
2026-05-26 14:35:23 +02:00
Andrew Kelley
8b4e55372a fix incr-check tests 2026-05-25 18:54:36 -07:00
Andrew Kelley
f414370fba docgen: better error message on failure to read output 2026-05-25 18:54:35 -07:00
Andrew Kelley
6327741b73 doctest: update to newer std.zig API 2026-05-25 18:54:35 -07:00
Stephen Gregoratto
a9b7df4ca2
Linux: Map Alpha getx*id to their regularly named versions
These syscalls also store the value of `euid/egid/ppid` in `r20`, but
are otherwise the same.
2026-05-23 06:15:24 +02:00
Mai-Lapyst
7534ac7367
Adding more support for DEC Alpha to std
This adds support to std, primarily for linux, to support the Alpha architecture.

closes #30940
closes #30926
2026-05-23 06:15:24 +02:00
Alex Rønne Petersen
c717b0d08d
std.Target: add spacemit_x100 and spacemit_a100 RISC-V CPU models
Backported from LLVM main branch.
2026-05-22 21:12:45 +02:00