Skip to content

C++ regression tests on Windows #2292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,6 @@ test_script:
rmdir /s /q cbmc\byte_update7
rmdir /s /q cbmc\pipe1
rmdir /s /q cbmc\unsigned___int128
rmdir /s /q cbmc-cpp
rmdir /s /q cpp\Decltype1
rmdir /s /q cpp\Decltype2
rmdir /s /q cpp\Function_Overloading1
rmdir /s /q cpp\Resolver10
rmdir /s /q cpp\Resolver11
rmdir /s /q cpp\Template_Parameters1
rmdir /s /q cpp\enum2
rmdir /s /q cpp\enum7
rmdir /s /q cpp\enum8
rmdir /s /q cpp\nullptr1
rmdir /s /q cpp\sizeof1
rmdir /s /q cpp\static_assert1
rmdir /s /q goto-gcc
rmdir /s /q goto-instrument\slice08
cd ..
Expand Down
4 changes: 1 addition & 3 deletions regression/cpp/Constant2/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include <cassert>

int const C=10;

int main()
{
assert(C==10);
__CPROVER_assert(C == 10, "");

// this is *not* allowed
((int &)C)=20;
Expand Down
18 changes: 12 additions & 6 deletions regression/cpp/Function_Overloading1/main.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#ifdef __GNUC__
#define NOTHROW __attribute__((nothrow))
#else
#define NOTHROW
#endif

namespace std {
// cmath
__inline float abs(float x) __attribute__((nothrow));
__inline double abs(double x) __attribute__((nothrow));
__inline long double abs(long double x) __attribute__((nothrow));
__inline float abs(float x) NOTHROW;
__inline double abs(double x) NOTHROW;
__inline long double abs(long double x) NOTHROW;
}

namespace std {
extern "C" {
int abs(int) __attribute__((nothrow)) ;
int abs(int) NOTHROW ;
}
extern "C++" {
inline long abs(long n) __attribute__((nothrow));
inline long long abs(long long n) __attribute__((nothrow));
inline long abs(long n) NOTHROW;
inline long long abs(long long n) NOTHROW;
}
}

Expand Down
2 changes: 0 additions & 2 deletions regression/cpp/Resolver10/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

struct A
{
int i;
Expand Down
2 changes: 0 additions & 2 deletions regression/cpp/Resolver11/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

struct A
{
bool func() { return false; }
Expand Down
2 changes: 0 additions & 2 deletions regression/cpp/Template_Parameters1/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

// V depends on Ty
template<typename Ty, Ty V>
class T
Expand Down
2 changes: 1 addition & 1 deletion regression/cpp/enum7/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
KNOWNBUG
main.cpp

^EXIT=0$
Expand Down
32 changes: 15 additions & 17 deletions regression/cpp/enum8/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

enum E1 { e1 } e1_var;
enum E2 { e2 } e2_var;

Expand All @@ -23,19 +21,19 @@ struct some_struct

int main()
{
assert(f(0)==0);
assert(f(e1)==1);
assert(f(e2)==2);
assert(f(e1_var)==1);
assert(f(e2_var)==2);

assert(g(0)==0);
assert(g(e1)==1);
assert(g(e2)==0);
assert(g(e1_var)==1);
assert(g(e2_var)==0);

assert(f(some_struct_var.i)==0);
assert(f(some_struct_var.e1)==1);
assert(f(some_struct_var.e2)==2);
__CPROVER_assert(f(0) == 0, "");
__CPROVER_assert(f(e1) == 1, "");
__CPROVER_assert(f(e2) == 2, "");
__CPROVER_assert(f(e1_var) == 1, "");
__CPROVER_assert(f(e2_var) == 2, "");

__CPROVER_assert(g(0) == 0, "");
__CPROVER_assert(g(e1) == 1, "");
__CPROVER_assert(g(e2) == 0, "");
__CPROVER_assert(g(e1_var) == 1, "");
__CPROVER_assert(g(e2_var) == 0, "");

__CPROVER_assert(f(some_struct_var.i) == 0, "");
__CPROVER_assert(f(some_struct_var.e1) == 1, "");
__CPROVER_assert(f(some_struct_var.e2) == 2, "");
}
4 changes: 1 addition & 3 deletions regression/cpp/nullptr1/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

typedef decltype(nullptr) nullptr_t;

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

char buffer[10];
void *p=my_null, *q=buffer;
assert(q!=nullptr);
__CPROVER_assert(q != nullptr, "");

something(nullptr);
}
1 change: 1 addition & 0 deletions src/goto-cc/ms_cl_cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ const char *ms_cl_prefixes[]=
"MT", // link with LIBCMT.LIB
"MDd", // link with MSVCRTD.LIB debug lib
"MTd", // link with LIBCMTD.LIB debug lib
"std", // specify C++ language standard
nullptr
};

Expand Down
24 changes: 24 additions & 0 deletions src/goto-cc/ms_cl_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ int ms_cl_modet::doit()
else
compiler.mode=compilet::COMPILE_LINK_EXECUTABLE;

if(cmdline.isset("std"))
{
const std::string std_string = cmdline.get_value("std");

if(
std_string == ":c++14" || std_string == "=c++14" ||
std_string == ":c++17" || std_string == "=c++17" ||
std_string == ":c++latest" || std_string == "=c++latest")
{
// we don't have any newer version at the moment
config.cpp.set_cpp14();
}
else if(std_string == ":c++11" || std_string == "=c++11")
{
// this isn't really a Visual Studio variant, we just do this for GCC
// command-line compatibility
config.cpp.set_cpp11();
}
else
warning() << "unknown language standard " << std_string << eom;
}
else
config.cpp.set_cpp14();

compiler.echo_file_name=true;

if(cmdline.isset("Fo"))
Expand Down