Skip to content

Commit 29eab32

Browse files
committed
goto-cl: Fail invocation of trying to compile multiple files to non-directory
Visual Studio only places files in a directory when the target name ends in a slash or backslash. Also test the case of not using a slash.
1 parent fae6a48 commit 29eab32

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

regression/goto-cl/Fo/Fo-directory.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22

3-
--verbosity 10 /c main1.c main2.c /Fo dir
3+
--verbosity 10 /c main1.c main2.c /Fodir/
44
^EXIT=0$
55
^SIGNAL=0$
66
--
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
3+
--verbosity 10 /c main1.c main2.c /Fodir
4+
^EXIT=64$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
Visual Studio expects a / or \ at the end of a directory name to be treating it
11+
as a directory. Using multiple translation units without a target directory is
12+
not permitted.

src/goto-cc/ms_cl_mode.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ int ms_cl_modet::doit()
118118
compiler.output_file_object = Fo_value;
119119
}
120120

121+
if(
122+
compiler.mode == compilet::COMPILE_ONLY &&
123+
cmdline.args.size() > 1 &&
124+
compiler.output_directory_object.empty())
125+
{
126+
error() << "output directory required for /c with multiple input files"
127+
<< eom;
128+
return EX_USAGE;
129+
}
130+
121131
if(cmdline.isset("Fe"))
122132
{
123133
compiler.output_file_executable=cmdline.get_value("Fe");

0 commit comments

Comments
 (0)