Skip to content

Commit

Permalink
cvtres subcommand: Add warning for not specifying target machine type
Browse files Browse the repository at this point in the history
  • Loading branch information
squeek502 committed Nov 6, 2024
1 parent d12ed12 commit d103019
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/subcommands/cvtres.zig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub fn parseCli(allocator: Allocator, args: []const []const u8, diagnostics: *Di
errdefer options.deinit();

var output_filename: ?[]const u8 = null;
var target_specified: bool = false;

var arg_i: usize = 0;
next_arg: while (arg_i < args.len) {
Expand Down Expand Up @@ -117,6 +118,7 @@ pub fn parseCli(allocator: Allocator, args: []const []const u8, diagnostics: *Di
arg_i += 1;
continue :next_arg;
};
target_specified = true;
options.coff_options.target = machine;
arg_i += 1;
continue :next_arg;
Expand Down Expand Up @@ -224,6 +226,13 @@ pub fn parseCli(allocator: Allocator, args: []const []const u8, diagnostics: *Di
return error.ParseError;
}

if (!target_specified) {
var warning_details = Diagnostics.ErrorDetails{ .type = .warning, .arg_index = 0, .print_args = false };
var warning_writer = warning_details.msg.writer(allocator);
try warning_writer.writeAll("machine type not specified, assuming /MACHINE:X64");
try diagnostics.append(warning_details);
}

return options;
}

Expand Down

0 comments on commit d103019

Please sign in to comment.