Skip to content

Commit 3e650c3

Browse files
committed
Remove NEW_Z3 macro
1 parent dab0180 commit 3e650c3

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ matrix:
6363
compiler: gcc
6464
script:
6565
- make clean
66+
- cp externals/z3_version_old.h externals/z3_version.h
6667
- make USE_Z3=yes -j2 all
6768
- ./testrunner TestExprEngine
6869
- python3 test/bug-hunting/cve.py

externals/z3_version_old.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef Z3_MAJOR_VERSION
2+
#define Z3_MAJOR_VERSION 0
3+
#endif
4+
5+
#ifndef Z3_MINOR_VERSION
6+
#define Z3_MINOR_VERSION 0
7+
#endif
8+
9+
#ifndef Z3_BUILD_NUMBER
10+
#define Z3_BUILD_NUMBER 0
11+
#endif
12+

lib/exprengine.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@
142142
#include <iostream>
143143
#ifdef USE_Z3
144144
#include <z3++.h>
145+
#include <z3_version.h>
146+
#define GET_VERSION_INT(A,B,C) ((A) * 10000 + (B) * 100 + (C))
147+
#define Z3_VERSION_INT GET_VERSION_INT(Z3_MAJOR_VERSION, Z3_MINOR_VERSION, Z3_BUILD_NUMBER)
145148
#endif
146149

147150
namespace {
@@ -782,7 +785,7 @@ struct ExprData {
782785
}
783786

784787
z3::expr addFloat(const std::string &name) {
785-
#ifdef NEW_Z3
788+
#if Z3_VERSION_INT >= GET_VERSION_INT(4,8,0)
786789
z3::expr e = context.fpa_const(name.c_str(), 11, 53);
787790
#else
788791
z3::expr e = context.real_const(name.c_str());
@@ -804,7 +807,7 @@ struct ExprData {
804807
if (b->binop == "/")
805808
return op1 / op2;
806809
if (b->binop == "%")
807-
#ifdef NEW_Z3
810+
#if Z3_VERSION_INT >= GET_VERSION_INT(4,8,0)
808811
return op1 % op2;
809812
#else
810813
return op1 - (op1 / op2) * op2;
@@ -837,7 +840,7 @@ struct ExprData {
837840
throw VerifyException(nullptr, "Can not solve expressions, operand value is null");
838841
if (auto intRange = std::dynamic_pointer_cast<ExprEngine::IntRange>(v)) {
839842
if (intRange->name[0] != '$')
840-
#ifdef NEW_Z3
843+
#if Z3_VERSION_INT >= GET_VERSION_INT(4,8,0)
841844
return context.int_val(int64_t(intRange->minValue));
842845
#else
843846
return context.int_val((long long)(intRange->minValue));

0 commit comments

Comments
 (0)