3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-06 15:25:46 +00:00

overhaul of error messages. Add warning in dimacs conversion

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-07-04 16:04:37 -07:00
parent e622022bf9
commit 1eb8ccad59
31 changed files with 298 additions and 313 deletions

View file

@ -94,7 +94,7 @@ extern "C" {
CHECK_NON_NULL(m, nullptr);
func_interp * _fi = to_model_ref(m)->get_func_interp(to_func_decl(f));
if (!_fi) {
SET_ERROR_CODE(Z3_INVALID_ARG);
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
RETURN_Z3(nullptr);
}
Z3_func_interp_ref * fi = alloc(Z3_func_interp_ref, *mk_c(c), to_model_ref(m));
@ -123,7 +123,7 @@ extern "C" {
RETURN_Z3(of_func_decl(_m->get_constant(i)));
}
else {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(nullptr);
@ -142,7 +142,7 @@ extern "C" {
CHECK_NON_NULL(m, nullptr);
model * _m = to_model_ref(m);
if (i >= _m->get_num_functions()) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
return nullptr;
}
return of_func_decl(_m->get_function(i));
@ -187,7 +187,7 @@ extern "C" {
LOG_Z3_model_get_sort(c, m, i);
RESET_ERROR_CODE();
if (i >= to_model_ref(m)->get_num_uninterpreted_sorts()) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
RETURN_Z3(nullptr);
}
sort * s = to_model_ref(m)->get_uninterpreted_sort(i);
@ -200,7 +200,7 @@ extern "C" {
LOG_Z3_model_get_sort_universe(c, m, s);
RESET_ERROR_CODE();
if (!to_model_ref(m)->has_uninterpreted_sort(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
RETURN_Z3(nullptr);
}
ptr_vector<expr> const & universe = to_model_ref(m)->get_universe(to_sort(s));
@ -242,7 +242,7 @@ extern "C" {
RETURN_Z3(of_func_decl(to_func_decl(to_app(a)->get_decl()->get_parameter(0).get_ast())));
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG);
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(nullptr);
@ -269,7 +269,7 @@ extern "C" {
RESET_ERROR_CODE();
func_decl* d = to_func_decl(f);
if (d->get_arity() != 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
}
else {
model* mdl = to_model_ref(m);
@ -313,7 +313,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(f, nullptr);
if (i >= to_func_interp_ref(f)->num_entries()) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
RETURN_Z3(nullptr);
}
Z3_func_entry_ref * e = alloc(Z3_func_entry_ref, *mk_c(c), to_func_interp(f)->m_model.get());
@ -364,7 +364,7 @@ extern "C" {
func_interp* _fi = to_func_interp_ref(fi);
expr* _value = to_expr(value);
if (to_ast_vector_ref(args).size() != _fi->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
return;
}
// check sorts of value
@ -416,7 +416,7 @@ extern "C" {
LOG_Z3_func_entry_get_arg(c, e, i);
RESET_ERROR_CODE();
if (i >= to_func_entry(e)->m_func_interp->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
RETURN_Z3(nullptr);
}
expr * r = to_func_entry(e)->m_func_entry->get_arg(i);
@ -434,7 +434,7 @@ extern "C" {
if (g) {
return g->num_entries();
}
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
return 0;
}
return 0;
@ -448,7 +448,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
if (j >= get_model_func_num_entries_core(c, m, i)) {
SET_ERROR_CODE(Z3_IOB);
SET_ERROR_CODE(Z3_IOB, nullptr);
return 0;
}
Z3_func_decl d = get_model_func_decl_core(c, m, i);