add_check_c_cxx_flag("-Wno-deprecated")
add_check_cxx_flag("-Wsuggest-override")
add_check_cxx_flag("-Wnon-virtual-dtor")
+add_check_c_cxx_flag("-Wimplicit-fallthrough")
# Temporarily disable -Wclass-memaccess to suppress 'no trivial copy-assignment'
# cdlist.h warnings. Remove when fixed.
** AlwaysAssert may be added.
**/
-#include "cvc4_private.h"
+#include "cvc4_private_library.h"
#ifndef CVC4__CHECK_H
#define CVC4__CHECK_H
#define CVC4_PREDICT_TRUE(x) x
#endif
+#ifdef __has_cpp_attribute
+#if __has_cpp_attribute(fallthrough)
+#define CVC4_FALLTHROUGH [[fallthrough]]
+#endif // __has_cpp_attribute(fallthrough)
+#endif // __has_cpp_attribute
+#ifndef CVC4_FALLTHROUGH
+#define CVC4_FALLTHROUGH
+#endif
+
namespace CVC4 {
// Implementation notes:
**/
#include "parser/smt2/smt2.h"
+#include <algorithm>
+
+#include "base/check.h"
#include "expr/type.h"
#include "options/options.h"
#include "parser/antlr_input.h"
#include "printer/sygus_print_callback.h"
#include "util/bitvector.h"
-#include <algorithm>
-
// ANTLR defines these, which is really bad!
#undef true
#undef false
addOperator(kind::IS_INTEGER, "is_int");
addOperator(kind::TO_REAL, "to_real");
// falling through on purpose, to add Ints part of Reals_Ints
+ CVC4_FALLTHROUGH;
case THEORY_INTS:
defineType("Int", getExprManager()->integerType());
addArithmeticOperators();
checkParent = true;
break;
}
+ CVC4_FALLTHROUGH;
case kind::BITVECTOR_COMP:
case kind::LT:
case kind::LEQ:
{
break;
}
+ CVC4_FALLTHROUGH;
case kind::XOR:
case kind::BITVECTOR_XOR:
case kind::BITVECTOR_XNOR:
// arrays theory
case kind::SELECT:
- case kind::STORE: typeChildren = true;
+ case kind::STORE: typeChildren = true; CVC4_FALLTHROUGH;
case kind::PARTIAL_SELECT_0:
case kind::PARTIAL_SELECT_1:
case kind::ARRAY_TYPE:
parametricTypeChildren = true;
out << smtKindString(k, d_variant) << " ";
break;
- case kind::MEMBER: typeChildren = true;
+ case kind::MEMBER: typeChildren = true; CVC4_FALLTHROUGH;
case kind::INSERT:
case kind::SET_TYPE:
case kind::SINGLETON:
}
// If letification is off or there were 2 children, same treatment as the other cases.
- // (No break is intentional).
+ CVC4_FALLTHROUGH;
case kind::XOR:
case kind::IMPLIES:
case kind::NOT:
convertAndAssertIff(node, negated);
break;
}
+ CVC4_FALLTHROUGH;
default:
{
Node nnode = node;
NodeManager::currentNM()->mkConst(-rat));
}
}
+ return RewriteResponse(REWRITE_DONE, t);
case kind::TO_REAL:
return RewriteResponse(REWRITE_DONE, t[0]);
case kind::TO_INTEGER:
DeltaRational bound = constant;
switch(Kind k = n.getKind()) {
- case kind::LT:
- bound = DeltaRational(constant, -1);
- /* fall through */
- case kind::LEQ:
- if (maxFind == d_maxMap.end() || (*maxFind).second > bound) {
- d_maxMap.insert(n[0], bound);
- Debug("arith::static") << "adding bound " << n << endl;
- }
- break;
- case kind::GT:
- bound = DeltaRational(constant, 1);
- /* fall through */
- case kind::GEQ:
- if (minFind == d_minMap.end() || (*minFind).second < bound) {
- d_minMap.insert(n[0], bound);
- Debug("arith::static") << "adding bound " << n << endl;
- }
- break;
- default: Unhandled() << k; break;
+ case kind::LT: bound = DeltaRational(constant, -1); CVC4_FALLTHROUGH;
+ case kind::LEQ:
+ if (maxFind == d_maxMap.end() || (*maxFind).second > bound)
+ {
+ d_maxMap.insert(n[0], bound);
+ Debug("arith::static") << "adding bound " << n << endl;
+ }
+ break;
+ case kind::GT: bound = DeltaRational(constant, 1); CVC4_FALLTHROUGH;
+ case kind::GEQ:
+ if (minFind == d_minMap.end() || (*minFind).second < bound)
+ {
+ d_minMap.insert(n[0], bound);
+ Debug("arith::static") << "adding bound " << n << endl;
+ }
+ break;
+ default: Unhandled() << k; break;
}
}
}
// intentionally fall through to DISTINCT case!
// entailments of negations are eager exit cases for EQUAL
+ CVC4_FALLTHROUGH;
case DISTINCT:
if(!bestPrimDiff.first.isNull()){
// primDir [dm * dp] <= primDir * dm * U < primDir * sep
Debug("ufsymm:eq") << "UFSYMM " << n[0] << " <==> " << n[1] << endl;
}
}
- /* intentional fall-through! */
+ CVC4_FALLTHROUGH;
case kind::XOR:
// commutative binary operator handling
return n[1] < n[0] ? NodeManager::currentNM()->mkNode(k, n[1], n[0]) : Node(n);
// +/- inf
// sign = x, exp = 11...11, sig = 00...00
- case 1:
- sign = one;
- // Intentional fall-through
+ case 1: sign = one; CVC4_FALLTHROUGH;
case 2: exp = BitVector::mkOnes(e); break;
// +/- zero
// sign = x, exp = 00...00, sig = 00...00
- case 3:
- sign = one;
- // Intentional fall-through
+ case 3: sign = one; CVC4_FALLTHROUGH;
case 4: break;
// +/- max subnormal
// sign = x, exp = 00...00, sig = 11...11
- case 5:
- sign = one;
- // Intentional fall-through
+ case 5: sign = one; CVC4_FALLTHROUGH;
case 6: sig = BitVector::mkOnes(s - 1); break;
// +/- min subnormal
// sign = x, exp = 00...00, sig = 00...01
- case 7:
- sign = one;
- // Intentional fall-through
+ case 7: sign = one; CVC4_FALLTHROUGH;
case 8: sig = BitVector(s - 1, static_cast<unsigned int>(1)); break;
// +/- max normal
// sign = x, exp = 11...10, sig = 11...11
- case 9:
- sign = one;
- // Intentional fall-through
+ case 9: sign = one; CVC4_FALLTHROUGH;
case 10:
exp = BitVector::mkOnes(e) - BitVector(e, static_cast<unsigned int>(1));
sig = BitVector::mkOnes(s - 1);
// +/- min normal
// sign = x, exp = 00...01, sig = 00...00
- case 11:
- sign = one;
- // Intentional fall-through
+ case 11: sign = one; CVC4_FALLTHROUGH;
case 12: exp = BitVector(e, static_cast<unsigned int>(1)); break;
default: Unreachable();
TS_ASSERT_EQUALS(Rewriter::rewrite(leq0), Rewriter::rewrite(geq1.notNode()));
TS_ASSERT_EQUALS(Rewriter::rewrite(leq1), Rewriter::rewrite(geq2.notNode()));
+
+ // (abs x) --> (abs x)
+ Node absX = d_nm->mkNode(ABS, x);
+ TS_ASSERT_EQUALS(Rewriter::rewrite(absX), absX);
}
};