Skip to content

Commit a37c2f9

Browse files
committed
options: fix -o when no targets are specified
1 parent 81fb2db commit a37c2f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/main.c2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn void parse_opts(i32 argc, char** argv, compiler.Options* comp_opts, Options*
361361
console.error("c2c: recipe targets cannot be combined with <files>");
362362
exit(EXIT_FAILURE);
363363
}
364-
if (opts.output_name && num_targets > 1) {
364+
if (opts.output_name && num_files == 0 && num_targets != 1) {
365365
console.error("c2c: option -o can only be used for a single target");
366366
exit(EXIT_FAILURE);
367367
}
@@ -637,6 +637,7 @@ public fn i32 main(i32 argc, char** argv) {
637637
Context c.init();
638638
c.handle_args(argc, argv);
639639
c.handle_plugins();
640+
640641
bool hasError = c.build_targets();
641642

642643
c.free();

0 commit comments

Comments
 (0)