authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-10-18 18:12:22-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-10-18 18:30:32-07:00
log8ec04b567e3f37b82b870b6c595419905cbfcafd
tree51436e9d92d51a73fc6997ec74c5b3e1e6b4f535
parent81a61c8ecd7a970dc96a6068cf8587fd81ebd6e4

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


2 files changed, 10 insertions(+), 2 deletions(-)

lib/std/Build/Step/Compile.zig+2
...@@ -243,6 +243,8 @@ pub const RcSourceFile = struct {...@@ -243,6 +243,8 @@ pub const RcSourceFile = struct {
243 file: LazyPath,243 file: LazyPath,
244 /// Any option that rc.exe accepts will work here, with the exception of:244 /// Any option that rc.exe accepts will work here, with the exception of:
245 /// - `/fo`: The output filename is set by the build system245 /// - `/fo`: The output filename is set by the build system
246 /// - `/p`: Only running the preprocessor is not supported in this context
247 /// - `/:no-preprocess` (non-standard option): Not supported in this context
246 /// - Any MUI-related option248 /// - Any MUI-related option
247 /// https://learn.microsoft.com/en-us/windows/win32/menurc/using-rc-the-rc-command-line-249 /// https://learn.microsoft.com/en-us/windows/win32/menurc/using-rc-the-rc-command-line-
248 ///250 ///
src/Compilation.zig+8-2
...@@ -4759,11 +4759,17 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32...@@ -4759,11 +4759,17 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
4759 // unconditionally set `ignore_include_env_var` to true4759 // unconditionally set `ignore_include_env_var` to true
4760 options.ignore_include_env_var = true;4760 options.ignore_include_env_var = true;
47614761
4762 if (options.preprocess != .yes) {
4763 return comp.failWin32Resource(win32_resource, "the '{s}' option is not supported in this context", .{switch (options.preprocess) {
4764 .no => "/:no-preprocess",
4765 .only => "/p",
4766 .yes => unreachable,
4767 }});
4768 }
4769
4762 var argv = std.ArrayList([]const u8).init(comp.gpa);4770 var argv = std.ArrayList([]const u8).init(comp.gpa);
4763 defer argv.deinit();4771 defer argv.deinit();
47644772
4765 // TODO: support options.preprocess == .no and .only
4766 // alternatively, error if those options are used
4767 try argv.appendSlice(&[_][]const u8{ self_exe_path, "clang" });4773 try argv.appendSlice(&[_][]const u8{ self_exe_path, "clang" });
47684774
4769 try resinator.preprocess.appendClangArgs(arena, &argv, options, .{4775 try resinator.preprocess.appendClangArgs(arena, &argv, options, .{