From 0cbf00a3ec3f6640556e39efaa6e936b0b42630b Mon Sep 17 00:00:00 2001 From: Vexu <15308111+Vexu@users.noreply.github.com> Date: Sun, 24 Nov 2019 09:13:01 +0200 Subject: [PATCH] self hosted compiler: final small fixes to get it compiling --- build.zig | 5 ++++- src-self-hosted/compilation.zig | 3 +++ src-self-hosted/test.zig | 10 +++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index e29633e17e3d..fc03296158e0 100644 --- a/build.zig +++ b/build.zig @@ -74,7 +74,7 @@ pub fn build(b: *Builder) !void { const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false; const skip_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false; if (!skip_self_hosted and builtin.os == .linux) { - // TODO evented I/O other OS'spu + // TODO evented I/O other OS's test_step.dependOn(&exe.step); } @@ -232,6 +232,9 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep { if (fs.path.isAbsolute(lib_arg)) { try result.libs.append(lib_arg); } else { + if (mem.endsWith(u8, lib_arg, ".lib")) { + lib_arg = lib_arg[0 .. lib_arg.len - 4]; + } try result.system_libs.append(lib_arg); } } diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig index a6c93b2cc577..b12a01d6494b 100644 --- a/src-self-hosted/compilation.zig +++ b/src-self-hosted/compilation.zig @@ -517,6 +517,9 @@ pub const Compilation = struct { comp.target_layout_str = llvm.CopyStringRepOfTargetData(comp.target_data_ref) orelse return error.OutOfMemory; defer llvm.DisposeMessage(comp.target_layout_str); + comp.events = try allocator.create(event.Channel(Event)); + defer allocator.destroy(comp.events); + comp.events.init([0]Event{}); defer comp.events.deinit(); diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig index 940a8c53b3c0..85b9d6b912f5 100644 --- a/src-self-hosted/test.zig +++ b/src-self-hosted/test.zig @@ -13,12 +13,16 @@ test "stage2" { // TODO provide a way to run tests in evented I/O mode if (!std.io.is_async) return error.SkipZigTest; + // TODO https://github.com/ziglang/zig/issues/1364 + // TODO https://github.com/ziglang/zig/issues/3117 + if (true) return error.SkipZigTest; + try ctx.init(); defer ctx.deinit(); try @import("stage2_tests").addCases(&ctx); - _ = async ctx.run(); + try ctx.run(); } const file1 = "1.zig"; @@ -61,8 +65,8 @@ pub const TestContext = struct { self.zig_compiler.deinit(); } - fn run(self: *TestContext) void { - std.event.Loop.instance.?.startCpuBoundOperation(); + fn run(self: *TestContext) !void { + std.event.Loop.startCpuBoundOperation(); self.any_err = self.group.wait(); return self.any_err; }