Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #16270
andrewrk opened this issue Oct 27, 2023 · 0 comments · Fixed by #17771
Closed
Tracked by #16270

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

andrewrk opened this issue Oct 27, 2023 · 0 comments · Fixed by #17771
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@andrewrk
Copy link
Member

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

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Oct 27, 2023
@andrewrk andrewrk added this to the 0.13.0 milestone Oct 27, 2023
ehaas added a commit to ehaas/zig that referenced this issue Oct 29, 2023
ehaas added a commit to ehaas/zig that referenced this issue Oct 29, 2023
ehaas added a commit to ehaas/zig that referenced this issue Oct 29, 2023
ehaas added a commit to ehaas/zig that referenced this issue Oct 31, 2023
ehaas added a commit to ehaas/zig that referenced this issue Nov 3, 2023
@Vexu Vexu modified the milestones: 0.13.0, 0.12.0 Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants