3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-27 01:12:40 +00:00

Use macros to disable semi-colon warnings for blocks of macros. (#10192)

This is another PR towards the goal of getting Z3 to compile cleanly
when included via FetchContents into clang-tidy, which uses a pretty
strict set of warnings.

This PR completes the job started by
https://github.com/Z3Prover/z3/pull/10169. It adds `-Wextra-semi` to the
set of CLANG_ONLY_WARNINGS, and adds
```
START_DISABLE_EXTRA_SEMI_WARNING;
...macro invocations with trailing semis...
END_DISABLE_WARNING;
```
around all the blocks of macro invocations that provoked warnings.

(Additionally, in realclosure.h, there was one block of macro
invocations that did *not* follow the trailing-semi pattern; changed
that to look like all the others).
This commit is contained in:
davedets 2026-07-22 18:01:50 -07:00 committed by GitHub
parent f8f763bdf1
commit 35b0b42d2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 107 additions and 5 deletions

View file

@ -21,6 +21,7 @@ Revision History:
#include "api/api_util.h"
#include "ast/arith_decl_plugin.h"
#include "math/polynomial/algebraic_numbers.h"
#include "util/manage_warnings.h"
#include <iostream>
@ -76,11 +77,13 @@ extern "C" {
Z3_CATCH_RETURN(nullptr);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_ARITH_OP(Z3_mk_add, OP_ADD);
MK_ARITH_OP(Z3_mk_mul, OP_MUL);
MK_BINARY_ARITH_OP(Z3_mk_power, OP_POWER);
MK_BINARY_ARITH_OP(Z3_mk_mod, OP_MOD);
MK_BINARY_ARITH_OP(Z3_mk_rem, OP_REM);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast n1, Z3_ast n2) {
Z3_TRY;
@ -100,10 +103,12 @@ extern "C" {
Z3_CATCH_RETURN(nullptr);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_ARITH_PRED(Z3_mk_lt, OP_LT);
MK_ARITH_PRED(Z3_mk_gt, OP_GT);
MK_ARITH_PRED(Z3_mk_le, OP_LE);
MK_ARITH_PRED(Z3_mk_ge, OP_GE);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_divides(Z3_context c, Z3_ast n1, Z3_ast n2) {
Z3_TRY;
@ -123,10 +128,12 @@ extern "C" {
Z3_CATCH_RETURN(nullptr);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_UNARY(Z3_mk_abs, mk_c(c)->get_arith_fid(), OP_ABS, SKIP);
MK_UNARY(Z3_mk_int2real, mk_c(c)->get_arith_fid(), OP_TO_REAL, SKIP);
MK_UNARY(Z3_mk_real2int, mk_c(c)->get_arith_fid(), OP_TO_INT, SKIP);
MK_UNARY(Z3_mk_is_int, mk_c(c)->get_arith_fid(), OP_IS_INT, SKIP);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_sub(Z3_context c, unsigned num_args, Z3_ast const args[]) {
Z3_TRY;

View file

@ -20,6 +20,7 @@ Revision History:
#include "api/api_context.h"
#include "api/api_util.h"
#include "ast/array_decl_plugin.h"
#include "util/manage_warnings.h"
extern "C" {
@ -266,12 +267,14 @@ extern "C" {
Z3_CATCH_RETURN(nullptr);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_NARY(Z3_mk_set_union, mk_c(c)->get_array_fid(), OP_SET_UNION, SKIP);
MK_NARY(Z3_mk_set_intersect, mk_c(c)->get_array_fid(), OP_SET_INTERSECT, SKIP);
MK_BINARY(Z3_mk_set_difference, mk_c(c)->get_array_fid(), OP_SET_DIFFERENCE, SKIP);
MK_UNARY(Z3_mk_set_complement, mk_c(c)->get_array_fid(), OP_SET_COMPLEMENT, SKIP);
MK_BINARY(Z3_mk_set_subset, mk_c(c)->get_array_fid(), OP_SET_SUBSET, SKIP);
MK_BINARY(Z3_mk_array_ext, mk_c(c)->get_array_fid(), OP_ARRAY_EXT, SKIP);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_as_array(Z3_context c, Z3_func_decl f) {
Z3_TRY;

View file

@ -39,6 +39,7 @@ Revision History:
#include "util/scoped_ctrl_c.h"
#include "util/cancel_eh.h"
#include "util/scoped_timer.h"
#include "util/manage_warnings.h"
#include "ast/pp_params.hpp"
#include "ast/expr_abstract.h"
@ -297,6 +298,7 @@ extern "C" {
Z3_CATCH_RETURN(nullptr);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_UNARY(Z3_mk_not, mk_c(c)->get_basic_fid(), OP_NOT, SKIP);
MK_BINARY(Z3_mk_eq, mk_c(c)->get_basic_fid(), OP_EQ, SKIP);
MK_NARY(Z3_mk_distinct, mk_c(c)->get_basic_fid(), OP_DISTINCT, SKIP);
@ -305,6 +307,7 @@ extern "C" {
MK_BINARY(Z3_mk_xor, mk_c(c)->get_basic_fid(), OP_XOR, SKIP);
MK_NARY(Z3_mk_and, mk_c(c)->get_basic_fid(), OP_AND, SKIP);
MK_NARY(Z3_mk_or, mk_c(c)->get_basic_fid(), OP_OR, SKIP);
END_DISABLE_WARNING;
Z3_ast mk_ite_core(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
expr * result = mk_c(c)->m().mk_ite(to_expr(t1), to_expr(t2), to_expr(t3));

View file

@ -20,6 +20,7 @@ Revision History:
#include "api/api_context.h"
#include "api/api_util.h"
#include "ast/bv_decl_plugin.h"
#include "util/manage_warnings.h"
extern "C" {
@ -36,6 +37,7 @@ extern "C" {
#define MK_BV_UNARY(NAME, OP) MK_UNARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP)
#define MK_BV_BINARY(NAME, OP) MK_BINARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP)
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BV_UNARY(Z3_mk_bvnot, OP_BNOT);
MK_BV_UNARY(Z3_mk_bvredand, OP_BREDAND);
MK_BV_UNARY(Z3_mk_bvredor, OP_BREDOR);
@ -66,6 +68,7 @@ extern "C" {
MK_BV_BINARY(Z3_mk_bvashr, OP_BASHR);
MK_BV_BINARY(Z3_mk_ext_rotate_left, OP_EXT_ROTATE_LEFT);
MK_BV_BINARY(Z3_mk_ext_rotate_right, OP_EXT_ROTATE_RIGHT);
END_DISABLE_WARNING;
static Z3_ast mk_extract_core(Z3_context c, unsigned high, unsigned low, Z3_ast n) {
expr * _n = to_expr(n);
@ -99,6 +102,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_CATCH_RETURN(0); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BV_PUNARY(Z3_mk_sign_ext, OP_SIGN_EXT);
MK_BV_PUNARY(Z3_mk_zero_ext, OP_ZERO_EXT);
MK_BV_PUNARY(Z3_mk_repeat, OP_REPEAT);
@ -106,6 +110,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
MK_BV_PUNARY(Z3_mk_rotate_left, OP_ROTATE_LEFT);
MK_BV_PUNARY(Z3_mk_rotate_right, OP_ROTATE_RIGHT);
MK_BV_PUNARY(Z3_mk_int2bv, OP_INT2BV);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_bv2int(Z3_context c, Z3_ast n, bool is_signed) {
Z3_TRY;

View file

@ -21,6 +21,7 @@ Revision History:
#include "api/api_context.h"
#include "api/api_util.h"
#include "ast/ast_pp.h"
#include "util/manage_warnings.h"
extern "C" {
@ -287,6 +288,7 @@ extern "C" {
Z3_CATCH_RETURN(0); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_SORTED(Z3_mk_seq_empty, mk_c(c)->sutil().str.mk_empty);
MK_UNARY(Z3_mk_seq_unit, mk_c(c)->get_seq_fid(), OP_SEQ_UNIT, SKIP);
@ -316,6 +318,7 @@ extern "C" {
MK_UNARY(Z3_mk_str_to_int, mk_c(c)->get_seq_fid(), OP_STRING_STOI, SKIP);
MK_UNARY(Z3_mk_ubv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_UBVTOS, SKIP);
MK_UNARY(Z3_mk_sbv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_SBVTOS, SKIP);
END_DISABLE_WARNING;
Z3_ast Z3_API Z3_mk_re_loop(Z3_context c, Z3_ast r, unsigned lo, unsigned hi) {
@ -343,6 +346,7 @@ extern "C" {
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_UNARY(Z3_mk_re_plus, mk_c(c)->get_seq_fid(), OP_RE_PLUS, SKIP);
MK_UNARY(Z3_mk_re_star, mk_c(c)->get_seq_fid(), OP_RE_STAR, SKIP);
MK_UNARY(Z3_mk_re_option, mk_c(c)->get_seq_fid(), OP_RE_OPTION, SKIP);
@ -367,6 +371,7 @@ extern "C" {
MK_TERNARY(Z3_mk_seq_mapi, mk_c(c)->get_seq_fid(), OP_SEQ_MAPI, SKIP);
MK_TERNARY(Z3_mk_seq_foldl, mk_c(c)->get_seq_fid(), OP_SEQ_FOLDL, SKIP);
MK_FOURARY(Z3_mk_seq_foldli, mk_c(c)->get_seq_fid(), OP_SEQ_FOLDLI, SKIP);
END_DISABLE_WARNING;
}

View file

@ -23,6 +23,7 @@ Revision History:
#include "api/api_util.h"
#include "ast/ast_pp.h"
#include "ast/special_relations_decl_plugin.h"
#include "util/manage_warnings.h"
extern "C" {
@ -39,10 +40,12 @@ extern "C" {
Z3_CATCH_RETURN(nullptr); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_SPECIAL_R(Z3_mk_linear_order, OP_SPECIAL_RELATION_LO);
MK_SPECIAL_R(Z3_mk_partial_order, OP_SPECIAL_RELATION_PO);
MK_SPECIAL_R(Z3_mk_piecewise_linear_order, OP_SPECIAL_RELATION_PLO);
MK_SPECIAL_R(Z3_mk_tree_order, OP_SPECIAL_RELATION_TO);
END_DISABLE_WARNING;
#define MK_DECL(NAME, FID) \
@ -60,5 +63,7 @@ extern "C" {
Z3_CATCH_RETURN(nullptr); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_DECL(Z3_mk_transitive_closure, OP_SPECIAL_RELATION_TC);
END_DISABLE_WARNING;
}