zig

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

commit d979df585d05de8d7385495fe6aee2b1d4e1380f (tree)
parent fbb38a7682d43bd4ddc849e085347ef33978e240
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Mon,  8 Apr 2024 00:23:37 -0400

cbe: remove threadlocal variables in single threaded mode

Diffstat:
Msrc/codegen/c.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -2078,7 +2078,7 @@ pub const DeclGen = struct { else false; if (variable.is_weak_linkage or export_weak_linkage) try fwd.writeAll("zig_weak_linkage "); - if (variable.is_threadlocal) try fwd.writeAll("zig_threadlocal "); + if (variable.is_threadlocal and !dg.mod.single_threaded) try fwd.writeAll("zig_threadlocal "); try dg.renderTypeAndName( fwd, decl.typeOf(zcu), @@ -2899,7 +2899,7 @@ pub fn genDecl(o: *Object) !void { const w = o.writer(); if (!is_global) try w.writeAll("static "); if (variable.is_weak_linkage) try w.writeAll("zig_weak_linkage "); - if (variable.is_threadlocal) try w.writeAll("zig_threadlocal "); + if (variable.is_threadlocal and !o.dg.mod.single_threaded) try w.writeAll("zig_threadlocal "); if (zcu.intern_pool.stringToSliceUnwrap(decl.@"linksection")) |s| try w.print("zig_linksection({s}) ", .{fmtStringLiteral(s, null)}); const decl_c_value = .{ .decl = decl_index };