diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-08-15 11:18:45 +0100 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-08-15 20:00:30 +0100 |
| commit | 8adabaa4ed2321882e2ef04ebb2d9b621805aac2 (patch) | |
| tree | a1ff7a83fbfcd976d17b1f19cd1e848c08da0793 /src/Compilation.zig | |
| parent | ce2c9399dd44943079dde5c00af4fead01d3d9ef (diff) | |
| download | zig-8adabaa4ed2321882e2ef04ebb2d9b621805aac2.tar.gz zig-8adabaa4ed2321882e2ef04ebb2d9b621805aac2.zip | |
Zcu: don't tell linkers about exports if there are compile errors
In the best case, this is redundant work, because we aren't actually
going to emit a working binary this update. In the worst case, it causes
bugs because the linker may not have *seen* the thing being exported due
to the compile errors.
Resolves: #24417
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 435919fce9..e340cb57f8 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4254,14 +4254,10 @@ fn appendCompileLogLines(log_text: *std.ArrayListUnmanaged(u8), zcu: *Zcu, loggi } } -fn anyErrors(comp: *Compilation) bool { - return (totalErrorCount(comp) catch return true) != 0; -} - -fn totalErrorCount(comp: *Compilation) !u32 { - var errors = try comp.getAllErrorsAlloc(); +pub fn anyErrors(comp: *Compilation) bool { + var errors = comp.getAllErrorsAlloc() catch return true; defer errors.deinit(comp.gpa); - return errors.errorMessageCount(); + return errors.errorMessageCount() > 0; } pub const ErrorNoteHashContext = struct { |
