Skip to content

update zig sources to 0.14.0-dev.2246+bfcf18c5a #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ to find and inspect the patch diffs.
* LLVM, LLD, Clang 19.1.0
* zlib 1.3.1
* zstd 1.5.2
* zig 0.14.0-dev.1876+41dbd0d0d
* zig 0.14.0-dev.2246+bfcf18c5a

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

Expand Down Expand Up @@ -96,16 +96,16 @@ is more portable across Linux distributions.
|----------------------------|----------------|
| `aarch64-linux-gnu` | OK |
| `aarch64-linux-musl` | OK |
| `aarch64-macos-none` | [#194](https://github.com/ziglang/zig-bootstrap/issues/194) |
| `aarch64-macos-none` | OK |
| `aarch64-windows-gnu` | OK |
| `aarch64_be-linux-gnu` | OK |
| `aarch64_be-linux-musl` | OK |
| `arm-linux-gnueabi` | [#101](https://github.com/ziglang/zig-bootstrap/issues/101) |
| `arm-linux-gnueabihf` | [#102](https://github.com/ziglang/zig-bootstrap/issues/102) |
| `arm-linux-gnueabi` | OK |
| `arm-linux-gnueabihf` | OK |
| `arm-linux-musleabi` | OK |
| `arm-linux-musleabihf` | OK |
| `armeb-linux-gnueabi` | [#96](https://github.com/ziglang/zig-bootstrap/issues/96) |
| `armeb-linux-gnueabihf` | [#97](https://github.com/ziglang/zig-bootstrap/issues/97) |
| `armeb-linux-gnueabi` | OK |
| `armeb-linux-gnueabihf` | OK |
| `armeb-linux-musleabi` | OK |
| `armeb-linux-musleabihf` | OK |
| `loongarch64-linux-gnu` | OK |
Expand Down Expand Up @@ -158,7 +158,6 @@ is more portable across Linux distributions.

#### Other Notable Targets Known to Work

* `aarch64-macos-none` with mcpu value of `apple_a14`.
* `arm-linux-musleabi` with mcpu value of `generic+v6kz`. This produces a
build of Zig that runs on the RPi 1 and RPi Zero.
- If you want to produce a build for this CPU exactly, use `arm1176jzf_s`.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TARGET="$1" # Example: riscv64-linux-gnu
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`

ROOTDIR="$(pwd)"
ZIG_VERSION="0.14.0-dev.1876+41dbd0d0d"
ZIG_VERSION="0.14.0-dev.2246+bfcf18c5a"

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

Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if "%VSCMD_ARG_HOST_ARCH%"=="x86" set OUTDIR=out-win-x86

set ROOTDIR=%~dp0
set "ROOTDIR_CMAKE=%ROOTDIR:\=/%"
set ZIG_VERSION="0.14.0-dev.1876+41dbd0d0d"
set ZIG_VERSION="0.14.0-dev.2246+bfcf18c5a"
set JOBS_ARG=

pushd %ROOTDIR%
Expand Down
22 changes: 5 additions & 17 deletions zig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ set(ZIG_STAGE2_SOURCES
lib/std/Target.zig
lib/std/Target/Query.zig
lib/std/Target/aarch64.zig
lib/std/Target/amdgpu.zig
lib/std/Target/amdgcn.zig
lib/std/Target/arm.zig
lib/std/Target/avr.zig
lib/std/Target/bpf.zig
Expand Down Expand Up @@ -522,6 +522,7 @@ set(ZIG_STAGE2_SOURCES
src/Sema.zig
src/Sema/bitcast.zig
src/Sema/comptime_ptr_access.zig
src/ThreadSafeQueue.zig
src/Type.zig
src/Value.zig
src/Zcu.zig
Expand Down Expand Up @@ -591,30 +592,25 @@ set(ZIG_STAGE2_SOURCES
src/link.zig
src/link/C.zig
src/link/Coff.zig
src/link/Coff/Atom.zig
src/link/Coff/ImportTable.zig
src/link/Coff/Object.zig
src/link/Coff/Relocation.zig
src/link/Coff/lld.zig
src/link/Dwarf.zig
src/link/Elf.zig
src/link/Elf/Archive.zig
src/link/Elf/Atom.zig
src/link/Elf/AtomList.zig
src/link/Elf/LdScript.zig
src/link/Elf/LinkerDefined.zig
src/link/Elf/Merge.zig
src/link/Elf/Object.zig
src/link/Elf/SharedObject.zig
src/link/Elf/Symbol.zig
src/link/Elf/Thunk.zig
src/link/Elf/ZigObject.zig
src/link/Elf/eh_frame.zig
src/link/Elf/file.zig
src/link/Elf/gc.zig
src/link/Elf/merge_section.zig
src/link/Elf/relocatable.zig
src/link/Elf/relocation.zig
src/link/Elf/synthetic_sections.zig
src/link/Elf/Thunk.zig
src/link/LdScript.zig
src/link/MachO.zig
src/link/MachO/Archive.zig
src/link/MachO/Atom.zig
Expand Down Expand Up @@ -652,12 +648,9 @@ set(ZIG_STAGE2_SOURCES
src/link/StringTable.zig
src/link/Wasm.zig
src/link/Wasm/Archive.zig
src/link/Wasm/Atom.zig
src/link/Wasm/Object.zig
src/link/Wasm/Symbol.zig
src/link/Wasm/ZigObject.zig
src/link/Wasm/file.zig
src/link/Wasm/types.zig
src/link/aarch64.zig
src/link/riscv.zig
src/link/table_section.zig
Expand Down Expand Up @@ -834,11 +827,6 @@ else()
endif()
endif()

option(ZIG2_NO_RTLIB "Build zig2 without linking to a compiler runtime library (for `zig cc` only)" OFF)
if(ZIG2_NO_RTLIB)
set(ZIG2_LINK_FLAGS "${ZIG2_LINK_FLAGS} -rtlib=none")
endif()

set(ZIG1_WASM_MODULE "${PROJECT_SOURCE_DIR}/stage1/zig1.wasm")
set(ZIG1_C_SOURCE "${PROJECT_BINARY_DIR}/zig1.c")
set(ZIG2_C_SOURCE "${PROJECT_BINARY_DIR}/zig2.c")
Expand Down
2 changes: 1 addition & 1 deletion zig/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int main(int argc, char **argv) {
if (f == NULL)
panic("unable to open config.zig for writing");

const char *zig_version = "0.14.0-dev.1876+41dbd0d0d";
const char *zig_version = "0.14.0-dev.2246+bfcf18c5a";

int written = fprintf(f,
"pub const have_llvm = false;\n"
Expand Down
31 changes: 14 additions & 17 deletions zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,17 @@ pub fn build(b: *std.Build) !void {
const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files;
const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false;
const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false;
const enable_tidy = b.option(bool, "enable-tidy", "Check langref output HTML validity") orelse false;
const enable_superhtml = b.option(bool, "enable-superhtml", "Check langref output HTML validity") orelse false;

const langref_file = generateLangRef(b);
const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html");
const check_langref = tidyCheck(b, langref_file);
if (enable_tidy) install_langref.step.dependOn(check_langref);
// Checking autodocs is disabled because tidy gives a false positive:
// line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.
// I noticed that `--show-warnings no` still incorrectly causes exit code 1.
// I was unable to find an alternative to tidy.
//const check_autodocs = tidyCheck(b, b.path("lib/docs/index.html"));
if (enable_tidy) {
const check_langref = superHtmlCheck(b, langref_file);
if (enable_superhtml) install_langref.step.dependOn(check_langref);

const check_autodocs = superHtmlCheck(b, b.path("lib/docs/index.html"));
if (enable_superhtml) {
test_step.dependOn(check_langref);
//test_step.dependOn(check_autodocs);
test_step.dependOn(check_autodocs);
}
if (!skip_install_langref) {
b.getInstallStep().dependOn(&install_langref.step);
Expand Down Expand Up @@ -647,7 +644,7 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St
.root_source_file = b.path("src/main.zig"),
.target = options.target,
.optimize = options.optimize,
.max_rss = 7_500_000_000,
.max_rss = 7_800_000_000,
.strip = options.strip,
.sanitize_thread = options.sanitize_thread,
.single_threaded = options.single_threaded,
Expand Down Expand Up @@ -1358,11 +1355,11 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
return docgen_cmd.addOutputFileArg("langref.html");
}

fn tidyCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {
const run_tidy = b.addSystemCommand(&.{
"tidy", "--drop-empty-elements", "no", "-qe",
fn superHtmlCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {
const run_superhtml = b.addSystemCommand(&.{
"superhtml", "check",
});
run_tidy.addFileArg(html_file);
run_tidy.expectExitCode(0);
return &run_tidy.step;
run_superhtml.addFileArg(html_file);
run_superhtml.expectExitCode(0);
return &run_superhtml.step;
}
37 changes: 22 additions & 15 deletions zig/doc/langref.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,7 @@ or
<li>An {#link|enum#} field uses exactly the bit width of its integer tag type.</li>
<li>A {#link|packed union#} field uses exactly the bit width of the union field with
the largest bit width.</li>
<li>Packed structs support equality operators.</li>
</ul>
<p>
This means that a {#syntax#}packed struct{#endsyntax#} can participate
Expand Down Expand Up @@ -2240,6 +2241,12 @@ or
</p>
{#code|test_aligned_struct_fields.zig#}

<p>
Equating packed structs results in a comparison of the backing integer,
and only works for the `==` and `!=` operators.
</p>
{#code|test_packed_struct_equality.zig#}

<p>
Using packed structs with {#link|volatile#} is problematic, and may be a compile error in the future.
For details on this subscribe to
Expand Down Expand Up @@ -4616,7 +4623,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_close#}

{#header_open|@compileLog#}
<pre>{#syntax#}@compileLog(args: ...) void{#endsyntax#}</pre>
<pre>{#syntax#}@compileLog(...) void{#endsyntax#}</pre>
<p>
This function prints the arguments passed to it at compile-time.
</p>
Expand Down Expand Up @@ -4872,6 +4879,13 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
</p>
{#header_close#}

{#header_open|@FieldType#}
<pre>{#syntax#}@FieldType(comptime Type: type, comptime field_name: []const u8) type{#endsyntax#}</pre>
<p>
Given a type and the name of one of its fields, returns the type of that field.
</p>
{#header_close#}

{#header_open|@floatCast#}
<pre>{#syntax#}@floatCast(value: anytype) anytype{#endsyntax#}</pre>
<p>
Expand Down Expand Up @@ -5054,12 +5068,12 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_close#}

{#header_open|@max#}
<pre>{#syntax#}@max(a: T, b: T) T{#endsyntax#}</pre>
<pre>{#syntax#}@max(...) T{#endsyntax#}</pre>
<p>
Returns the maximum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
Takes two or more arguments and returns the biggest value included (the maximum). This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
</p>
<p>
NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned.
NaNs are handled as follows: return the biggest non-NaN value included. If all operands are NaN, return NaN.
</p>
{#see_also|@min|Vectors#}
{#header_close#}
Expand Down Expand Up @@ -5093,12 +5107,12 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_close#}

{#header_open|@min#}
<pre>{#syntax#}@min(a: T, b: T) T{#endsyntax#}</pre>
<pre>{#syntax#}@min(...) T{#endsyntax#}</pre>
<p>
Returns the minimum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
Takes two or more arguments and returns the smallest value included (the minimum). This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise.
</p>
<p>
NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned.
NaNs are handled as follows: return the smallest non-NaN value included. If all operands are NaN, return NaN.
</p>
{#see_also|@max|Vectors#}
{#header_close#}
Expand Down Expand Up @@ -5281,13 +5295,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#see_also|Vectors#}
{#header_close#}

{#header_open|@setAlignStack#}
<pre>{#syntax#}@setAlignStack(comptime alignment: u29) void{#endsyntax#}</pre>
<p>
Ensures that a function will have a stack alignment of at least {#syntax#}alignment{#endsyntax#} bytes.
</p>
{#header_close#}

{#header_open|@setEvalBranchQuota#}
<pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32) void{#endsyntax#}</pre>
<p>
Expand Down Expand Up @@ -5781,7 +5788,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_open|@TypeOf#}
<pre>{#syntax#}@TypeOf(...) type{#endsyntax#}</pre>
<p>
{#syntax#}@TypeOf{#endsyntax#} is a special builtin function that takes any (nonzero) number of expressions
{#syntax#}@TypeOf{#endsyntax#} is a special builtin function that takes any (non-zero) number of expressions
as parameters and returns the type of the result, using {#link|Peer Type Resolution#}.
</p>
<p>
Expand Down
2 changes: 1 addition & 1 deletion zig/doc/langref/builtin.CallModifier struct.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub const CallModifier = enum {
/// If this is not possible, a compile error is emitted instead.
always_tail,

/// Guarantees that the call will inlined at the callsite.
/// Guarantees that the call will be inlined at the callsite.
/// If this is not possible, a compile error is emitted instead.
always_inline,

Expand Down
3 changes: 2 additions & 1 deletion zig/doc/langref/enum_export_error.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export fn entry(foo: Foo) void {
_ = foo;
}

// obj=parameter of type 'enum_export_error.Foo' not allowed in function with calling convention 'C'
// obj=parameter of type 'enum_export_error.Foo' not allowed in function with calling convention 'x86_64_sysv'
// target=x86_64-linux
14 changes: 14 additions & 0 deletions zig/doc/langref/test_packed_struct_equality.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const std = @import("std");
const expect = std.testing.expect;

test "packed struct equality" {
const S = packed struct {
a: u4,
b: u4,
};
const x: S = .{ .a = 1, .b = 2 };
const y: S = .{ .b = 2, .a = 1 };
try expect(x == y);
}

// test
Loading