commit 2391c460b1c137e44c8e0c092a2401b2676e2629 (tree)
parent 77af309cb6e731a1f30967acc9e1204955c7d242
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sat, 18 Jan 2025 19:32:07 -0800
fix build failure when llvm not available
Diffstat:
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/glibc.zig b/src/glibc.zig
@@ -178,7 +178,9 @@ pub const CrtFile = enum {
libc_nonshared_a,
};
-pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
+/// TODO replace anyerror with explicit error set, recording user-friendly errors with
+/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
+pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
if (!build_options.have_llvm) {
return error.ZigCompilerNotBuiltWithLLVMExtensions;
}
@@ -735,7 +737,9 @@ fn wordDirective(target: std.Target) []const u8 {
return if (target.ptrBitWidth() == 64) ".quad" else ".long";
}
-pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !void {
+/// TODO replace anyerror with explicit error set, recording user-friendly errors with
+/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
+pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anyerror!void {
const tracy = trace(@src());
defer tracy.end();
diff --git a/src/mingw.zig b/src/mingw.zig
@@ -17,7 +17,9 @@ pub const CrtFile = enum {
mingw32_lib,
};
-pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
+/// TODO replace anyerror with explicit error set, recording user-friendly errors with
+/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
+pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
if (!build_options.have_llvm) {
return error.ZigCompilerNotBuiltWithLLVMExtensions;
}
diff --git a/src/musl.zig b/src/musl.zig
@@ -18,7 +18,9 @@ pub const CrtFile = enum {
libc_so,
};
-pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) !void {
+/// TODO replace anyerror with explicit error set, recording user-friendly errors with
+/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
+pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
if (!build_options.have_llvm) {
return error.ZigCompilerNotBuiltWithLLVMExtensions;
}
diff --git a/src/wasi_libc.zig b/src/wasi_libc.zig
@@ -57,7 +57,9 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co
};
}
-pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) !void {
+/// TODO replace anyerror with explicit error set, recording user-friendly errors with
+/// setMiscFailure and returning error.SubCompilationFailed. see libcxx.zig for example.
+pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void {
if (!build_options.have_llvm) {
return error.ZigCompilerNotBuiltWithLLVMExtensions;
}