mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
Merge branch 'master' of https://github.com/z3prover/z3
This commit is contained in:
commit
dc4dbdf51e
20
.travis.yml
20
.travis.yml
|
@ -60,15 +60,17 @@ env:
|
||||||
- LINUX_BASE=ubuntu_14.04 C_COMPILER=/usr/bin/gcc-4.8 CXX_COMPILER=/usr/bin/g++-4.8 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug
|
- LINUX_BASE=ubuntu_14.04 C_COMPILER=/usr/bin/gcc-4.8 CXX_COMPILER=/usr/bin/g++-4.8 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug
|
||||||
|
|
||||||
# macOS (a.k.a OSX) support
|
# macOS (a.k.a OSX) support
|
||||||
matrix:
|
# FIXME: macOS support is temporarily disabled due to @wintersteiger 's concerns.
|
||||||
include:
|
# See https://github.com/Z3Prover/z3/pull/1207#issuecomment-322200998
|
||||||
# For now just test a single configuration. macOS builds on TravisCI are
|
# matrix:
|
||||||
# very slow so we should keep the number of configurations we test on this
|
# include:
|
||||||
# OS to a minimum.
|
# # For now just test a single configuration. macOS builds on TravisCI are
|
||||||
- os: osx
|
# # very slow so we should keep the number of configurations we test on this
|
||||||
osx_image: xcode8.3
|
# # OS to a minimum.
|
||||||
# Note: Apple Clang does not support OpenMP
|
# - os: osx
|
||||||
env: Z3_BUILD_TYPE=RelWithDebInfo USE_OPENMP=0
|
# osx_image: xcode8.3
|
||||||
|
# # Note: Apple Clang does not support OpenMP
|
||||||
|
# env: Z3_BUILD_TYPE=RelWithDebInfo USE_OPENMP=0
|
||||||
script:
|
script:
|
||||||
# Use `travis_wait` when doing LTO builds because this configuration will
|
# Use `travis_wait` when doing LTO builds because this configuration will
|
||||||
# have long link times during which it will not show any output which
|
# have long link times during which it will not show any output which
|
||||||
|
|
|
@ -234,22 +234,18 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
if ("${TARGET_ARCHITECTURE}" STREQUAL "x86_64")
|
if ("${TARGET_ARCHITECTURE}" STREQUAL "x86_64")
|
||||||
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_USE_THREAD_LOCAL")
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_USE_THREAD_LOCAL")
|
||||||
endif()
|
endif()
|
||||||
z3_add_cxx_flag("-fno-strict-aliasing" REQUIRED)
|
|
||||||
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||||
# Does OSX really not need any special flags?
|
# Does OSX really not need any special flags?
|
||||||
message(STATUS "Platform: Darwin")
|
message(STATUS "Platform: Darwin")
|
||||||
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
|
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
|
||||||
message(STATUS "Platform: FreeBSD")
|
message(STATUS "Platform: FreeBSD")
|
||||||
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_FREEBSD_")
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_FREEBSD_")
|
||||||
z3_add_cxx_flag("-fno-strict-aliasing" REQUIRED)
|
|
||||||
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
|
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
|
||||||
message(STATUS "Platform: OpenBSD")
|
message(STATUS "Platform: OpenBSD")
|
||||||
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_OPENBSD_")
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_OPENBSD_")
|
||||||
z3_add_cxx_flag("-fno-strict-aliasing" REQUIRED)
|
|
||||||
elseif (CYGWIN)
|
elseif (CYGWIN)
|
||||||
message(STATUS "Platform: Cygwin")
|
message(STATUS "Platform: Cygwin")
|
||||||
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_CYGWIN")
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_CYGWIN")
|
||||||
z3_add_cxx_flag("-fno-strict-aliasing" REQUIRED)
|
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
message(STATUS "Platform: Windows")
|
message(STATUS "Platform: Windows")
|
||||||
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_WINDOWS")
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_WINDOWS")
|
||||||
|
|
|
@ -2443,26 +2443,26 @@ def mk_config():
|
||||||
SO_EXT = '.dylib'
|
SO_EXT = '.dylib'
|
||||||
SLIBFLAGS = '-dynamiclib'
|
SLIBFLAGS = '-dynamiclib'
|
||||||
elif sysname == 'Linux':
|
elif sysname == 'Linux':
|
||||||
CXXFLAGS = '%s -fno-strict-aliasing -D_LINUX_' % CXXFLAGS
|
CXXFLAGS = '%s -D_LINUX_' % CXXFLAGS
|
||||||
OS_DEFINES = '-D_LINUX_'
|
OS_DEFINES = '-D_LINUX_'
|
||||||
SO_EXT = '.so'
|
SO_EXT = '.so'
|
||||||
LDFLAGS = '%s -lrt' % LDFLAGS
|
LDFLAGS = '%s -lrt' % LDFLAGS
|
||||||
SLIBFLAGS = '-shared'
|
SLIBFLAGS = '-shared'
|
||||||
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
||||||
elif sysname == 'FreeBSD':
|
elif sysname == 'FreeBSD':
|
||||||
CXXFLAGS = '%s -fno-strict-aliasing -D_FREEBSD_' % CXXFLAGS
|
CXXFLAGS = '%s -D_FREEBSD_' % CXXFLAGS
|
||||||
OS_DEFINES = '-D_FREEBSD_'
|
OS_DEFINES = '-D_FREEBSD_'
|
||||||
SO_EXT = '.so'
|
SO_EXT = '.so'
|
||||||
LDFLAGS = '%s -lrt' % LDFLAGS
|
LDFLAGS = '%s -lrt' % LDFLAGS
|
||||||
SLIBFLAGS = '-shared'
|
SLIBFLAGS = '-shared'
|
||||||
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
||||||
elif sysname == 'OpenBSD':
|
elif sysname == 'OpenBSD':
|
||||||
CXXFLAGS = '%s -fno-strict-aliasing -D_OPENBSD_' % CXXFLAGS
|
CXXFLAGS = '%s -D_OPENBSD_' % CXXFLAGS
|
||||||
OS_DEFINES = '-D_OPENBSD_'
|
OS_DEFINES = '-D_OPENBSD_'
|
||||||
SO_EXT = '.so'
|
SO_EXT = '.so'
|
||||||
SLIBFLAGS = '-shared'
|
SLIBFLAGS = '-shared'
|
||||||
elif sysname[:6] == 'CYGWIN':
|
elif sysname[:6] == 'CYGWIN':
|
||||||
CXXFLAGS = '%s -D_CYGWIN -fno-strict-aliasing' % CXXFLAGS
|
CXXFLAGS = '%s -D_CYGWIN' % CXXFLAGS
|
||||||
OS_DEFINES = '-D_CYGWIN'
|
OS_DEFINES = '-D_CYGWIN'
|
||||||
SO_EXT = '.dll'
|
SO_EXT = '.dll'
|
||||||
SLIBFLAGS = '-shared'
|
SLIBFLAGS = '-shared'
|
||||||
|
|
|
@ -35,7 +35,7 @@ Revision History:
|
||||||
|
|
||||||
parameter::~parameter() {
|
parameter::~parameter() {
|
||||||
if (m_kind == PARAM_RATIONAL) {
|
if (m_kind == PARAM_RATIONAL) {
|
||||||
reinterpret_cast<rational *>(m_rational)->~rational();
|
m_rational.~rational();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,14 +50,14 @@ parameter& parameter::operator=(parameter const& other) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
if (m_kind == PARAM_RATIONAL) {
|
if (m_kind == PARAM_RATIONAL) {
|
||||||
reinterpret_cast<rational *>(m_rational)->~rational();
|
m_rational.~rational();
|
||||||
}
|
}
|
||||||
m_kind = other.m_kind;
|
m_kind = other.m_kind;
|
||||||
switch(other.m_kind) {
|
switch(other.m_kind) {
|
||||||
case PARAM_INT: m_int = other.get_int(); break;
|
case PARAM_INT: m_int = other.get_int(); break;
|
||||||
case PARAM_AST: m_ast = other.get_ast(); break;
|
case PARAM_AST: m_ast = other.get_ast(); break;
|
||||||
case PARAM_SYMBOL: new (m_symbol) symbol(other.get_symbol()); break;
|
case PARAM_SYMBOL: m_symbol = other.get_symbol(); break;
|
||||||
case PARAM_RATIONAL: new (m_rational) rational(other.get_rational()); break;
|
case PARAM_RATIONAL: m_rational = other.get_rational(); break;
|
||||||
case PARAM_DOUBLE: m_dval = other.m_dval; break;
|
case PARAM_DOUBLE: m_dval = other.m_dval; break;
|
||||||
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
|
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -100,12 +100,12 @@ private:
|
||||||
|
|
||||||
// It is not possible to use tag pointers, since symbols are already tagged.
|
// It is not possible to use tag pointers, since symbols are already tagged.
|
||||||
union {
|
union {
|
||||||
int m_int; // for PARAM_INT
|
int m_int; // for PARAM_INT
|
||||||
ast* m_ast; // for PARAM_AST
|
ast* m_ast; // for PARAM_AST
|
||||||
char m_symbol[sizeof(symbol)]; // for PARAM_SYMBOL
|
symbol m_symbol; // for PARAM_SYMBOL
|
||||||
char m_rational[sizeof(rational)]; // for PARAM_RATIONAL
|
rational m_rational; // for PARAM_RATIONAL
|
||||||
double m_dval; // for PARAM_DOUBLE (remark: this is not used in float_decl_plugin)
|
double m_dval; // for PARAM_DOUBLE (remark: this is not used in float_decl_plugin)
|
||||||
unsigned m_ext_id; // for PARAM_EXTERNAL
|
unsigned m_ext_id; // for PARAM_EXTERNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -114,12 +114,10 @@ public:
|
||||||
explicit parameter(int val): m_kind(PARAM_INT), m_int(val) {}
|
explicit parameter(int val): m_kind(PARAM_INT), m_int(val) {}
|
||||||
explicit parameter(unsigned val): m_kind(PARAM_INT), m_int(val) {}
|
explicit parameter(unsigned val): m_kind(PARAM_INT), m_int(val) {}
|
||||||
explicit parameter(ast * p): m_kind(PARAM_AST), m_ast(p) {}
|
explicit parameter(ast * p): m_kind(PARAM_AST), m_ast(p) {}
|
||||||
explicit parameter(symbol const & s): m_kind(PARAM_SYMBOL) { new (m_symbol) symbol(s); }
|
explicit parameter(symbol const & s): m_kind(PARAM_SYMBOL), m_symbol(s) {}
|
||||||
explicit parameter(rational const & r): m_kind(PARAM_RATIONAL) { new (m_rational) rational(r); }
|
explicit parameter(rational const & r): m_kind(PARAM_RATIONAL), m_rational(r) {}
|
||||||
explicit parameter(double d):m_kind(PARAM_DOUBLE), m_dval(d) {}
|
explicit parameter(double d):m_kind(PARAM_DOUBLE), m_dval(d) {}
|
||||||
explicit parameter(const char *s):m_kind(PARAM_SYMBOL) {
|
explicit parameter(const char *s):m_kind(PARAM_SYMBOL), m_symbol(s) {}
|
||||||
new (m_symbol) symbol(s);
|
|
||||||
}
|
|
||||||
explicit parameter(unsigned ext_id, bool):m_kind(PARAM_EXTERNAL), m_ext_id(ext_id) {}
|
explicit parameter(unsigned ext_id, bool):m_kind(PARAM_EXTERNAL), m_ext_id(ext_id) {}
|
||||||
parameter(parameter const&);
|
parameter(parameter const&);
|
||||||
|
|
||||||
|
@ -156,8 +154,8 @@ public:
|
||||||
|
|
||||||
int get_int() const { SASSERT(is_int()); return m_int; }
|
int get_int() const { SASSERT(is_int()); return m_int; }
|
||||||
ast * get_ast() const { SASSERT(is_ast()); return m_ast; }
|
ast * get_ast() const { SASSERT(is_ast()); return m_ast; }
|
||||||
symbol const & get_symbol() const { SASSERT(is_symbol()); return *(reinterpret_cast<const symbol *>(m_symbol)); }
|
symbol const & get_symbol() const { SASSERT(is_symbol()); return m_symbol; }
|
||||||
rational const & get_rational() const { SASSERT(is_rational()); return *(reinterpret_cast<const rational *>(m_rational)); }
|
rational const & get_rational() const { SASSERT(is_rational()); return m_rational; }
|
||||||
double get_double() const { SASSERT(is_double()); return m_dval; }
|
double get_double() const { SASSERT(is_double()); return m_dval; }
|
||||||
unsigned get_ext_id() const { SASSERT(is_external()); return m_ext_id; }
|
unsigned get_ext_id() const { SASSERT(is_external()); return m_ext_id; }
|
||||||
|
|
||||||
|
|
|
@ -307,9 +307,8 @@ public:
|
||||||
|
|
||||||
virtual void cleanup() {
|
virtual void cleanup() {
|
||||||
ast_manager & m = m_imp->m;
|
ast_manager & m = m_imp->m;
|
||||||
imp * d = alloc(imp, m, m_params);
|
m_imp->~imp();
|
||||||
std::swap(d, m_imp);
|
m_imp = new (m_imp) imp(m, m_params);
|
||||||
dealloc(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -171,9 +171,8 @@ public:
|
||||||
|
|
||||||
virtual void cleanup() {
|
virtual void cleanup() {
|
||||||
ast_manager & m = m_imp->m;
|
ast_manager & m = m_imp->m;
|
||||||
imp * d = alloc(imp, m, m_params);
|
m_imp->~imp();
|
||||||
std::swap(d, m_imp);
|
m_imp = new (m_imp) imp(m, m_params);
|
||||||
dealloc(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -502,9 +502,8 @@ void reduce_args_tactic::operator()(goal_ref const & g,
|
||||||
}
|
}
|
||||||
|
|
||||||
void reduce_args_tactic::cleanup() {
|
void reduce_args_tactic::cleanup() {
|
||||||
ast_manager & m = m_imp->m();
|
ast_manager & m = m_imp->m();
|
||||||
imp * d = alloc(imp, m);
|
m_imp->~imp();
|
||||||
std::swap(d, m_imp);
|
m_imp = new (m_imp) imp(m);
|
||||||
dealloc(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,7 @@ bool is_debug_enabled(const char * tag);
|
||||||
exit(-1); \
|
exit(-1); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_NAME2(LINE) zofty_ ## LINE
|
#define COMPILE_TIME_ASSERT(expr) static_assert(expr, "")
|
||||||
#define MAKE_NAME(LINE) MAKE_NAME2(LINE)
|
|
||||||
#define DBG_UNIQUE_NAME MAKE_NAME(__LINE__)
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define COMPILE_TIME_ASSERT(expr) extern __attribute__((unused)) char DBG_UNIQUE_NAME[expr]
|
|
||||||
#else
|
|
||||||
#define COMPILE_TIME_ASSERT(expr) extern char DBG_UNIQUE_NAME[expr]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void finalize_debug();
|
void finalize_debug();
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -23,32 +23,35 @@ Revision History:
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class optional {
|
class optional {
|
||||||
char m_obj[sizeof(T)];
|
union {
|
||||||
char m_initialized;
|
T m_obj;
|
||||||
|
char m_dummy;
|
||||||
|
};
|
||||||
|
bool m_initialized;
|
||||||
|
|
||||||
void construct(const T & val) {
|
void construct(const T & val) {
|
||||||
m_initialized = 1;
|
m_initialized = true;
|
||||||
new (reinterpret_cast<void *>(m_obj)) T(val);
|
new (&m_obj) T(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy() {
|
void destroy() {
|
||||||
if (m_initialized == 1) {
|
if (m_initialized) {
|
||||||
reinterpret_cast<T *>(m_obj)->~T();
|
m_obj.~T();
|
||||||
}
|
}
|
||||||
m_initialized = 0;
|
m_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
optional():
|
optional():
|
||||||
m_initialized(0) {}
|
m_initialized(false) {}
|
||||||
|
|
||||||
explicit optional(const T & val) {
|
explicit optional(const T & val) {
|
||||||
construct(val);
|
construct(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
optional(const optional<T> & val):
|
optional(const optional<T> & val):
|
||||||
m_initialized(0) {
|
m_initialized(false) {
|
||||||
if (val.m_initialized == 1) {
|
if (val.m_initialized) {
|
||||||
construct(*val);
|
construct(*val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,13 +62,13 @@ public:
|
||||||
|
|
||||||
static optional const & undef() { static optional u; return u; }
|
static optional const & undef() { static optional u; return u; }
|
||||||
|
|
||||||
bool initialized() const { return m_initialized == 1; }
|
bool initialized() const { return m_initialized; }
|
||||||
operator bool() const { return m_initialized == 1; }
|
operator bool() const { return m_initialized; }
|
||||||
bool operator!() const { return m_initialized == 0; }
|
bool operator!() const { return !m_initialized; }
|
||||||
|
|
||||||
T * get() const {
|
T * get() const {
|
||||||
if (m_initialized == 1) {
|
if (m_initialized) {
|
||||||
return reinterpret_cast<T *>(m_obj);
|
return &m_obj;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -73,29 +76,29 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_invalid() {
|
void set_invalid() {
|
||||||
if (m_initialized == 1) {
|
if (m_initialized) {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
T * operator->() {
|
T * operator->() {
|
||||||
SASSERT(m_initialized==1);
|
SASSERT(m_initialized);
|
||||||
return reinterpret_cast<T *>(m_obj);
|
return &m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
T const * operator->() const {
|
T const * operator->() const {
|
||||||
SASSERT(m_initialized==1);
|
SASSERT(m_initialized);
|
||||||
return reinterpret_cast<T const *>(m_obj);
|
return &m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
const T & operator*() const {
|
const T & operator*() const {
|
||||||
SASSERT(m_initialized==1);
|
SASSERT(m_initialized);
|
||||||
return *reinterpret_cast<T const*>(m_obj);
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
T & operator*() {
|
T & operator*() {
|
||||||
SASSERT(m_initialized==1);
|
SASSERT(m_initialized);
|
||||||
return *reinterpret_cast<T *>(m_obj);
|
return m_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional & operator=(const T & val) {
|
optional & operator=(const T & val) {
|
||||||
|
|
Loading…
Reference in a new issue