Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 361ccb4

Browse files
committed
update zig sources to 0.16.0-dev.27+83f773fc6
1 parent c6bc939 commit 361ccb4

File tree

170 files changed

+5358
-2313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+5358
-2313
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ to find and inspect the patch diffs.
1111
* LLVM, LLD, Clang 20.1.2
1212
* zlib 1.3.1
1313
* zstd 1.5.2
14-
* zig 0.15.0-dev.1601+c1483eb05
14+
* zig 0.16.0-dev.27+83f773fc6
1515

1616
For other versions, check the git tags of this repository.
1717

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TARGET="$1" # Example: riscv64-linux-gnu
77
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`
88

99
ROOTDIR="$(pwd)"
10-
ZIG_VERSION="0.15.0-dev.1601+c1483eb05"
10+
ZIG_VERSION="0.16.0-dev.27+83f773fc6"
1111

1212
TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu
1313

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if "%VSCMD_ARG_HOST_ARCH%"=="x86" set OUTDIR=out-win-x86
3636

3737
set ROOTDIR=%~dp0
3838
set "ROOTDIR_CMAKE=%ROOTDIR:\=/%"
39-
set ZIG_VERSION="0.15.0-dev.1601+c1483eb05"
39+
set ZIG_VERSION="0.16.0-dev.27+83f773fc6"
4040
set JOBS_ARG=
4141

4242
pushd %ROOTDIR%

zig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ project(zig
3838
)
3939

4040
set(ZIG_VERSION_MAJOR 0)
41-
set(ZIG_VERSION_MINOR 15)
41+
set(ZIG_VERSION_MINOR 16)
4242
set(ZIG_VERSION_PATCH 0)
4343
set(ZIG_VERSION "" CACHE STRING "Override Zig version string. Default is to find out with git.")
4444

zig/bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
123123
if (f == NULL)
124124
panic("unable to open config.zig for writing");
125125

126-
const char *zig_version = "0.15.0-dev.1601+c1483eb05";
126+
const char *zig_version = "0.16.0-dev.27+83f773fc6";
127127

128128
int written = fprintf(f,
129129
"pub const have_llvm = false;\n"

zig/build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = std.debug.assert;
1010
const DevEnv = @import("src/dev.zig").Env;
1111
const ValueInterpretMode = enum { direct, by_name };
1212

13-
const zig_version: std.SemanticVersion = .{ .major = 0, .minor = 15, .patch = 0 };
13+
const zig_version: std.SemanticVersion = .{ .major = 0, .minor = 16, .patch = 0 };
1414
const stack_size = 46 * 1024 * 1024;
1515

1616
pub fn build(b: *std.Build) !void {

zig/doc/langref.html.in

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@
317317
<a href="https://ziglang.org/documentation/0.12.0/">0.12.0</a> |
318318
<a href="https://ziglang.org/documentation/0.13.0/">0.13.0</a> |
319319
<a href="https://ziglang.org/documentation/0.14.1/">0.14.1</a> |
320+
<a href="https://ziglang.org/documentation/0.15.1/">0.15.1</a> |
320321
master
321322
</nav>
322323
<nav aria-labelledby="table-of-contents">
@@ -7803,11 +7804,11 @@ fn readU32Be() u32 {}
78037804
{#header_close#}
78047805

78057806
{#header_open|Grammar#}
7806-
{#syntax_block|peg|grammar.y#}
7807-
Root <- skip container_doc_comment? ContainerMembers eof
7807+
{#syntax_block|peg|grammar.peg#}
7808+
Root <- skip ContainerMembers eof
78087809

78097810
# *** Top level ***
7810-
ContainerMembers <- ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*)
7811+
ContainerMembers <- container_doc_comment? ContainerDeclaration* (ContainerField COMMA)* (ContainerField / ContainerDeclaration*)
78117812

78127813
ContainerDeclaration <- TestDecl / ComptimeDecl / doc_comment? KEYWORD_pub? Decl
78137814

@@ -7836,7 +7837,6 @@ Statement
78367837
/ KEYWORD_errdefer Payload? BlockExprStatement
78377838
/ IfStatement
78387839
/ LabeledStatement
7839-
/ SwitchExpr
78407840
/ VarDeclExprStatement
78417841

78427842
ComptimeStatement
@@ -7847,7 +7847,7 @@ IfStatement
78477847
<- IfPrefix BlockExpr ( KEYWORD_else Payload? Statement )?
78487848
/ IfPrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement )
78497849

7850-
LabeledStatement <- BlockLabel? (Block / LoopStatement)
7850+
LabeledStatement <- BlockLabel? (Block / LoopStatement / SwitchExpr)
78517851

78527852
LoopStatement <- KEYWORD_inline? (ForStatement / WhileStatement)
78537853

@@ -7901,7 +7901,7 @@ PrimaryExpr
79017901
/ KEYWORD_break BreakLabel? Expr?
79027902
/ KEYWORD_comptime Expr
79037903
/ KEYWORD_nosuspend Expr
7904-
/ KEYWORD_continue BreakLabel?
7904+
/ KEYWORD_continue BreakLabel? Expr?
79057905
/ KEYWORD_resume Expr
79067906
/ KEYWORD_return Expr?
79077907
/ BlockLabel? LoopExpr
@@ -7951,7 +7951,6 @@ PrimaryTypeExpr
79517951
/ KEYWORD_anyframe
79527952
/ KEYWORD_unreachable
79537953
/ STRINGLITERAL
7954-
/ SwitchExpr
79557954

79567955
ContainerDecl <- (KEYWORD_extern / KEYWORD_packed)? ContainerDeclAuto
79577956

@@ -7964,6 +7963,7 @@ IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)?
79647963
LabeledTypeExpr
79657964
<- BlockLabel Block
79667965
/ BlockLabel? LoopTypeExpr
7966+
/ BlockLabel? SwitchExpr
79677967

79687968
LoopTypeExpr <- KEYWORD_inline? (ForTypeExpr / WhileTypeExpr)
79697969

@@ -8133,7 +8133,7 @@ PtrTypeStart
81338133
ArrayTypeStart <- LBRACKET Expr (COLON Expr)? RBRACKET
81348134

81358135
# ContainerDecl specific
8136-
ContainerDeclAuto <- ContainerDeclType LBRACE container_doc_comment? ContainerMembers RBRACE
8136+
ContainerDeclAuto <- ContainerDeclType LBRACE ContainerMembers RBRACE
81378137

81388138
ContainerDeclType
81398139
<- KEYWORD_struct (LPAREN Expr RPAREN)?
@@ -8153,8 +8153,6 @@ AsmOutputList <- (AsmOutputItem COMMA)* AsmOutputItem?
81538153

81548154
AsmInputList <- (AsmInputItem COMMA)* AsmInputItem?
81558155

8156-
StringList <- (STRINGLITERAL COMMA)* STRINGLITERAL?
8157-
81588156
ParamDeclList <- (ParamDecl COMMA)* ParamDecl?
81598157

81608158
ExprList <- (Expr COMMA)* Expr?
@@ -8201,7 +8199,7 @@ oxC2_oxDF <- [\302-\337]
82018199
# [0xF1,0xF3] [0x80,0xBF] [0x80,0xBF] [0x80,0xBF]
82028200
# 0xF4 [0x80,0x8F] [0x80,0xBF] [0x80,0xBF]
82038201

8204-
mb_utf8_literal <-
8202+
multibyte_utf8 <-
82058203
oxF4 ox80_ox8F ox80_oxBF ox80_oxBF
82068204
/ oxF1_oxF3 ox80_oxBF ox80_oxBF ox80_oxBF
82078205
/ oxF0 ox90_0xBF ox80_oxBF ox80_oxBF
@@ -8211,46 +8209,47 @@ mb_utf8_literal <-
82118209
/ oxE0 oxA0_oxBF ox80_oxBF
82128210
/ oxC2_oxDF ox80_oxBF
82138211

8214-
ascii_char_not_nl_slash_squote <- [\000-\011\013-\046\050-\133\135-\177]
8212+
non_control_ascii <- [\040-\176]
82158213

82168214
char_escape
82178215
<- "\\x" hex hex
82188216
/ "\\u{" hex+ "}"
82198217
/ "\\" [nr\\t'"]
82208218
char_char
8221-
<- mb_utf8_literal
8219+
<- multibyte_utf8
82228220
/ char_escape
8223-
/ ascii_char_not_nl_slash_squote
8221+
/ ![\\'\n] non_control_ascii
82248222

82258223
string_char
8226-
<- char_escape
8227-
/ [^\\"\n]
8224+
<- multibyte_utf8
8225+
/ char_escape
8226+
/ ![\\"\n] non_control_ascii
82288227

82298228
container_doc_comment <- ('//!' [^\n]* [ \n]* skip)+
82308229
doc_comment <- ('///' [^\n]* [ \n]* skip)+
82318230
line_comment <- '//' ![!/][^\n]* / '////' [^\n]*
8232-
line_string <- ("\\\\" [^\n]* [ \n]*)+
8231+
line_string <- ('\\\\' [^\n]* [ \n]*)+
82338232
skip <- ([ \n] / line_comment)*
82348233

8235-
CHAR_LITERAL <- "'" char_char "'" skip
8234+
CHAR_LITERAL <- ['] char_char ['] skip
82368235
FLOAT
8237-
<- "0x" hex_int "." hex_int ([pP] [-+]? dec_int)? skip
8238-
/ dec_int "." dec_int ([eE] [-+]? dec_int)? skip
8239-
/ "0x" hex_int [pP] [-+]? dec_int skip
8236+
<- '0x' hex_int '.' hex_int ([pP] [-+]? dec_int)? skip
8237+
/ dec_int '.' dec_int ([eE] [-+]? dec_int)? skip
8238+
/ '0x' hex_int [pP] [-+]? dec_int skip
82408239
/ dec_int [eE] [-+]? dec_int skip
82418240
INTEGER
8242-
<- "0b" bin_int skip
8243-
/ "0o" oct_int skip
8244-
/ "0x" hex_int skip
8241+
<- '0b' bin_int skip
8242+
/ '0o' oct_int skip
8243+
/ '0x' hex_int skip
82458244
/ dec_int skip
8246-
STRINGLITERALSINGLE <- "\"" string_char* "\"" skip
8245+
STRINGLITERALSINGLE <- ["] string_char* ["] skip
82478246
STRINGLITERAL
82488247
<- STRINGLITERALSINGLE
82498248
/ (line_string skip)+
82508249
IDENTIFIER
82518250
<- !keyword [A-Za-z_] [A-Za-z0-9_]* skip
8252-
/ "@" STRINGLITERALSINGLE
8253-
BUILTINIDENTIFIER <- "@"[A-Za-z_][A-Za-z0-9_]* skip
8251+
/ '@' STRINGLITERALSINGLE
8252+
BUILTINIDENTIFIER <- '@'[A-Za-z_][A-Za-z0-9_]* skip
82548253

82558254

82568255
AMPERSAND <- '&' ![=] skip

zig/lib/compiler/reduce.zig

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ pub fn main() !void {
114114
interestingness_argv.appendAssumeCapacity(checker_path);
115115
interestingness_argv.appendSliceAssumeCapacity(argv);
116116

117-
var rendered = std.array_list.Managed(u8).init(gpa);
117+
var rendered: std.Io.Writer.Allocating = .init(gpa);
118118
defer rendered.deinit();
119119

120-
var astgen_input = std.array_list.Managed(u8).init(gpa);
120+
var astgen_input: std.Io.Writer.Allocating = .init(gpa);
121121
defer astgen_input.deinit();
122122

123123
var tree = try parse(gpa, root_source_file_path);
@@ -138,10 +138,10 @@ pub fn main() !void {
138138
}
139139
}
140140

141-
var fixups: Ast.Fixups = .{};
141+
var fixups: Ast.Render.Fixups = .{};
142142
defer fixups.deinit(gpa);
143143

144-
var more_fixups: Ast.Fixups = .{};
144+
var more_fixups: Ast.Render.Fixups = .{};
145145
defer more_fixups.deinit(gpa);
146146

147147
var rng = std.Random.DefaultPrng.init(seed);
@@ -188,15 +188,14 @@ pub fn main() !void {
188188
try transformationsToFixups(gpa, arena, root_source_file_path, this_set, &fixups);
189189

190190
rendered.clearRetainingCapacity();
191-
try tree.renderToArrayList(&rendered, fixups);
191+
try tree.render(gpa, &rendered.writer, fixups);
192192

193193
// The transformations we applied may have resulted in unused locals,
194194
// in which case we would like to add the respective discards.
195195
{
196-
try astgen_input.resize(rendered.items.len);
197-
@memcpy(astgen_input.items, rendered.items);
198-
try astgen_input.append(0);
199-
const source_with_null = astgen_input.items[0 .. astgen_input.items.len - 1 :0];
196+
try astgen_input.writer.writeAll(rendered.written());
197+
try astgen_input.writer.writeByte(0);
198+
const source_with_null = astgen_input.written()[0..(astgen_input.written().len - 1) :0];
200199
var astgen_tree = try Ast.parse(gpa, source_with_null, .zig);
201200
defer astgen_tree.deinit(gpa);
202201
if (astgen_tree.errors.len != 0) {
@@ -228,12 +227,12 @@ pub fn main() !void {
228227
}
229228
if (more_fixups.count() != 0) {
230229
rendered.clearRetainingCapacity();
231-
try astgen_tree.renderToArrayList(&rendered, more_fixups);
230+
try astgen_tree.render(gpa, &rendered.writer, more_fixups);
232231
}
233232
}
234233
}
235234

236-
try std.fs.cwd().writeFile(.{ .sub_path = root_source_file_path, .data = rendered.items });
235+
try std.fs.cwd().writeFile(.{ .sub_path = root_source_file_path, .data = rendered.written() });
237236
// std.debug.print("trying this code:\n{s}\n", .{rendered.items});
238237

239238
const interestingness = try runCheck(arena, interestingness_argv.items);
@@ -273,8 +272,8 @@ pub fn main() !void {
273272
// Revert the source back to not be transformed.
274273
fixups.clearRetainingCapacity();
275274
rendered.clearRetainingCapacity();
276-
try tree.renderToArrayList(&rendered, fixups);
277-
try std.fs.cwd().writeFile(.{ .sub_path = root_source_file_path, .data = rendered.items });
275+
try tree.render(gpa, &rendered.writer, fixups);
276+
try std.fs.cwd().writeFile(.{ .sub_path = root_source_file_path, .data = rendered.written() });
278277

279278
return std.process.cleanExit();
280279
}
@@ -318,7 +317,7 @@ fn transformationsToFixups(
318317
arena: Allocator,
319318
root_source_file_path: []const u8,
320319
transforms: []const Walk.Transformation,
321-
fixups: *Ast.Fixups,
320+
fixups: *Ast.Render.Fixups,
322321
) !void {
323322
fixups.clearRetainingCapacity();
324323

@@ -359,7 +358,7 @@ fn transformationsToFixups(
359358
other_file_ast.deinit(gpa);
360359
}
361360

362-
var inlined_fixups: Ast.Fixups = .{};
361+
var inlined_fixups: Ast.Render.Fixups = .{};
363362
defer inlined_fixups.deinit(gpa);
364363
if (std.fs.path.dirname(inline_imported_file.imported_string)) |dirname| {
365364
inlined_fixups.rebase_imported_paths = dirname;
@@ -382,16 +381,16 @@ fn transformationsToFixups(
382381
}
383382
}
384383

385-
var other_source = std.array_list.Managed(u8).init(gpa);
384+
var other_source: std.io.Writer.Allocating = .init(gpa);
386385
defer other_source.deinit();
387-
try other_source.appendSlice("struct {\n");
388-
try other_file_ast.renderToArrayList(&other_source, inlined_fixups);
389-
try other_source.appendSlice("}");
386+
try other_source.writer.writeAll("struct {\n");
387+
try other_file_ast.render(gpa, &other_source.writer, inlined_fixups);
388+
try other_source.writer.writeAll("}");
390389

391390
try fixups.replace_nodes_with_string.put(
392391
gpa,
393392
inline_imported_file.builtin_call_node,
394-
try arena.dupe(u8, other_source.items),
393+
try arena.dupe(u8, other_source.written()),
395394
);
396395
},
397396
};

zig/lib/compiler/reduce/Walk.zig

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,10 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
501501
.@"asm",
502502
=> return walkAsm(w, ast.fullAsm(node).?),
503503

504+
.asm_legacy => {
505+
return walkAsmLegacy(w, ast.legacyAsm(node).?);
506+
},
507+
504508
.enum_literal => {
505509
return walkIdentifier(w, ast.nodeMainToken(node)); // name
506510
},
@@ -665,7 +669,7 @@ fn walkStructInit(
665669

666670
fn walkCall(w: *Walk, call: Ast.full.Call) Error!void {
667671
try walkExpression(w, call.ast.fn_expr);
668-
try walkParamList(w, call.ast.params);
672+
try walkExpressions(w, call.ast.params);
669673
}
670674

671675
fn walkSlice(
@@ -830,7 +834,7 @@ fn walkWhile(w: *Walk, node_index: Ast.Node.Index, while_node: Ast.full.While) E
830834
}
831835

832836
fn walkFor(w: *Walk, for_node: Ast.full.For) Error!void {
833-
try walkParamList(w, for_node.ast.inputs);
837+
try walkExpressions(w, for_node.ast.inputs);
834838
try walkExpression(w, for_node.ast.then_expr);
835839
if (for_node.ast.else_expr.unwrap()) |else_expr| {
836840
try walkExpression(w, else_expr);
@@ -874,15 +878,12 @@ fn walkIf(w: *Walk, node_index: Ast.Node.Index, if_node: Ast.full.If) Error!void
874878

875879
fn walkAsm(w: *Walk, asm_node: Ast.full.Asm) Error!void {
876880
try walkExpression(w, asm_node.ast.template);
877-
for (asm_node.ast.items) |item| {
878-
try walkExpression(w, item);
879-
}
881+
try walkExpressions(w, asm_node.ast.items);
880882
}
881883

882-
fn walkParamList(w: *Walk, params: []const Ast.Node.Index) Error!void {
883-
for (params) |param_node| {
884-
try walkExpression(w, param_node);
885-
}
884+
fn walkAsmLegacy(w: *Walk, asm_node: Ast.full.AsmLegacy) Error!void {
885+
try walkExpression(w, asm_node.ast.template);
886+
try walkExpressions(w, asm_node.ast.items);
886887
}
887888

888889
/// Check if it is already gutted (i.e. its body replaced with `@trap()`).

zig/lib/libc/include/wasm-wasi-musl/__macro_PAGESIZE.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
#define __wasilibc___macro_PAGESIZE_h
33

44
/*
5-
* The page size in WebAssembly is fixed at 64 KiB. If this ever changes,
6-
* it's expected that applications will need to opt in, so we can change
7-
* this.
5+
* Without custom-page-sizes proposal, the page size in WebAssembly
6+
* is fixed at 64 KiB.
7+
*
8+
* The LLVM versions with a support of custom-page-sizes proposal
9+
* provides __wasm_first_page_end global to allow page-size-agnostic
10+
* objects.
811
*
912
* If this ever needs to be a value outside the range of an `int`, the
1013
* `getpagesize` function which returns this value will need special
1114
* consideration. POSIX has deprecated `getpagesize` in favor of
1215
* `sysconf(_SC_PAGESIZE)` which does not have this problem.
1316
*/
17+
#if __clang_major__ >= 22
18+
extern char __wasm_first_page_end;
19+
#define PAGESIZE ((unsigned long)&__wasm_first_page_end)
20+
#else
1421
#define PAGESIZE (0x10000)
22+
#endif
1523

1624
#endif

0 commit comments

Comments
 (0)