mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 12:53:38 +00:00
overhaul of error messages. Add warning in dimacs conversion
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e622022bf9
commit
1eb8ccad59
31 changed files with 298 additions and 313 deletions
|
@ -62,11 +62,11 @@ extern "C" {
|
|||
Z3_TRY;
|
||||
RESET_ERROR_CODE();
|
||||
if (!mk_c(c)->m().is_bool(to_expr(body))) {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
if (num_patterns > 0 && num_no_patterns > 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
expr * const* ps = reinterpret_cast<expr * const*>(patterns);
|
||||
|
@ -77,7 +77,7 @@ extern "C" {
|
|||
pattern_validator v(mk_c(c)->m());
|
||||
for (unsigned i = 0; i < num_patterns; i++) {
|
||||
if (!v(num_decls, ps[i], 0, 0)) {
|
||||
SET_ERROR_CODE(Z3_INVALID_PATTERN);
|
||||
SET_ERROR_CODE(Z3_INVALID_PATTERN, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ extern "C" {
|
|||
RESET_ERROR_CODE();
|
||||
expr_ref result(mk_c(c)->m());
|
||||
if (num_decls == 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, nullptr);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ extern "C" {
|
|||
LOG_Z3_mk_lambda_const(c, num_decls, vars, body);
|
||||
RESET_ERROR_CODE();
|
||||
if (num_decls == 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, nullptr);
|
||||
RETURN_Z3(0);
|
||||
}
|
||||
|
||||
|
@ -220,17 +220,17 @@ extern "C" {
|
|||
svector<Z3_sort> types;
|
||||
ptr_vector<expr> bound_asts;
|
||||
if (num_patterns > 0 && num_no_patterns > 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
if (num_bound == 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE);
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, "number of bound variables is 0");
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
for (unsigned i = 0; i < num_bound; ++i) {
|
||||
app* a = to_app(bound[i]);
|
||||
if (a->get_kind() != AST_APP) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
symbol s(to_app(a)->get_decl()->get_name());
|
||||
|
@ -238,7 +238,7 @@ extern "C" {
|
|||
types.push_back(of_sort(mk_c(c)->m().get_sort(a)));
|
||||
bound_asts.push_back(a);
|
||||
if (a->get_family_id() != null_family_id || a->get_num_args() != 0) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ extern "C" {
|
|||
for (unsigned i = 0; i < num_no_patterns; ++i) {
|
||||
expr_ref result(mk_c(c)->m());
|
||||
if (!is_app(to_expr(no_patterns[i]))) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
app* pat = to_app(to_expr(no_patterns[i]));
|
||||
|
@ -323,7 +323,7 @@ extern "C" {
|
|||
RESET_ERROR_CODE();
|
||||
for (unsigned i = 0; i < num_patterns; ++i) {
|
||||
if (!is_app(to_expr(terms[i]))) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ extern "C" {
|
|||
return to_quantifier(_a)->get_weight();
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -392,7 +392,7 @@ extern "C" {
|
|||
return to_quantifier(_a)->get_num_patterns();
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -408,7 +408,7 @@ extern "C" {
|
|||
RETURN_Z3(r);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
@ -424,7 +424,7 @@ extern "C" {
|
|||
return to_quantifier(_a)->get_num_no_patterns();
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -440,7 +440,7 @@ extern "C" {
|
|||
RETURN_Z3(r);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
@ -455,7 +455,7 @@ extern "C" {
|
|||
return of_symbol(to_quantifier(_a)->get_decl_names()[i]);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
@ -471,7 +471,7 @@ extern "C" {
|
|||
RETURN_Z3(r);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
@ -487,7 +487,7 @@ extern "C" {
|
|||
RETURN_Z3(r);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
@ -503,7 +503,7 @@ extern "C" {
|
|||
return to_quantifier(_a)->get_num_decls();
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -518,7 +518,7 @@ extern "C" {
|
|||
return _p->get_num_args();
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
return 0;
|
||||
}
|
||||
Z3_CATCH_RETURN(0);
|
||||
|
@ -534,7 +534,7 @@ extern "C" {
|
|||
RETURN_Z3(r);
|
||||
}
|
||||
else {
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR);
|
||||
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue