From b3cd38ea4a7520fabbb05d3d2e74351c7c8effdb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 24 Oct 2022 16:48:15 -0700 Subject: link: add an explicit error set for flush() and flushModule() This makes it easier to understand how control flow should happen in various cases; already just by doing this it is revealed that UndefinedSymbol and UndefinedSymbolReference should be merged, and that MissingMainEntrypoint should be removed in favor of the ErrorFlags mechanism thath we already have for missing the main entrypoint. The main motivation for this change, however, is preventing a compile error when there is conditional compilation inside linker implementations, causing the flush() error set to depend on compilation options. With this change, the error set is fixed, and, notably, the `-Donly-c` flag no longer has compilation errors due to this error set. --- src/link/Elf.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/link/Elf.zig') diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 1a722c1dde..a7f49ab6d4 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -932,7 +932,7 @@ pub fn populateMissingMetadata(self: *Elf) !void { } } -pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !void { +pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void { if (self.base.options.emit == null) { if (build_options.have_llvm) { if (self.llvm_object) |llvm_object| { @@ -951,7 +951,7 @@ pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !voi } } -pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !void { +pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void { const tracy = trace(@src()); defer tracy.end(); -- cgit v1.2.3