zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ed93f0d70f5b3f954a4f52e37cab80383ca61413 (tree)
parent e7baa09ce46181a5ffd55879a24a8cb72cea3093
Author: GasInfinity <me@gasinfinity.dev>
Date:   Thu, 29 Jan 2026 10:39:38 +0100

fix(libzigc): always apply strong linkage, even when testing

* libzigc may be linked into a different test compilation

Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>

Diffstat:
Mlib/c/common.zig | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/c/common.zig b/lib/c/common.zig @@ -1,18 +1,14 @@ const builtin = @import("builtin"); const std = @import("std"); -pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) - .internal -else - .strong; +/// It is incorrect to make this conditional on `builtin.is_test`, because it is possible that +/// libzigc is being linked into a different test compilation, as opposed to being tested itself. +pub const linkage: std.builtin.GlobalLinkage = .strong; /// Determines the symbol's visibility to other objects. /// For WebAssembly this allows the symbol to be resolved to other modules, but will not /// export it to the host runtime. -pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal) - .hidden -else - .default; +pub const visibility: std.builtin.SymbolVisibility = .hidden; /// Given a low-level syscall return value, sets errno and returns `-1`, or on /// success returns the result.