Skip to content

Commit f790829

Browse files
authored
Merge branch 'master' into langref-packed-structs
2 parents af40751 + aa7d138 commit f790829

File tree

703 files changed

+29002
-23894
lines changed

Some content is hidden

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

703 files changed

+29002
-23894
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Build and Test
4747
run: sh ci/aarch64-linux-release.sh
4848
x86_64-macos-release:
49-
runs-on: "macos-12"
49+
runs-on: "macos-13"
5050
env:
5151
ARCH: "x86_64"
5252
steps:

CMakeLists.txt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,7 @@ set(ZIG_SHARED_LLVM off CACHE BOOL "Prefer linking against shared LLVM libraries
8989
set(ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM libraries")
9090
set(ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib")
9191
set(ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd")
92-
if(APPLE AND ZIG_STATIC)
93-
set(ZIG_STATIC_CURSES on)
94-
else()
95-
set(ZIG_STATIC_CURSES off)
96-
endif()
97-
set(ZIG_STATIC_CURSES ${ZIG_STATIC_CURSES} CACHE BOOL "Prefer linking against static curses")
92+
set(ZIG_STATIC_CURSES OFF CACHE BOOL "Enable static linking against curses")
9893

9994
if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM)
10095
message(SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously")
@@ -376,7 +371,7 @@ set(ZIG_STAGE2_SOURCES
376371
lib/std/Target.zig
377372
lib/std/Target/Query.zig
378373
lib/std/Target/aarch64.zig
379-
lib/std/Target/amdgpu.zig
374+
lib/std/Target/amdgcn.zig
380375
lib/std/Target/arm.zig
381376
lib/std/Target/avr.zig
382377
lib/std/Target/bpf.zig
@@ -522,6 +517,7 @@ set(ZIG_STAGE2_SOURCES
522517
src/Sema.zig
523518
src/Sema/bitcast.zig
524519
src/Sema/comptime_ptr_access.zig
520+
src/ThreadSafeQueue.zig
525521
src/Type.zig
526522
src/Value.zig
527523
src/Zcu.zig
@@ -591,17 +587,11 @@ set(ZIG_STAGE2_SOURCES
591587
src/link.zig
592588
src/link/C.zig
593589
src/link/Coff.zig
594-
src/link/Coff/Atom.zig
595-
src/link/Coff/ImportTable.zig
596-
src/link/Coff/Object.zig
597-
src/link/Coff/Relocation.zig
598-
src/link/Coff/lld.zig
599590
src/link/Dwarf.zig
600591
src/link/Elf.zig
601592
src/link/Elf/Archive.zig
602593
src/link/Elf/Atom.zig
603594
src/link/Elf/AtomList.zig
604-
src/link/Elf/LdScript.zig
605595
src/link/Elf/LinkerDefined.zig
606596
src/link/Elf/Merge.zig
607597
src/link/Elf/Object.zig
@@ -615,6 +605,7 @@ set(ZIG_STAGE2_SOURCES
615605
src/link/Elf/relocatable.zig
616606
src/link/Elf/relocation.zig
617607
src/link/Elf/synthetic_sections.zig
608+
src/link/LdScript.zig
618609
src/link/MachO.zig
619610
src/link/MachO/Archive.zig
620611
src/link/MachO/Atom.zig
@@ -652,12 +643,9 @@ set(ZIG_STAGE2_SOURCES
652643
src/link/StringTable.zig
653644
src/link/Wasm.zig
654645
src/link/Wasm/Archive.zig
655-
src/link/Wasm/Atom.zig
656646
src/link/Wasm/Object.zig
657647
src/link/Wasm/Symbol.zig
658648
src/link/Wasm/ZigObject.zig
659-
src/link/Wasm/file.zig
660-
src/link/Wasm/types.zig
661649
src/link/aarch64.zig
662650
src/link/riscv.zig
663651
src/link/table_section.zig
@@ -834,11 +822,6 @@ else()
834822
endif()
835823
endif()
836824

837-
option(ZIG2_NO_RTLIB "Build zig2 without linking to a compiler runtime library (for `zig cc` only)" OFF)
838-
if(ZIG2_NO_RTLIB)
839-
set(ZIG2_LINK_FLAGS "${ZIG2_LINK_FLAGS} -rtlib=none")
840-
endif()
841-
842825
set(ZIG1_WASM_MODULE "${PROJECT_SOURCE_DIR}/stage1/zig1.wasm")
843826
set(ZIG1_C_SOURCE "${PROJECT_BINARY_DIR}/zig1.c")
844827
set(ZIG2_C_SOURCE "${PROJECT_BINARY_DIR}/zig2.c")

build.zig

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub fn build(b: *std.Build) !void {
168168
const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
169169
const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
170170
const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse (tracy != null);
171+
const tracy_callstack_depth: u32 = b.option(u32, "tracy-callstack-depth", "Declare callstack depth for Tracy data. Does nothing if -Dtracy_callstack is not provided") orelse 10;
171172
const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false;
172173
const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse (enable_llvm or only_c);
173174
const sanitize_thread = b.option(bool, "sanitize-thread", "Enable thread-sanitization") orelse false;
@@ -350,6 +351,7 @@ pub fn build(b: *std.Build) !void {
350351
exe_options.addOption(bool, "enable_tracy", tracy != null);
351352
exe_options.addOption(bool, "enable_tracy_callstack", tracy_callstack);
352353
exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
354+
exe_options.addOption(u32, "tracy_callstack_depth", tracy_callstack_depth);
353355
exe_options.addOption(bool, "value_tracing", value_tracing);
354356
if (tracy) |tracy_path| {
355357
const client_cpp = b.pathJoin(
@@ -442,7 +444,7 @@ pub fn build(b: *std.Build) !void {
442444
test_step.dependOn(check_fmt);
443445

444446
const test_cases_step = b.step("test-cases", "Run the main compiler test cases");
445-
try tests.addCases(b, test_cases_step, test_filters, target, .{
447+
try tests.addCases(b, test_cases_step, test_filters, test_target_filters, target, .{
446448
.skip_translate_c = skip_translate_c,
447449
.skip_run_translated_c = skip_run_translated_c,
448450
}, .{
@@ -541,13 +543,18 @@ pub fn build(b: *std.Build) !void {
541543
enable_ios_sdk,
542544
enable_symlinks_windows,
543545
));
544-
test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release));
546+
test_step.dependOn(tests.addCAbiTests(b, .{
547+
.test_target_filters = test_target_filters,
548+
.skip_non_native = skip_non_native,
549+
.skip_release = skip_release,
550+
}));
545551
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
546552
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
547553
test_step.dependOn(tests.addCliTests(b));
548554
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
549555
if (tests.addDebuggerTests(b, .{
550556
.test_filters = test_filters,
557+
.test_target_filters = test_target_filters,
551558
.gdb = b.option([]const u8, "gdb", "path to gdb binary"),
552559
.lldb = b.option([]const u8, "lldb", "path to lldb binary"),
553560
.optimize_modes = optimization_modes,
@@ -608,6 +615,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
608615
exe_options.addOption(bool, "enable_tracy", false);
609616
exe_options.addOption(bool, "enable_tracy_callstack", false);
610617
exe_options.addOption(bool, "enable_tracy_allocation", false);
618+
exe_options.addOption(u32, "tracy_callstack_depth", 0);
611619
exe_options.addOption(bool, "value_tracing", false);
612620
exe_options.addOption(DevEnv, "dev", .bootstrap);
613621

@@ -644,7 +652,7 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St
644652
.root_source_file = b.path("src/main.zig"),
645653
.target = options.target,
646654
.optimize = options.optimize,
647-
.max_rss = 7_500_000_000,
655+
.max_rss = 7_800_000_000,
648656
.strip = options.strip,
649657
.sanitize_thread = options.sanitize_thread,
650658
.single_threaded = options.single_threaded,
@@ -861,6 +869,10 @@ fn addCxxKnownPath(
861869
}
862870
return error.RequiredLibraryNotFound;
863871
}
872+
// By default, explicit library paths are not checked for being linker scripts,
873+
// but libc++ may very well be one, so force all inputs to be checked when passing
874+
// an explicit path to libc++.
875+
exe.allow_so_scripts = true;
864876
exe.addObjectFile(.{ .cwd_relative = path_unpadded });
865877

866878
// TODO a way to integrate with system c++ include files here

ci/x86_64-linux-debug.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
1212
PREFIX="$HOME/deps/$CACHE_BASENAME"
1313
ZIG="$PREFIX/bin/zig"
1414

15-
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-9.1.0/bin:$HOME/local/bin:$PATH"
15+
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-9.2.0-rc1/bin:$HOME/local/bin:$PATH"
1616

1717
# Make the `zig version` number consistent.
1818
# This will affect the cmake command below.
@@ -64,7 +64,7 @@ stage3-debug/bin/zig build \
6464

6565
stage3-debug/bin/zig build test docs \
6666
--maxrss 21000000000 \
67-
-Dlldb=$HOME/deps/lldb-zig/Debug-6ece8bda1/bin/lldb \
67+
-Dlldb=$HOME/deps/lldb-zig/Debug-bfeada333/bin/lldb \
6868
-fqemu \
6969
-fwasmtime \
7070
-Dstatic-llvm \

ci/x86_64-linux-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
1212
PREFIX="$HOME/deps/$CACHE_BASENAME"
1313
ZIG="$PREFIX/bin/zig"
1414

15-
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-9.1.0/bin:$HOME/local/bin:$PATH"
15+
export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-9.2.0-rc1/bin:$HOME/local/bin:$PATH"
1616

1717
# Make the `zig version` number consistent.
1818
# This will affect the cmake command below.
@@ -64,7 +64,7 @@ stage3-release/bin/zig build \
6464

6565
stage3-release/bin/zig build test docs \
6666
--maxrss 21000000000 \
67-
-Dlldb=$HOME/deps/lldb-zig/Release-6ece8bda1/bin/lldb \
67+
-Dlldb=$HOME/deps/lldb-zig/Release-bfeada333/bin/lldb \
6868
-fqemu \
6969
-fwasmtime \
7070
-Dstatic-llvm \

doc/langref.html.in

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,32 +3056,6 @@ fn createFoo(param: i32) !Foo {
30563056
The {#syntax#}errdefer{#endsyntax#} statement can optionally capture the error:
30573057
</p>
30583058
{#code|test_errdefer_capture.zig#}
3059-
{#header_close#}
3060-
{#header_open|Common errdefer Slip-Ups#}
3061-
<p>
3062-
It should be noted that {#syntax#}errdefer{#endsyntax#} statements only last until the end of the block
3063-
they are written in, and therefore are not run if an error is returned outside of that block:
3064-
</p>
3065-
{#code|test_errdefer_slip_ups.zig#}
3066-
3067-
<p>
3068-
To ensure that {#syntax#}deallocateFoo{#endsyntax#} is properly called
3069-
when returning an error, you must add an {#syntax#}errdefer{#endsyntax#} outside of the block:
3070-
</p>
3071-
{#code|test_errdefer_block.zig#}
3072-
3073-
<p>
3074-
The fact that errdefers only last for the block they are declared in is
3075-
especially important when using loops:
3076-
</p>
3077-
{#code|test_errdefer_loop_leak.zig#}
3078-
3079-
<p>
3080-
Special care must be taken with code that allocates in a loop
3081-
to make sure that no memory is leaked when returning an error:
3082-
</p>
3083-
{#code|test_errdefer_loop.zig#}
3084-
30853059
{#header_close#}
30863060
<p>
30873061
A couple of other tidbits about error handling:
@@ -4883,6 +4857,13 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48834857
</p>
48844858
{#header_close#}
48854859

4860+
{#header_open|@FieldType#}
4861+
<pre>{#syntax#}@FieldType(comptime Type: type, comptime field_name: []const u8) type{#endsyntax#}</pre>
4862+
<p>
4863+
Given a type and the name of one of its fields, returns the type of that field.
4864+
</p>
4865+
{#header_close#}
4866+
48864867
{#header_open|@floatCast#}
48874868
<pre>{#syntax#}@floatCast(value: anytype) anytype{#endsyntax#}</pre>
48884869
<p>
@@ -5292,13 +5273,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
52925273
{#see_also|Vectors#}
52935274
{#header_close#}
52945275

5295-
{#header_open|@setAlignStack#}
5296-
<pre>{#syntax#}@setAlignStack(comptime alignment: u29) void{#endsyntax#}</pre>
5297-
<p>
5298-
Ensures that a function will have a stack alignment of at least {#syntax#}alignment{#endsyntax#} bytes.
5299-
</p>
5300-
{#header_close#}
5301-
53025276
{#header_open|@setEvalBranchQuota#}
53035277
<pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32) void{#endsyntax#}</pre>
53045278
<p>

doc/langref/builtin.CallModifier struct.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub const CallModifier = enum {
2323
/// If this is not possible, a compile error is emitted instead.
2424
always_tail,
2525

26-
/// Guarantees that the call will inlined at the callsite.
26+
/// Guarantees that the call will be inlined at the callsite.
2727
/// If this is not possible, a compile error is emitted instead.
2828
always_inline,
2929

doc/langref/enum_export_error.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export fn entry(foo: Foo) void {
33
_ = foo;
44
}
55

6-
// obj=parameter of type 'enum_export_error.Foo' not allowed in function with calling convention 'C'
6+
// obj=parameter of type 'enum_export_error.Foo' not allowed in function with calling convention 'x86_64_sysv'
7+
// target=x86_64-linux

doc/langref/test_errdefer_block.zig

Lines changed: 0 additions & 42 deletions
This file was deleted.

doc/langref/test_errdefer_loop.zig

Lines changed: 0 additions & 36 deletions
This file was deleted.

doc/langref/test_errdefer_loop_leak.zig

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)