Error if an .rc file uses the 'preprocess only' or 'no preprocess' flags

This commit is contained in:
Ryan Liptak committed 2023-10-18 18:30:32 -07:00
1 parent 81a61c8ecd
commit 8ec04b567e
2 files changed
+10 -2

No files matched your search

+2
View File
@@ -243,6 +243,8 @@ pub const RcSourceFile = struct {
file: LazyPath,
/// Any option that rc.exe accepts will work here, with the exception of:
/// - `/fo`: The output filename is set by the build system
/// - `/p`: Only running the preprocessor is not supported in this context
/// - `/:no-preprocess` (non-standard option): Not supported in this context
/// - Any MUI-related option
/// https://learn.microsoft.com/en-us/windows/win32/menurc/using-rc-the-rc-command-line-
///
+8 -2
View File
@@ -4759,11 +4759,17 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
// unconditionally set `ignore_include_env_var` to true
options.ignore_include_env_var = true;
if (options.preprocess != .yes) {
return comp.failWin32Resource(win32_resource, "the '{s}' option is not supported in this context", .{switch (options.preprocess) {
.no => "/:no-preprocess",
.only => "/p",
.yes => unreachable,
}});
}
var argv = std.ArrayList([]const u8).init(comp.gpa);
defer argv.deinit();
// TODO: support options.preprocess == .no and .only
// alternatively, error if those options are used
try argv.appendSlice(&[_][]const u8{ self_exe_path, "clang" });
try resinator.preprocess.appendClangArgs(arena, &argv, options, .{