From 24215df8c56ba64e624487f914513212e3e747e9 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 1 Mar 2021 19:52:51 +0100 Subject: zig c++: fix compilation that includes any c++ std library file LLVM 12 included a patch that changed the way availability annotations are specified. We now have to define the _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS flag to make sure that we tell the c++ headers that we don't use visibility annotations. Related LLVM patch: D90843 --- src/Compilation.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 39e10becec..d4e3981b85 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2264,6 +2264,7 @@ pub fn addCCArgs( } try argv.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); try argv.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); + try argv.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS"); } const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target); -- cgit v1.2.3 From c10a2d7649c4c73c0235cac64bdd3e98ff93b8c6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 2 Mar 2021 15:00:10 -0700 Subject: stage2: use std.zig.fmtId for builtin.zig source --- src/Compilation.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index d4e3981b85..bbe36d8fce 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2848,11 +2848,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 const index = @intCast(std.Target.Cpu.Feature.Set.Index, index_usize); const is_enabled = target.cpu.features.isEnabled(index); if (is_enabled) { - // TODO some kind of "zig identifier escape" function rather than - // unconditionally using @"" syntax - try buffer.appendSlice(" .@\""); - try buffer.appendSlice(feature.name); - try buffer.appendSlice("\",\n"); + try buffer.writer().print(" .{},\n", .{std.zig.fmtId(feature.name)}); } } -- cgit v1.2.3