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

Commit ff9c659

Browse files
committed
update zig sources to 0.16.0-dev.312+164c598cd
closes #243
1 parent 72469a0 commit ff9c659

File tree

1,127 files changed

+10336
-4956
lines changed

Some content is hidden

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

1,127 files changed

+10336
-4956
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 21.1.0
1212
* zlib 1.3.1
1313
* zstd 1.5.2
14-
* zig 0.16.0-dev.157+7fdd60df1
14+
* zig 0.16.0-dev.312+164c598cd
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.16.0-dev.157+7fdd60df1"
10+
ZIG_VERSION="0.16.0-dev.312+164c598cd"
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.16.0-dev.157+7fdd60df1"
39+
set ZIG_VERSION="0.16.0-dev.312+164c598cd"
4040
set JOBS_ARG=
4141

4242
pushd %ROOTDIR%

zig/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Ensure you have the required dependencies:
4747

4848
* CMake >= 3.15
4949
* System C/C++ Toolchain
50-
* LLVM, Clang, LLD development libraries == 20.x
50+
* LLVM, Clang, LLD development libraries == 21.x
5151

5252
Then it is the standard CMake build process:
5353

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.16.0-dev.157+7fdd60df1";
126+
const char *zig_version = "0.16.0-dev.312+164c598cd";
127127

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

zig/build.zig

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn build(b: *std.Build) !void {
9191
const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
9292
const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;
9393
const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;
94-
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
94+
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse skip_translate_c;
9595
const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;
9696
const skip_netbsd = b.option(bool, "skip-netbsd", "Main test suite skips targets with netbsd OS") orelse false;
9797
const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;
@@ -464,25 +464,27 @@ pub fn build(b: *std.Build) !void {
464464
.max_rss = 4000000000,
465465
}));
466466

467-
test_modules_step.dependOn(tests.addModuleTests(b, .{
468-
.test_filters = test_filters,
469-
.test_target_filters = test_target_filters,
470-
.test_extra_targets = test_extra_targets,
471-
.root_src = "test/c_import.zig",
472-
.name = "c-import",
473-
.desc = "Run the @cImport tests",
474-
.optimize_modes = optimization_modes,
475-
.include_paths = &.{"test/c_import"},
476-
.skip_single_threaded = true,
477-
.skip_non_native = skip_non_native,
478-
.skip_freebsd = skip_freebsd,
479-
.skip_netbsd = skip_netbsd,
480-
.skip_windows = skip_windows,
481-
.skip_macos = skip_macos,
482-
.skip_linux = skip_linux,
483-
.skip_llvm = skip_llvm,
484-
.skip_libc = skip_libc,
485-
}));
467+
if (!skip_translate_c) {
468+
test_modules_step.dependOn(tests.addModuleTests(b, .{
469+
.test_filters = test_filters,
470+
.test_target_filters = test_target_filters,
471+
.test_extra_targets = test_extra_targets,
472+
.root_src = "test/c_import.zig",
473+
.name = "c-import",
474+
.desc = "Run the @cImport tests",
475+
.optimize_modes = optimization_modes,
476+
.include_paths = &.{"test/c_import"},
477+
.skip_single_threaded = true,
478+
.skip_non_native = skip_non_native,
479+
.skip_freebsd = skip_freebsd,
480+
.skip_netbsd = skip_netbsd,
481+
.skip_windows = skip_windows,
482+
.skip_macos = skip_macos,
483+
.skip_linux = skip_linux,
484+
.skip_llvm = skip_llvm,
485+
.skip_libc = skip_libc,
486+
}));
487+
}
486488

487489
test_modules_step.dependOn(tests.addModuleTests(b, .{
488490
.test_filters = test_filters,
@@ -568,13 +570,13 @@ pub fn build(b: *std.Build) !void {
568570
unit_tests.root_module.addOptions("build_options", exe_options);
569571
unit_tests_step.dependOn(&b.addRunArtifact(unit_tests).step);
570572

571-
test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
572573
test_step.dependOn(tests.addStandaloneTests(
573574
b,
574575
optimization_modes,
575576
enable_macos_sdk,
576577
enable_ios_sdk,
577578
enable_symlinks_windows,
579+
skip_translate_c,
578580
));
579581
test_step.dependOn(tests.addCAbiTests(b, .{
580582
.test_target_filters = test_target_filters,
@@ -590,7 +592,6 @@ pub fn build(b: *std.Build) !void {
590592
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
591593
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
592594
test_step.dependOn(tests.addCliTests(b));
593-
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
594595
if (tests.addDebuggerTests(b, .{
595596
.test_filters = test_filters,
596597
.test_target_filters = test_target_filters,

zig/doc/langref.html.in

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,14 @@ or
19691969
</p>
19701970
{#see_also|@splat|@shuffle|@select|@reduce#}
19711971

1972+
{#header_open|Relationship with Arrays#}
1973+
<p>Vectors and {#link|Arrays#} each have a well-defined <strong>bit layout</strong>
1974+
and therefore support {#link|@bitCast#} between each other. {#link|Type Coercion#} implicitly peforms
1975+
{#syntax#}@bitCast{#endsyntax#}.</p>
1976+
<p>Arrays have well-defined byte layout, but vectors do not, making {#link|@ptrCast#} between
1977+
them {#link|Illegal Behavior#}.</p>
1978+
{#header_close#}
1979+
19721980
{#header_open|Destructuring Vectors#}
19731981
<p>
19741982
Vectors can be destructured:
@@ -2496,6 +2504,7 @@ or
24962504
{#header_open|packed union#}
24972505
<p>A {#syntax#}packed union{#endsyntax#} has well-defined in-memory layout and is eligible
24982506
to be in a {#link|packed struct#}.</p>
2507+
<p>All fields in a packed union must have the same {#link|@bitSizeOf#}.</p>
24992508
{#header_close#}
25002509

25012510
{#header_open|Anonymous Union Literals#}
@@ -4888,8 +4897,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48884897
{#header_open|@fieldParentPtr#}
48894898
<pre>{#syntax#}@fieldParentPtr(comptime field_name: []const u8, field_ptr: *T) anytype{#endsyntax#}</pre>
48904899
<p>
4891-
Given a pointer to a struct field, returns a pointer to the struct containing that field.
4892-
The return type (and struct in question) is the inferred result type.
4900+
Given a pointer to a struct or union field, returns a pointer to the struct or union containing that field.
4901+
The return type (pointer to the parent struct or union in question) is the inferred result type.
48934902
</p>
48944903
<p>
48954904
If {#syntax#}field_ptr{#endsyntax#} does not point to the {#syntax#}field_name{#endsyntax#} field of an instance of
@@ -6277,10 +6286,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
62776286
</li>
62786287
<li>Are you linking libc? In this case, {#syntax#}std.heap.c_allocator{#endsyntax#} is likely
62796288
the right choice, at least for your main allocator.</li>
6280-
<li>
6281-
Need to use the same allocator in multiple threads? Use one of your choice
6282-
wrapped around {#syntax#}std.heap.ThreadSafeAllocator{#endsyntax#}
6283-
</li>
62846289
<li>
62856290
Is the maximum number of bytes that you will need bounded by a number known at
62866291
{#link|comptime#}? In this case, use {#syntax#}std.heap.FixedBufferAllocator{#endsyntax#}.
@@ -6290,7 +6295,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
62906295
cyclical pattern (such as a video game main loop, or a web server request handler),
62916296
such that it would make sense to free everything at once at the end?
62926297
In this case, it is recommended to follow this pattern:
6293-
{#code|cli_allocation.zig#}
6298+
{#code|cli_allocation.zig#}
62946299

62956300
When using this kind of allocator, there is no need to free anything manually. Everything
62966301
gets freed at once with the call to {#syntax#}arena.deinit(){#endsyntax#}.
@@ -6313,14 +6318,18 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
63136318
</li>
63146319
<li>
63156320
Finally, if none of the above apply, you need a general purpose allocator.
6316-
Zig's general purpose allocator is available as a function that takes a {#link|comptime#}
6317-
{#link|struct#} of configuration options and returns a type.
6318-
Generally, you will set up one {#syntax#}std.heap.GeneralPurposeAllocator{#endsyntax#} in
6319-
your main function, and then pass it or sub-allocators around to various parts of your
6321+
If you are in Debug mode, {#syntax#}std.heap.DebugAllocator{#endsyntax#} is available as a
6322+
function that takes a {#link|comptime#} {#link|struct#} of configuration options and returns a type.
6323+
Generally, you will set up exactly one in your main function, and
6324+
then pass it or sub-allocators around to various parts of your
63206325
application.
63216326
</li>
63226327
<li>
6323-
You can also consider {#link|Implementing an Allocator#}.
6328+
If you are compiling in ReleaseFast mode, {#syntax#}std.heap.smp_allocator{#endsyntax#} is
6329+
a solid choice for a general purpose allocator.
6330+
</li>
6331+
<li>
6332+
You can also consider implementing an allocator.
63246333
</li>
63256334
</ol>
63266335
{#header_close#}
@@ -6355,17 +6364,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
63556364
<p>TODO: thread local variables</p>
63566365
{#header_close#}
63576366

6358-
{#header_open|Implementing an Allocator#}
6359-
<p>Zig programmers can implement their own allocators by fulfilling the Allocator interface.
6360-
In order to do this one must read carefully the documentation comments in std/mem.zig and
6361-
then supply a {#syntax#}allocFn{#endsyntax#} and a {#syntax#}resizeFn{#endsyntax#}.
6362-
</p>
6363-
<p>
6364-
There are many example allocators to look at for inspiration. Look at std/heap.zig and
6365-
{#syntax#}std.heap.GeneralPurposeAllocator{#endsyntax#}.
6366-
</p>
6367-
{#header_close#}
6368-
63696367
{#header_open|Heap Allocation Failure#}
63706368
<p>
63716369
Many programming languages choose to handle the possibility of heap allocation failure by

zig/doc/langref/destructuring_block.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub fn main() void {
1515
break :blk .{ min, max };
1616
};
1717

18-
print("min = {}", .{ min });
19-
print("max = {}", .{ max });
18+
print("min = {}\n", .{ min });
19+
print("max = {}\n", .{ max });
2020
}
2121

2222
// exe=succeed

zig/doc/langref/runtime_shrExact_overflow.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn main() void {
77
const y = @shrExact(x, 2);
88
std.debug.print("value: {}\n", .{y});
99

10-
if (builtin.cpu.arch.isRISCV() and builtin.zig_backend == .stage2_llvm) @panic("https://github.com/ziglang/zig/issues/24304");
10+
if ((builtin.cpu.arch.isRISCV() or builtin.cpu.arch.isLoongArch()) and builtin.zig_backend == .stage2_llvm) @panic("https://github.com/ziglang/zig/issues/24304");
1111
}
1212

1313
// exe=fail

zig/doc/langref/test_vector.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test "Basic vector usage" {
1717
}
1818

1919
test "Conversion between vectors, arrays, and slices" {
20-
// Vectors and fixed-length arrays can be automatically assigned back and forth
20+
// Vectors can be coerced to arrays, and vice versa.
2121
const arr1: [4]f32 = [_]f32{ 1.1, 3.2, 4.5, 5.6 };
2222
const vec: @Vector(4, f32) = arr1;
2323
const arr2: [4]f32 = vec;

0 commit comments

Comments
 (0)