Commit Graph

34915 Commits

Author SHA1 Message Date
a61bf83a11 parser: add block, break, grouped expression, array type tests
Port tests from upstream parser_test.zig:
- "allow empty line before comment at start of block"
- "comptime struct field"
- "break from block"
- "grouped expressions (parentheses)"
- "array types last token"

Fix bugs in parser.c:
- parseBreakLabel: use null_token instead of null_node
- test decl: use null_token for unnamed tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:04 +00:00
b186471328 parser: add container declaration and test decl tests
Port tests from upstream parser_test.zig:
- "container declaration, one item, multi line trailing comma"
- "container declaration, no trailing comma on separate line"
- "container declaration, line break, no trailing comma"
- "container declaration, transform trailing comma"
- "container declaration, comment, add trailing comma"
- "container declaration, multiline string, add trailing comma"
- "container declaration, doc comment on member, add trailing comma"
- "remove empty lines at start/end of container decl"

Implement in parser.c:
- Test declarations in parseContainerMembers
- Comptime block/var statements in expectStatement
- Variable declaration with initializer in expectVarDeclExprStatement
- Regular assignment expressions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:03 +00:00
8d193346e8 parser: add multiline string, empty file, field, container tests
Port tests from upstream parser_test.zig:
- "multiline string mixed with comments"
- "empty file"
- "file ends in comment"
- "file ends in multi line comment"
- "file ends in comment after var decl"
- "top-level fields"
- "container declaration, single line"

Implement in parser.c:
- parseSuffixOp: array access, field access, deref, unwrap optional
- Slice/array type parsing in parseTypeExpr
- Multiline string literal parsing

Fix zigData mapping in parser_test.zig:
- optional_type uses .node (not .opt_node)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:03 +00:00
298b347cf7 parser: add function, comptime, var declaration tests
Port tests from upstream parser_test.zig:
- "respect line breaks before functions"
- "simple top level comptime block"
- "two spaced line comments before decl"
- "respect line breaks after var declarations"

Implement in parser.c:
- parseSuffixOp: array access (a[i]), field access (a.b),
  deref (a.*), unwrap optional (a.?)
- Multiline string literal parsing
- Slice types ([]T, [:s]T) and array types ([N]T, [N:s]T)
- Fix comptime block main_token in parseContainerMembers

Fix zigData mapping in parser_test.zig:
- field_access, unwrap_optional use node_and_token (not node_and_node)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:03 +00:00
0433771b3e parser: add struct field value declaration test
Port "zig fmt: respect line breaks in struct field value declaration"
test from upstream parser_test.zig.

Implement in parser.c:
- Slice types ([]T, [:s]T) in parseTypeExpr
- Array types ([N]T, [N:s]T) in parseTypeExpr
- Multiline string literals in parsePrimaryTypeExpr
- Add comments explaining why const/volatile/allowzero pointer
  modifiers are consumed (not stored in AST; renderer re-derives
  them from token positions)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:03 +00:00
1bb921b8ca parser: add tuple struct test and container decl support
Port "zig fmt: tuple struct" test from upstream parser_test.zig.

Implement in parser.c:
- parseContainerDeclAuto: struct/enum/union/opaque declarations
- parseGlobalVarDecl: const/var with initializer
- parseByteAlign: align(expr) parsing
- parseTypeExpr: pointer types (*T), optional types (?T)
- parsePrimaryTypeExpr: number_literal, char_literal,
  unreachable_literal, fn proto, grouped expressions,
  container decl, comptime prefix
- expectContainerField: default values (= expr)
- parseContainerMembers: comptime block/field handling
- Fix parseFnProto: use null_token instead of null_node

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:02 +00:00
745b38fde2 zig build does more and in parallel 2026-02-11 14:40:02 +00:00
3750469dca update license 2026-02-11 14:40:02 +00:00
cb8d46b1ab fix tcc 2026-02-10 11:35:41 +00:00
00db079347 zig build -Dcc=tcc 2026-02-10 10:47:27 +00:00
f08f4404ed zig build lint fmt 2026-02-10 10:36:40 +00:00
2948cfd7cf zig 0.15.1
With opus 4.6
2026-02-10 10:03:44 +00:00
Andrew Kelley
e4cbd752c8 Release 0.15.2 2025-10-10 20:45:47 -07:00
Andrew Kelley
f559107fee use older std.mem function names
Cherry-picked bug fix was using renamed functions
2025-10-09 12:46:55 -07:00
marximimus
ca59ad658f std.crypto.tls.Client: fix infinite loop in std.Io.Writer.writeAll 2025-10-09 12:35:19 -07:00
Andrew Kelley
8ccca8472a std.fs.File.Reader.seekTo: fix one more logical position bug 2025-10-09 12:08:45 -07:00
Andrew Kelley
6a25bfc475 std.Io.Reader: rework peekDelimiterInclusive
Now it's based on calling fillMore rather than an illegal aliased stream
into the Reader buffer.

This commit also includes a disambiguation block inspired by #25162. If
`StreamTooLong` was added to `RebaseError` then this logic could be
replaced by removing the exit condition from the while loop. That error
code would represent when `buffer` capacity is too small for an
operation, replacing the current use of asserts.
2025-10-09 12:08:36 -07:00
whatisaphone
52730f3f21 Fix Reader.Limited end of stream conditions 2025-10-09 12:08:29 -07:00
Maciej 'vesim' Kuliński
6682ff2e85 std: std.fs.File fix sendFile with buffered data
fixes #25196

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2025-10-09 12:08:17 -07:00
mlugg
f661ab6c36 std.Io.Reader: fix delimiter bugs
Fix `takeDelimiter` and `takeDelimiterExclusive` tossing too many bytes
(#25132)

Also add/improve test coverage for all delimiter and sentinel methods,
update usages of `takeDelimiterExclusive` to not rely on the fixed bug,
tweak a handful of doc comments, and slightly simplify some logic.

I have not fixed #24950 in this commit because I am a little less
certain about the appropriate solution there.

Resolves: #25132

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2025-10-09 12:08:03 -07:00
Andrew Kelley
9ea4d9aa3b std: fix sendFileReading not accounting for buffer
Related to 1d764c1fdf04829cec5974d82cec901825a80e49

Test case provided by:

Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-09 12:06:32 -07:00
Andrew Kelley
5c0ac90721 std: fix File.Writer sendfile with buffered contents
* File.Writer.seekBy passed wrong offset to setPosAdjustingBuffer.
* File.Writer.sendFile incorrectly used non-logical position.

Related to 1d764c1fdf04829cec5974d82cec901825a80e49

Test case provided by:

Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-09 12:04:10 -07:00
Ryan Liptak
acd6ffdf69 Reader.peekDelimiterInclusive: Fix handling of stream implementations that return 0
Previously, the logic in peekDelimiterInclusive (when the delimiter was not found in the existing buffer) used the `n` returned from `r.vtable.stream` as the length of the slice to check, but it's valid for `vtable.stream` implementations to return 0 if they wrote to the buffer instead of `w`. In that scenario, the `indexOfScalarPos` would be given a 0-length slice so it would never be able to find the delimiter.

This commit changes the logic to assume that `r.vtable.stream` can both:
- return 0, and
- modify seek/end (i.e. it's also valid for a `vtable.stream` implementation to rebase)

Also introduces `std.testing.ReaderIndirect` which helps in being able to test against Reader implementations that return 0 from `stream`/`readVec`

Fixes #25428
2025-10-09 12:01:51 -07:00
tehlordvortex
ff16a7c3fa std.Build: duplicate sub_path for LazyPath's dependency variant 2025-10-08 18:12:48 +02:00
Linus Groh
08b2fd46ab std.c: Add missing SIG constants for serenity 2025-10-06 23:29:11 +02:00
Alex Rønne Petersen
bc7cdc2b6b libcxxabi: don't build cxa_noexception.cpp if exceptions are enabled 2025-10-06 23:28:58 +02:00
Alex Rønne Petersen
03078bfa41 libcxxabi: sort file list according to upstream CMakeLists.txt 2025-10-06 23:28:52 +02:00
Alex Rønne Petersen
b2591d50c7 libcxxabi: define _LIBCPP_BUILDING_LIBRARY in addition to _LIBCXXABI_BUILDING_LIBRARY 2025-10-06 23:28:39 +02:00
Alex Rønne Petersen
9377cc6eef std.zig.system: handle or1k in getExternalExecutor() 2025-10-06 23:27:20 +02:00
xdBronch
57f45cc87c fix read of undefined in http tests 2025-10-06 23:26:15 +02:00
xdBronch
cfb5350ed4 don't pass zero-length @memset to the backend 2025-10-06 23:26:05 +02:00
Jacob Young
7de67e6802 InternPool: use sequential string indices instead of byte offsets
This allows more bytes to be referenced by a smaller index range.

Closes #22867
Closes #25297
Closes #25339
2025-10-05 00:27:39 -04:00
Jacob Young
2700af2aeb x86_64: fix bool vector init register clobber
Closes #25439
2025-10-03 23:26:21 -04:00
mlugg
e6e93d82b0 Lld: fix implib emit path
Resolves: https://github.com/ziglang/zig/issues/24993
2025-10-02 10:55:16 +02:00
Ryan Liptak
78012b4845 resinator: fix an alignment problem 2025-10-02 00:13:35 +02:00
Jacob
ab6dbfe1a3 translate_c: fix ternary operator output in C macros 2025-10-01 14:23:54 +02:00
Timothy Bess
0795e2b2ef Fix zig build lazy -> eager dependency promotion
Before, this had a subtle ordering bug where duplicate
deps that are specified as both lazy and eager in different
parts of the dependency tree end up not getting fetched
depending on the ordering. I modified it to resubmit lazy
deps that were promoted to eager for fetching so that it will
be around for the builds that expect it to be eager downstream
of this.
2025-10-01 04:36:15 +02:00
Alex Rønne Petersen
4fd78f9c26 libcxx: respond to some feature macro changes in LLVM 20
ba87515fea

closes #25376
2025-09-28 15:31:22 +02:00
Alex Rønne Petersen
ebaec8e03f test: remove pie test case from test-standalone
We already have test/cases/pie_linux.zig covering this.
2025-09-28 08:19:49 +02:00
Andrew Kelley
135f1915da Compilation: --debug-rt always Debug
--debug-rt previously would make rt libs match the root module. Now they
are always debug when --debug-rt is passed. This includes compiler-rt,
fuzzer lib, and others.
2025-09-28 08:19:39 +02:00
Ryan Liptak
c40dbd6ff0 Update descriptions of -f[no-]error-tracing to match the actual behavior
Before https://github.com/ziglang/zig/pull/18160, error tracing defaulted to true in ReleaseSafe, but that is no longer the case. These option descriptions were never updating accordingly.
2025-09-28 08:18:45 +02:00
Michael Neumann
65af34b1bf bootstrap: Add support for DragonFly 2025-09-28 08:18:37 +02:00
Michael Neumann
8b5e4e032b lib/std/c: sync "struct stat" for DragonFly
* Add missing functions like ISDIR() or ISREG(). This is required to
  build the zig compiler

* Use octal notation for the S_ constants. This is how it is done for
  ".freebsd" and it is also the notation used by DragonFly in
  "sys/stat.h"

* Reorder S_ constants in the same order as ".freebsd" does. Again, this
  follows the ordering within "sys/stat.h"
2025-09-28 08:18:31 +02:00
Alex Rønne Petersen
6b1d94c539 musl: add missing fenv C dummy functions for loongarch64-linux-muslsf
https://www.openwall.com/lists/musl/2025/09/27/1

closes #25367
2025-09-28 08:18:18 +02:00
Alex Rønne Petersen
a1c410d512 Revert "x86_64: improve support for large enums"
This reverts commit 8520e4e286.
2025-09-26 00:19:47 +02:00
Jacob Young
8520e4e286 x86_64: improve support for large enums
Closes #25247
2025-09-25 07:44:58 +02:00
taylor.fish
9f2a200a3f Fix PowerPC restore_rt
Clang fails to compile the CBE translation of this code ("non-ASM
statement in naked function"). Similar to the implementations of
`restore_rt` on x86 and ARM, when the CBE is in use, this commit employs
alternative inline assembly that avoids using non-immediate input
operands.
2025-09-25 03:58:58 +02:00
Jacob Young
a430be097b x86_64: support more in/out forms
Closes #25303
2025-09-25 01:11:05 +02:00
taylor.fish
427f0025db Fix PowerPC syscalls causing invalid code from CBE
Fixes #25209.

On PowerPC, some registers are both inputs to syscalls and clobbered by
them. An example is r0, which initially contains the syscall number, but
may be overwritten during execution of the syscall.

musl and glibc use a `+` (read-write) constraint to indicate this, which
isn't supported in Zig. The current implementation of PowerPC syscalls
in the Zig standard library instead lists these registers as both inputs
and clobbers, but this results in the C backend generating code that is
invalid for at least some C compilers, like GCC, which doesn't support
the specifying the same register as both an input and a clobber.

This PR changes the PowerPC syscall functions to list such registers as
inputs and outputs rather than inputs and clobbers. Thanks to jacobly0
who pointed out that it's possible to have multiple outputs; I had
gotten the wrong idea from the documentation.
2025-09-24 03:50:34 +02:00
Kyle Schwarz
1f0cf7c551 glibc: guard inet-fortified.h 2025-09-24 03:50:29 +02:00