From 124448c1b6d73df6f20901888c79435e4d9e3da7 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 20 Jul 2023 16:00:11 +0200 Subject: [PATCH] Include system headers path when targeting assembly_with_cpp This is consistent with what clang and gcc are doing, because headers such as are specifically designed to be used in the context of assembly code. Fixes #16449 --- src/Compilation.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Compilation.zig b/src/Compilation.zig index 3a95f4831a..7d66c78a63 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4438,6 +4438,12 @@ pub fn addCCArgs( }, .shared_library, .ll, .bc, .unknown, .static_library, .object, .def, .zig, .res => {}, .assembly, .assembly_with_cpp => { + if (ext == .assembly_with_cpp) { + const c_headers_dir = try std.fs.path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, "include" }); + try argv.append("-isystem"); + try argv.append(c_headers_dir); + } + // The Clang assembler does not accept the list of CPU features like the // compiler frontend does. Therefore we must hard-code the -m flags for // all CPU features here.