Skip to content

Commit 9160e99

Browse files
authored
Merge pull request diffblue#2292 from tautschnig/c++-windows
C++ regression tests on Windows
2 parents 22b9182 + 5fd18a9 commit 9160e99

File tree

11 files changed

+55
-49
lines changed

11 files changed

+55
-49
lines changed

appveyor.yml

-13
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,6 @@ test_script:
8686
rmdir /s /q cbmc\byte_update7
8787
rmdir /s /q cbmc\pipe1
8888
rmdir /s /q cbmc\unsigned___int128
89-
rmdir /s /q cbmc-cpp
90-
rmdir /s /q cpp\Decltype1
91-
rmdir /s /q cpp\Decltype2
92-
rmdir /s /q cpp\Function_Overloading1
93-
rmdir /s /q cpp\Resolver10
94-
rmdir /s /q cpp\Resolver11
95-
rmdir /s /q cpp\Template_Parameters1
96-
rmdir /s /q cpp\enum2
97-
rmdir /s /q cpp\enum7
98-
rmdir /s /q cpp\enum8
99-
rmdir /s /q cpp\nullptr1
100-
rmdir /s /q cpp\sizeof1
101-
rmdir /s /q cpp\static_assert1
10289
rmdir /s /q goto-gcc
10390
rmdir /s /q goto-instrument\slice08
10491
cd ..

regression/cpp/Constant2/main.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#include <cassert>
2-
31
int const C=10;
42

53
int main()
64
{
7-
assert(C==10);
5+
__CPROVER_assert(C == 10, "");
86

97
// this is *not* allowed
108
((int &)C)=20;

regression/cpp/Function_Overloading1/main.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
#ifdef __GNUC__
2+
#define NOTHROW __attribute__((nothrow))
3+
#else
4+
#define NOTHROW
5+
#endif
6+
17
namespace std {
28
// cmath
3-
__inline float abs(float x) __attribute__((nothrow));
4-
__inline double abs(double x) __attribute__((nothrow));
5-
__inline long double abs(long double x) __attribute__((nothrow));
9+
__inline float abs(float x) NOTHROW;
10+
__inline double abs(double x) NOTHROW;
11+
__inline long double abs(long double x) NOTHROW;
612
}
713

814
namespace std {
915
extern "C" {
10-
int abs(int) __attribute__((nothrow)) ;
16+
int abs(int) NOTHROW ;
1117
}
1218
extern "C++" {
13-
inline long abs(long n) __attribute__((nothrow));
14-
inline long long abs(long long n) __attribute__((nothrow));
19+
inline long abs(long n) NOTHROW;
20+
inline long long abs(long long n) NOTHROW;
1521
}
1622
}
1723

regression/cpp/Resolver10/main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <cassert>
2-
31
struct A
42
{
53
int i;

regression/cpp/Resolver11/main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <cassert>
2-
31
struct A
42
{
53
bool func() { return false; }

regression/cpp/Template_Parameters1/main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <cassert>
2-
31
// V depends on Ty
42
template<typename Ty, Ty V>
53
class T

regression/cpp/enum7/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.cpp
33

44
^EXIT=0$

regression/cpp/enum8/main.cpp

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <cassert>
2-
31
enum E1 { e1 } e1_var;
42
enum E2 { e2 } e2_var;
53

@@ -23,19 +21,19 @@ struct some_struct
2321

2422
int main()
2523
{
26-
assert(f(0)==0);
27-
assert(f(e1)==1);
28-
assert(f(e2)==2);
29-
assert(f(e1_var)==1);
30-
assert(f(e2_var)==2);
31-
32-
assert(g(0)==0);
33-
assert(g(e1)==1);
34-
assert(g(e2)==0);
35-
assert(g(e1_var)==1);
36-
assert(g(e2_var)==0);
37-
38-
assert(f(some_struct_var.i)==0);
39-
assert(f(some_struct_var.e1)==1);
40-
assert(f(some_struct_var.e2)==2);
24+
__CPROVER_assert(f(0) == 0, "");
25+
__CPROVER_assert(f(e1) == 1, "");
26+
__CPROVER_assert(f(e2) == 2, "");
27+
__CPROVER_assert(f(e1_var) == 1, "");
28+
__CPROVER_assert(f(e2_var) == 2, "");
29+
30+
__CPROVER_assert(g(0) == 0, "");
31+
__CPROVER_assert(g(e1) == 1, "");
32+
__CPROVER_assert(g(e2) == 0, "");
33+
__CPROVER_assert(g(e1_var) == 1, "");
34+
__CPROVER_assert(g(e2_var) == 0, "");
35+
36+
__CPROVER_assert(f(some_struct_var.i) == 0, "");
37+
__CPROVER_assert(f(some_struct_var.e1) == 1, "");
38+
__CPROVER_assert(f(some_struct_var.e2) == 2, "");
4139
}

regression/cpp/nullptr1/main.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <cassert>
2-
31
typedef decltype(nullptr) nullptr_t;
42

53
static_assert(nullptr==0, "nullptr==0");
@@ -20,7 +18,7 @@ int main()
2018

2119
char buffer[10];
2220
void *p=my_null, *q=buffer;
23-
assert(q!=nullptr);
21+
__CPROVER_assert(q != nullptr, "");
2422

2523
something(nullptr);
2624
}

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)