Skip to content

Commit

Permalink
Merge branch 'master' into rehash-again
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 authored Jul 13, 2024
2 parents 218a631 + 959d227 commit aa2e6a2
Show file tree
Hide file tree
Showing 216 changed files with 25,639 additions and 20,625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Build and Test
run: sh ci/aarch64-linux-release.sh
x86_64-macos-release:
runs-on: "macos-11"
runs-on: "macos-12"
env:
ARCH: "x86_64"
steps:
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,10 @@ set(ZIG_STAGE2_SOURCES
src/Sema.zig
src/Sema/bitcast.zig
src/Sema/comptime_ptr_access.zig
src/Type.zig
src/Value.zig
src/Zcu.zig
src/Zcu/PerThread.zig
src/arch/aarch64/CodeGen.zig
src/arch/aarch64/Emit.zig
src/arch/aarch64/Mir.zig
Expand Down Expand Up @@ -673,7 +675,6 @@ set(ZIG_STAGE2_SOURCES
src/target.zig
src/tracy.zig
src/translate_c.zig
src/type.zig
src/wasi_libc.zig
)

Expand Down
39 changes: 11 additions & 28 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@ pub fn build(b: *std.Build) !void {
docs_step.dependOn(langref_step);
docs_step.dependOn(std_docs_step);

const check_case_exe = b.addExecutable(.{
.name = "check-case",
.root_source_file = b.path("test/src/Cases.zig"),
.target = b.graph.host,
.optimize = optimize,
.single_threaded = single_threaded,
});
check_case_exe.stack_size = stack_size;

const skip_debug = b.option(bool, "skip-debug", "Main test suite skips debug builds") orelse false;
const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release;
Expand Down Expand Up @@ -222,7 +213,6 @@ pub fn build(b: *std.Build) !void {
if (target.result.os.tag == .windows and target.result.abi == .gnu) {
// LTO is currently broken on mingw, this can be removed when it's fixed.
exe.want_lto = false;
check_case_exe.want_lto = false;
}

const use_llvm = b.option(bool, "use-llvm", "Use the llvm backend");
Expand All @@ -245,7 +235,6 @@ pub fn build(b: *std.Build) !void {

if (link_libc) {
exe.linkLibC();
check_case_exe.linkLibC();
}

const is_debug = optimize == .Debug;
Expand Down Expand Up @@ -339,21 +328,17 @@ pub fn build(b: *std.Build) !void {
}

try addCmakeCfgOptionsToExe(b, cfg, exe, use_zig_libcxx);
try addCmakeCfgOptionsToExe(b, cfg, check_case_exe, use_zig_libcxx);
} else {
// Here we are -Denable-llvm but no cmake integration.
try addStaticLlvmOptionsToExe(exe);
try addStaticLlvmOptionsToExe(check_case_exe);
}
if (target.result.os.tag == .windows) {
inline for (.{ exe, check_case_exe }) |artifact| {
// LLVM depends on networking as of version 18.
artifact.linkSystemLibrary("ws2_32");
// LLVM depends on networking as of version 18.
exe.linkSystemLibrary("ws2_32");

artifact.linkSystemLibrary("version");
artifact.linkSystemLibrary("uuid");
artifact.linkSystemLibrary("ole32");
}
exe.linkSystemLibrary("version");
exe.linkSystemLibrary("uuid");
exe.linkSystemLibrary("ole32");
}
}

Expand Down Expand Up @@ -394,7 +379,6 @@ pub fn build(b: *std.Build) !void {
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};

const test_cases_options = b.addOptions();
check_case_exe.root_module.addOptions("build_options", test_cases_options);

test_cases_options.addOption(bool, "enable_tracy", false);
test_cases_options.addOption(bool, "enable_debug_extensions", enable_debug_extensions);
Expand Down Expand Up @@ -458,7 +442,7 @@ pub fn build(b: *std.Build) !void {
test_step.dependOn(check_fmt);

const test_cases_step = b.step("test-cases", "Run the main compiler test cases");
try tests.addCases(b, test_cases_step, test_filters, check_case_exe, target, .{
try tests.addCases(b, test_cases_step, test_filters, target, .{
.skip_translate_c = skip_translate_c,
.skip_run_translated_c = skip_run_translated_c,
}, .{
Expand Down Expand Up @@ -611,7 +595,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
run_opt.addArg("-o");
run_opt.addFileArg(b.path("stage1/zig1.wasm"));

const copy_zig_h = b.addWriteFiles();
const copy_zig_h = b.addUpdateSourceFiles();
copy_zig_h.addCopyFileToSource(b.path("lib/zig.h"), "stage1/zig.h");

const update_zig1_step = b.step("update-zig1", "Update stage1/zig1.wasm");
Expand Down Expand Up @@ -1277,7 +1261,9 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
});

var dir = b.build_root.handle.openDir("doc/langref", .{ .iterate = true }) catch |err| {
std.debug.panic("unable to open 'doc/langref' directory: {s}", .{@errorName(err)});
std.debug.panic("unable to open '{}doc/langref' directory: {s}", .{
b.build_root, @errorName(err),
});
};
defer dir.close();

Expand All @@ -1296,10 +1282,7 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
// in a temporary directory
"--cache-root", b.cache_root.path orelse ".",
});
if (b.zig_lib_dir) |p| {
cmd.addArg("--zig-lib-dir");
cmd.addDirectoryArg(p);
}
cmd.addArgs(&.{ "--zig-lib-dir", b.fmt("{}", .{b.graph.zig_lib_directory}) });
cmd.addArgs(&.{"-i"});
cmd.addFileArg(b.path(b.fmt("doc/langref/{s}", .{entry.name})));

Expand Down
1 change: 0 additions & 1 deletion cmake/Findllvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ if(ZIG_USE_LLVM_CONFIG)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_INCLUDE_DIRS "${LLVM_INCLUDE_DIRS_SPACES}")

link_directories("${CMAKE_PREFIX_PATH}/lib")
link_directories("${LLVM_LIBDIRS}")
else()
# Here we assume that we're cross compiling with Zig, of course. No reason
Expand Down
6 changes: 3 additions & 3 deletions doc/langref.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@
</p>
<aside>
This documentation discusses the features of the default test runner as provided by the Zig Standard Library.
Its source code is located in <code class="file">lib/test_runner.zig</code>.
Its source code is located in <code class="file">lib/compiler/test_runner.zig</code>.
</aside>
<p>
The shell output shown above displays two lines after the <kbd>zig test</kbd> command. These lines are
Expand Down Expand Up @@ -3498,7 +3498,7 @@ void do_a_thing(struct Foo *foo) {
<p>
As a motivating example, consider the statement {#syntax#}const x: u32 = 42;{#endsyntax#}. The type
annotation here provides a result type of {#syntax#}u32{#endsyntax#} to the initialization expression
{#syntax#}42{#endsyntax#}, instructing the compiler to coerce this integer (initally of type
{#syntax#}42{#endsyntax#}, instructing the compiler to coerce this integer (initially of type
{#syntax#}comptime_int{#endsyntax#}) to this type. We will see more examples shortly.
</p>
<p>
Expand Down Expand Up @@ -6833,7 +6833,7 @@ coding style.
<li>utils, misc, or somebody's initials</li>
</ul>
<p>Everything is a value, all types are data, everything is context, all logic manages state.
Nothing is communicated by using a word that applies to all types.</p>
Nothing is communicated by using a word that applies to all types.</p>
<p>Temptation to use "utilities", "miscellaneous", or somebody's initials
is a failure to categorize, or more commonly, overcategorization. Such
declarations can live at the root of a module that needs them with no
Expand Down
2 changes: 1 addition & 1 deletion doc/langref/test_coerce_tuples_arrays.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");
const expect = std.testing.expect;

const Tuple = struct { u8, u8 };
test "coercion from homogenous tuple to array" {
test "coercion from homogeneous tuple to array" {
const tuple: Tuple = .{ 5, 6 };
const array: [2]u8 = tuple;
_ = array;
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/aro/aro/Driver.zig
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ fn processSource(
defer obj.deinit();

// If it's used, name_buf will either hold a filename or `/tmp/<12 random bytes with base-64 encoding>.<extension>`
// both of which should fit into MAX_NAME_BYTES for all systems
var name_buf: [std.fs.MAX_NAME_BYTES]u8 = undefined;
// both of which should fit into max_name_bytes for all systems
var name_buf: [std.fs.max_name_bytes]u8 = undefined;

const out_file_name = if (d.only_compile) blk: {
const fmt_template = "{s}{s}";
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8011,7 +8011,7 @@ fn charLiteral(p: *Parser) Error!Result {
const slice = char_kind.contentSlice(p.tokSlice(p.tok_i));

var is_multichar = false;
if (slice.len == 1 and std.ascii.isASCII(slice[0])) {
if (slice.len == 1 and std.ascii.isAscii(slice[0])) {
// fast path: single unescaped ASCII char
val = slice[0];
} else {
Expand Down
Loading

0 comments on commit aa2e6a2

Please sign in to comment.