mirror of
https://github.com/Z3Prover/z3
synced 2025-06-04 05:11:21 +00:00
fix a few warnings & simplify debug.h header
This commit is contained in:
parent
a97bc65af4
commit
d8cea7c8d5
6 changed files with 24 additions and 56 deletions
|
@ -549,8 +549,7 @@ namespace polynomial {
|
||||||
increase_capacity(sz * 2);
|
increase_capacity(sz * 2);
|
||||||
SASSERT(sz < m_capacity);
|
SASSERT(sz < m_capacity);
|
||||||
m_ptr->m_size = sz;
|
m_ptr->m_size = sz;
|
||||||
if (sz == 0) return;
|
std::uninitialized_copy(pws, pws + sz, m_ptr->m_powers);
|
||||||
memcpy(m_ptr->m_powers, pws, sizeof(power) * sz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
|
|
@ -209,7 +209,6 @@ namespace smt {
|
||||||
expr* s = nullptr, *idx = nullptr, *r = nullptr;
|
expr* s = nullptr, *idx = nullptr, *r = nullptr;
|
||||||
expr* e = ctx.bool_var2expr(lit.var());
|
expr* e = ctx.bool_var2expr(lit.var());
|
||||||
VERIFY(sk().is_accept(e, s, idx, r));
|
VERIFY(sk().is_accept(e, s, idx, r));
|
||||||
expr* t = nullptr;
|
|
||||||
if (i > th.m_max_unfolding_depth &&
|
if (i > th.m_max_unfolding_depth &&
|
||||||
th.m_max_unfolding_lit != null_literal &&
|
th.m_max_unfolding_lit != null_literal &&
|
||||||
ctx.get_assignment(th.m_max_unfolding_lit) == l_true &&
|
ctx.get_assignment(th.m_max_unfolding_lit) == l_true &&
|
||||||
|
|
|
@ -400,7 +400,6 @@ literal induction_lemmas::mk_literal(expr* e) {
|
||||||
|
|
||||||
|
|
||||||
bool induction_lemmas::operator()(literal lit) {
|
bool induction_lemmas::operator()(literal lit) {
|
||||||
unsigned num = m_num_lemmas;
|
|
||||||
enode* r = ctx.bool_var2enode(lit.var());
|
enode* r = ctx.bool_var2enode(lit.var());
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -410,6 +409,7 @@ bool induction_lemmas::operator()(literal lit) {
|
||||||
}
|
}
|
||||||
return !combinations.empty();
|
return !combinations.empty();
|
||||||
#else
|
#else
|
||||||
|
unsigned num = m_num_lemmas;
|
||||||
expr_ref_vector sks(m);
|
expr_ref_vector sks(m);
|
||||||
expr_safe_replace rep(m);
|
expr_safe_replace rep(m);
|
||||||
// have to be non-overlapping:
|
// have to be non-overlapping:
|
||||||
|
@ -494,7 +494,6 @@ void induction_lemmas::apply_induction(literal lit, induction_positions_t const
|
||||||
SASSERT(is_app(t));
|
SASSERT(is_app(t));
|
||||||
args.reset();
|
args.reset();
|
||||||
unsigned sz = todo.size();
|
unsigned sz = todo.size();
|
||||||
unsigned i = 0;
|
|
||||||
expr* s = nullptr;
|
expr* s = nullptr;
|
||||||
for (unsigned i = 0; i < to_app(t)->get_num_args(); ++i) {
|
for (unsigned i = 0; i < to_app(t)->get_num_args(); ++i) {
|
||||||
expr* arg = to_app(t)->get_arg(i);
|
expr* arg = to_app(t)->get_arg(i);
|
||||||
|
|
|
@ -7045,10 +7045,10 @@ namespace smt {
|
||||||
void theory_str::check_consistency_prefix(expr * e, bool is_true) {
|
void theory_str::check_consistency_prefix(expr * e, bool is_true) {
|
||||||
context & ctx = get_context();
|
context & ctx = get_context();
|
||||||
ast_manager & m = get_manager();
|
ast_manager & m = get_manager();
|
||||||
expr * needle;
|
expr * needle = nullptr;
|
||||||
expr * haystack;
|
expr * haystack = nullptr;
|
||||||
|
|
||||||
u.str.is_prefix(e, needle, haystack);
|
VERIFY(u.str.is_prefix(e, needle, haystack));
|
||||||
TRACE("str", tout << "check consistency of prefix predicate: " << mk_pp(needle, m) << " prefixof " << mk_pp(haystack, m) << std::endl;);
|
TRACE("str", tout << "check consistency of prefix predicate: " << mk_pp(needle, m) << " prefixof " << mk_pp(haystack, m) << std::endl;);
|
||||||
|
|
||||||
zstring needleStringConstant;
|
zstring needleStringConstant;
|
||||||
|
@ -7072,10 +7072,10 @@ namespace smt {
|
||||||
void theory_str::check_consistency_suffix(expr * e, bool is_true) {
|
void theory_str::check_consistency_suffix(expr * e, bool is_true) {
|
||||||
context & ctx = get_context();
|
context & ctx = get_context();
|
||||||
ast_manager & m = get_manager();
|
ast_manager & m = get_manager();
|
||||||
expr * needle;
|
expr * needle = nullptr;
|
||||||
expr * haystack;
|
expr * haystack = nullptr;
|
||||||
|
|
||||||
u.str.is_suffix(e, needle, haystack);
|
VERIFY(u.str.is_suffix(e, needle, haystack));
|
||||||
TRACE("str", tout << "check consistency of suffix predicate: " << mk_pp(needle, m) << " suffixof " << mk_pp(haystack, m) << std::endl;);
|
TRACE("str", tout << "check consistency of suffix predicate: " << mk_pp(needle, m) << " suffixof " << mk_pp(haystack, m) << std::endl;);
|
||||||
|
|
||||||
zstring needleStringConstant;
|
zstring needleStringConstant;
|
||||||
|
@ -7099,10 +7099,10 @@ namespace smt {
|
||||||
void theory_str::check_consistency_contains(expr * e, bool is_true) {
|
void theory_str::check_consistency_contains(expr * e, bool is_true) {
|
||||||
context & ctx = get_context();
|
context & ctx = get_context();
|
||||||
ast_manager & m = get_manager();
|
ast_manager & m = get_manager();
|
||||||
expr * needle;
|
expr * needle = nullptr;
|
||||||
expr * haystack;
|
expr * haystack = nullptr;
|
||||||
|
|
||||||
u.str.is_contains(e, haystack, needle); // first string contains second one
|
VERIFY(u.str.is_contains(e, haystack, needle)); // first string contains second one
|
||||||
TRACE("str", tout << "check consistency of contains predicate: " << mk_pp(haystack, m) << " contains " << mk_pp(needle, m) << std::endl;);
|
TRACE("str", tout << "check consistency of contains predicate: " << mk_pp(haystack, m) << " contains " << mk_pp(needle, m) << std::endl;);
|
||||||
|
|
||||||
zstring needleStringConstant;
|
zstring needleStringConstant;
|
||||||
|
|
|
@ -36,13 +36,13 @@ bool assertions_enabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_assertion_violation(const char * fileName, int line, const char * condition) {
|
void notify_assertion_violation(const char * fileName, int line, const char * condition) {
|
||||||
std::cerr << "ASSERTION VIOLATION\n";
|
std::cerr << "ASSERTION VIOLATION\n"
|
||||||
std::cerr << "File: " << fileName << "\n";
|
"File: " << fileName << "\n"
|
||||||
std::cerr << "Line: " << line << "\n";
|
"Line: " << line << '\n'
|
||||||
std::cerr << condition << "\n";
|
<< condition << '\n';
|
||||||
#ifndef Z3DEBUG
|
#ifndef Z3DEBUG
|
||||||
std::cerr << Z3_FULL_VERSION << "\n";
|
std::cerr << Z3_FULL_VERSION "\n"
|
||||||
std::cerr << "Please file an issue with this message and more detail about how you encountered it at https://github.com/Z3Prover/z3/issues/new\n";
|
"Please file an issue with this message and more detail about how you encountered it at https://github.com/Z3Prover/z3/issues/new\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,25 +16,13 @@ Author:
|
||||||
Revision History:
|
Revision History:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
#ifndef DEBUG_H_
|
#pragma once
|
||||||
#define DEBUG_H_
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void enable_assertions(bool f);
|
void enable_assertions(bool f);
|
||||||
bool assertions_enabled();
|
bool assertions_enabled();
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define _CRTDBG_MAP_ALLOC
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include<new>
|
|
||||||
#include<crtdbg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __has_builtin
|
|
||||||
# define __has_builtin(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "util/error_codes.h"
|
#include "util/error_codes.h"
|
||||||
#include "util/warning.h"
|
#include "util/warning.h"
|
||||||
|
|
||||||
|
@ -75,44 +63,27 @@ bool is_debug_enabled(const char * tag);
|
||||||
#define CASSERT(TAG, COND) DEBUG_CODE(if (assertions_enabled() && is_debug_enabled(TAG) && !(COND)) { notify_assertion_violation(__FILE__, __LINE__, #COND); INVOKE_DEBUGGER(); })
|
#define CASSERT(TAG, COND) DEBUG_CODE(if (assertions_enabled() && is_debug_enabled(TAG) && !(COND)) { notify_assertion_violation(__FILE__, __LINE__, #COND); INVOKE_DEBUGGER(); })
|
||||||
#define XASSERT(COND, EXTRA_CODE) DEBUG_CODE(if (assertions_enabled() && !(COND)) { notify_assertion_violation(__FILE__, __LINE__, #COND); { EXTRA_CODE } INVOKE_DEBUGGER(); })
|
#define XASSERT(COND, EXTRA_CODE) DEBUG_CODE(if (assertions_enabled() && !(COND)) { notify_assertion_violation(__FILE__, __LINE__, #COND); { EXTRA_CODE } INVOKE_DEBUGGER(); })
|
||||||
|
|
||||||
/**
|
|
||||||
We use __builtin_unreachable where possible to suppress control flow compilation warnings, but it should
|
|
||||||
not be called because its behavior is undefined, so we do need to exit before "calling" it.
|
|
||||||
*/
|
|
||||||
#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 405)) || __has_builtin(__builtin_unreachable)
|
|
||||||
# define EXIT_WITH(ERR_CODE) { exit(ERR_CODE); __builtin_unreachable(); } ((void) 0)
|
|
||||||
#else
|
|
||||||
# define EXIT_WITH(ERR_CODE) { exit(ERR_CODE); } ((void) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
# define UNREACHABLE() DEBUG_CODE(notify_assertion_violation(__FILE__, __LINE__, "UNREACHABLE CODE WAS REACHED."); INVOKE_DEBUGGER();)
|
# define UNREACHABLE() DEBUG_CODE(notify_assertion_violation(__FILE__, __LINE__, "UNREACHABLE CODE WAS REACHED."); INVOKE_DEBUGGER();)
|
||||||
#else
|
#else
|
||||||
# define UNREACHABLE() { notify_assertion_violation(__FILE__, __LINE__, "UNREACHABLE CODE WAS REACHED."); EXIT_WITH(ERR_UNREACHABLE); } ((void) 0)
|
# define UNREACHABLE() { notify_assertion_violation(__FILE__, __LINE__, "UNREACHABLE CODE WAS REACHED."); exit(ERR_UNREACHABLE); } ((void) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
# define NOT_IMPLEMENTED_YET() DEBUG_CODE(notify_assertion_violation(__FILE__, __LINE__, "NOT IMPLEMENTED YET!"); INVOKE_DEBUGGER();)
|
# define NOT_IMPLEMENTED_YET() DEBUG_CODE(notify_assertion_violation(__FILE__, __LINE__, "NOT IMPLEMENTED YET!"); INVOKE_DEBUGGER();)
|
||||||
#else
|
#else
|
||||||
# define NOT_IMPLEMENTED_YET() { notify_assertion_violation(__FILE__, __LINE__, "NOT IMPLEMENTED YET!"); EXIT_WITH(ERR_NOT_IMPLEMENTED_YET); } ((void) 0)
|
# define NOT_IMPLEMENTED_YET() { notify_assertion_violation(__FILE__, __LINE__, "NOT IMPLEMENTED YET!"); exit(ERR_NOT_IMPLEMENTED_YET); } ((void) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERIFY(_x_) if (!(_x_)) { \
|
#define VERIFY(_x_) if (!(_x_)) { \
|
||||||
std::cerr << "Failed to verify: " << #_x_ << "\n"; \
|
notify_assertion_violation(__FILE__, __LINE__, "Failed to verify: " #_x_ "\n"); \
|
||||||
UNREACHABLE(); \
|
exit(ERR_UNREACHABLE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ENSURE(_x_) \
|
#define ENSURE(_x_) VERIFY(_x_)
|
||||||
if (!(_x_)) { \
|
|
||||||
std::cerr << "Failed to verify: " << #_x_ << "\n"; \
|
|
||||||
exit(-1); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void finalize_debug();
|
void finalize_debug();
|
||||||
/*
|
/*
|
||||||
ADD_FINALIZER('finalize_debug();')
|
ADD_FINALIZER('finalize_debug();')
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* DEBUG_H_ */
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue