Skip to content

Commit 694daaf

Browse files
author
Daniel Kroening
committed
gcc mode: error in case multiple files are given with -c and -o
1 parent d42054a commit 694daaf

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
3+
-c main1.c main2.c -o outfile
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
^cannot specify -o with -c with multiple files$
7+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// blank
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// blank

src/goto-cc/gcc_mode.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,14 @@ int gcc_modet::doit()
723723
}
724724
}
725725

726+
if(
727+
cmdline.isset('o') && cmdline.isset('c') &&
728+
compiler.source_files.size() >= 2)
729+
{
730+
error() << "cannot specify -o with -c with multiple files" << eom;
731+
return 1; // to match gcc's behaviour
732+
}
733+
726734
// Revert to gcc in case there is no source to compile
727735
// and no binary to link.
728736

0 commit comments

Comments
 (0)