summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2019-01-03 17:55:45 +0100
committerAina Niemetz <aina.niemetz@gmail.com>2019-01-03 08:55:45 -0800
commit99278c017e5b198b416d4a82b0ea63f99d02e739 (patch)
treeb23fe16f9043d4358059bd9a0ff1b86cd92b586d /src/api
parentf179953e2fea6955650ccde8414f2ccd8ee6f63b (diff)
C++ API: Reintroduce zero-value mkBitVector method (#2770)
PR #2764 removed `Solver::mkBitVector(uint32_t)` (returns a bit-vector of a given size with value zero), which made the build fail when SymFPU was enabled because solver_black used it for SymFPU-enabled builds. This commit simply adds a zero default argument to `mkBitVector(uint32_t, uint64_t)` to allow users to create zero-valued bit-vectors without explicitly specifying the value again. Additionally, the commit replaces the use of the `CVC4_USE_SYMFPU` macro by a call to `Configuration::isBuiltWithSymFPU()`, making sure that we can catch compile-time errors regardless of configuration. Finally, `Solver::mkConst(Kind, uint32_t, uint32_t, Term)` now checks whether CVC4 has been compiled with SymFPU when creating a `CONST_FLOATINGPOINT` and throws an exception otherwise (solver_black has been updated correspondingly).
Diffstat (limited to 'src/api')
-rw-r--r--src/api/cvc4cpp.cpp3
-rw-r--r--src/api/cvc4cpp.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/api/cvc4cpp.cpp b/src/api/cvc4cpp.cpp
index 8a583a671..c0818f54f 100644
--- a/src/api/cvc4cpp.cpp
+++ b/src/api/cvc4cpp.cpp
@@ -16,6 +16,7 @@
#include "api/cvc4cpp.h"
+#include "base/configuration.h"
#include "base/cvc4_assert.h"
#include "base/cvc4_check.h"
#include "expr/expr.h"
@@ -2325,6 +2326,8 @@ Term Solver::mkConst(Kind kind, uint32_t arg1, uint64_t arg2) const
Term Solver::mkConst(Kind kind, uint32_t arg1, uint32_t arg2, Term arg3) const
{
+ CVC4_API_CHECK(Configuration::isBuiltWithSymFPU())
+ << "Expected CVC4 to be compiled with SymFPU support";
CVC4_API_KIND_CHECK_EXPECTED(kind == CONST_FLOATINGPOINT, kind)
<< "CONST_FLOATINGPOINT";
CVC4_API_ARG_CHECK_EXPECTED(arg1 > 0, arg1) << "a value > 0";
diff --git a/src/api/cvc4cpp.h b/src/api/cvc4cpp.h
index e18e3ac6b..1f74a34a9 100644
--- a/src/api/cvc4cpp.h
+++ b/src/api/cvc4cpp.h
@@ -1969,7 +1969,7 @@ class CVC4_PUBLIC Solver
* @param val the value of the constant
* @return the bit-vector constant
*/
- Term mkBitVector(uint32_t size, uint64_t val) const;
+ Term mkBitVector(uint32_t size, uint64_t val = 0) const;
/**
* Create a bit-vector constant from a given string.
@@ -2157,7 +2157,7 @@ class CVC4_PUBLIC Solver
/**
* Create constant of kind:
- * - CONST_FLOATINGPOINT
+ * - CONST_FLOATINGPOINT (requires CVC4 to be compiled with symFPU support)
* See enum Kind for a description of the parameters.
* @param kind the kind of the constant
* @param arg1 the first argument to this kind
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback