Skip to content

Commit 9adf5f1

Browse files
committed
Configure C++ language standard in goto-cl
1 parent 10a4685 commit 9adf5f1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/goto-cc/ms_cl_cmdline.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ const char *ms_cl_prefixes[]=
406406
"MT", // link with LIBCMT.LIB
407407
"MDd", // link with MSVCRTD.LIB debug lib
408408
"MTd", // link with LIBCMTD.LIB debug lib
409+
"std", // specify C++ language standard
409410
nullptr
410411
};
411412

src/goto-cc/ms_cl_mode.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,30 @@ int ms_cl_modet::doit()
7777
else
7878
compiler.mode=compilet::COMPILE_LINK_EXECUTABLE;
7979

80+
if(cmdline.isset("std"))
81+
{
82+
const std::string std_string = cmdline.get_value("std");
83+
84+
if(
85+
std_string == ":c++14" || std_string == "=c++14" ||
86+
std_string == ":c++17" || std_string == "=c++17" ||
87+
std_string == ":c++latest" || std_string == "=c++latest")
88+
{
89+
// we don't have any newer version at the moment
90+
config.cpp.set_cpp14();
91+
}
92+
else if(std_string == ":c++11" || std_string == "=c++11")
93+
{
94+
// this isn't really a Visual Studio variant, we just do this for GCC
95+
// command-line compatibility
96+
config.cpp.set_cpp11();
97+
}
98+
else
99+
warning() << "unknown language standard " << std_string << eom;
100+
}
101+
else
102+
config.cpp.set_cpp14();
103+
80104
compiler.echo_file_name=true;
81105

82106
if(cmdline.isset("Fo"))

0 commit comments

Comments
 (0)