ziglang/zig

make mingw .def.in file parsing use aro's preprocessor instead of clang

andrewrk opened this issue · 0 comments

This code converts mingw's .def.in files to .def files:

zig/src/mingw.zig

Lines 291 to 293 in 1c85b0a

// We need to invoke `zig clang` to use the preprocessor.
if (!build_options.have_llvm) return error.ZigCompilerNotBuiltWithLLVMExtensions;
const self_exe_path = comp.self_exe_path orelse return error.PreprocessorDisabled;

zig/src/mingw.zig

Lines 348 to 375 in 1c85b0a

const args = [_][]const u8{
self_exe_path,
"clang",
"-x",
"c",
def_file_path,
"-Wp,-w",
"-undef",
"-P",
"-I",
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", "def-include" }),
target_def_arg,
"-E",
"-o",
def_final_path,
};
if (comp.verbose_cc) {
Compilation.dump_argv(&args);
}
if (std.process.can_spawn) {
var child = std.ChildProcess.init(&args, arena);
child.stdin_behavior = .Ignore;
child.stdout_behavior = .Pipe;
child.stderr_behavior = .Pipe;
try child.spawn();

Instead of using clang's preprocessor, it should use Aro's.

Related:

cc @Vexu @ehaas