3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-08-03 04:33:28 +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

@ -346,6 +346,7 @@ public:
is_pi(n);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_uminus);
MATCH_UNARY(is_to_real);
MATCH_UNARY(is_to_int);
@ -378,6 +379,7 @@ public:
MATCH_UNARY(is_tan);
MATCH_UNARY(is_atan);
MATCH_UNARY(is_atanh);
END_DISABLE_WARNING;
};

View file

@ -19,6 +19,7 @@ Revision History:
#pragma once
#include "ast/ast.h"
#include "util/manage_warnings.h"
inline sort* get_array_range(sort const * s) {
@ -207,7 +208,9 @@ public:
}
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_BINARY(is_subset);
END_DISABLE_WARNING;
};
class array_util : public array_recognizers {

View file

@ -390,6 +390,7 @@ public:
return is_int2bv(e) && (n = to_app(e)->get_parameter(0).get_int(), x = to_app(e)->get_arg(0), true);
}
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_bv_not);
MATCH_UNARY(is_redand);
MATCH_UNARY(is_redor);
@ -439,6 +440,7 @@ public:
MATCH_BINARY(is_bv_smod0);
MATCH_UNARY(is_bit2bool);
MATCH_UNARY(is_int2bv);
END_DISABLE_WARNING;
bool is_bit2bool(expr* e, expr*& bv, unsigned& idx) const;
rational norm(rational const & val, unsigned bv_size, bool is_signed = false) const ;

View file

@ -22,6 +22,7 @@ Revision History:
--*/
#pragma once
#include "util/manage_warnings.h"
#include "util/zstring.h"
#include "ast/ast.h"
#include <string>
@ -97,11 +98,13 @@ public:
bool is_bv2char(expr const* e) const { return is_app_of(e, m_family_id, OP_CHAR_FROM_BV); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_is_digit);
MATCH_UNARY(is_to_int);
MATCH_UNARY(is_char2bv);
MATCH_UNARY(is_bv2char);
MATCH_BINARY(is_le);
END_DISABLE_WARNING;
static unsigned max_char() { return zstring::max_char(); }

View file

@ -27,6 +27,7 @@ Revision History:
#include "util/symbol_table.h"
#include "util/obj_hashtable.h"
#include "util/dictionary.h"
#include "util/manage_warnings.h"
enum sort_kind {
@ -424,9 +425,13 @@ namespace datatype {
bool is_recognizer(expr const * f) const { return is_app(f) && (is_recognizer0(to_app(f)) || is_is(to_app(f))); }
bool is_considered_uninterpreted(func_decl * f, unsigned n, expr* const* args);
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_recognizer);
END_DISABLE_WARNING;
bool is_accessor(expr const* e) const { return is_app(e) && is_app_of(to_app(e), fid(), OP_DT_ACCESSOR); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_accessor);
END_DISABLE_WARNING;
bool is_update_field(expr * f) const { return is_app(f) && is_app_of(to_app(f), fid(), OP_DT_UPDATE_FIELD); }
app* mk_is(func_decl * c, expr *f);
ptr_vector<func_decl> const * get_datatype_constructors(sort * ty);

View file

@ -30,6 +30,7 @@ Operators:
#include "ast/ast.h"
#include "ast/polymorphism_util.h"
#include "util/manage_warnings.h"
enum finite_set_sort_kind {
FINITE_SET_SORT
@ -137,6 +138,7 @@ public:
bool is_range(expr const* n) const { return is_app_of(n, m_fid, OP_FINITE_SET_RANGE); }
bool is_unique_set(expr const *n) const { return is_app_of(n, m_fid, OP_FINITE_SET_UNIQUE_SET); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_singleton);
MATCH_UNARY(is_size);
MATCH_BINARY(is_union);
@ -148,6 +150,7 @@ public:
MATCH_BINARY(is_filter);
MATCH_BINARY(is_range);
MATCH_BINARY(is_unique_set);
END_DISABLE_WARNING;
};
class finite_set_util : public finite_set_recognizers {

View file

@ -22,6 +22,7 @@ Revision History:
#include "util/id_gen.h"
#include "ast/arith_decl_plugin.h"
#include "ast/bv_decl_plugin.h"
#include "util/manage_warnings.h"
#include "util/mpf.h"
enum fpa_sort_kind {
@ -366,6 +367,8 @@ public:
bool is_considered_uninterpreted(func_decl* f, unsigned n, expr* const* args);
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_TERNARY(is_fp);
END_DISABLE_WARNING;
};

View file

@ -23,6 +23,7 @@ Notes:
#include "ast/rewriter/bool_rewriter.h"
#include "ast/rewriter/th_rewriter.h"
#include "util/ref_util.h"
#include "util/manage_warnings.h"
#include "ast/ast_smt2_pp.h"
struct blaster_cfg {
@ -246,9 +247,11 @@ void OP(expr * arg, expr_ref & result) { \
result = mk_mkbv(m_out); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_UNARY_REDUCE(reduce_not, mk_not);
MK_UNARY_REDUCE(reduce_redor, mk_redor);
MK_UNARY_REDUCE(reduce_redand, mk_redand);
END_DISABLE_WARNING;
#define MK_BIN_REDUCE(OP, BB_OP) \
void OP(expr * arg1, expr * arg2, expr_ref & result) { \
@ -260,6 +263,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { \
result = mk_mkbv(m_out); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BIN_REDUCE(reduce_shl, mk_shl);
MK_BIN_REDUCE(reduce_ashr, mk_ashr);
MK_BIN_REDUCE(reduce_lshr, mk_lshr);
@ -270,6 +274,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { \
MK_BIN_REDUCE(reduce_smod, mk_smod);
MK_BIN_REDUCE(reduce_ext_rotate_left, mk_ext_rotate_left);
MK_BIN_REDUCE(reduce_ext_rotate_right, mk_ext_rotate_right);
END_DISABLE_WARNING;
#define MK_BIN_AC_REDUCE(OP, BIN_OP, BB_OP) \
MK_BIN_REDUCE(BIN_OP, BB_OP); \
@ -283,12 +288,14 @@ void OP(unsigned num_args, expr * const * args, expr_ref & result) { \
} \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BIN_AC_REDUCE(reduce_add, reduce_bin_add, mk_adder);
MK_BIN_AC_REDUCE(reduce_mul, reduce_bin_mul, mk_multiplier);
MK_BIN_AC_REDUCE(reduce_and, reduce_bin_and, mk_and);
MK_BIN_AC_REDUCE(reduce_or, reduce_bin_or, mk_or);
MK_BIN_AC_REDUCE(reduce_xor, reduce_bin_xor, mk_xor);
END_DISABLE_WARNING;
#define MK_BIN_PRED_REDUCE(OP, BB_OP) \
@ -299,12 +306,14 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) {
m_blaster.BB_OP(m_in1.size(), m_in1.data(), m_in2.data(), result); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BIN_PRED_REDUCE(reduce_eq, mk_eq);
MK_BIN_PRED_REDUCE(reduce_sle, mk_sle);
MK_BIN_PRED_REDUCE(reduce_ule, mk_ule);
MK_BIN_PRED_REDUCE(reduce_umul_no_overflow, mk_umul_no_overflow);
MK_BIN_PRED_REDUCE(reduce_smul_no_overflow, mk_smul_no_overflow);
MK_BIN_PRED_REDUCE(reduce_smul_no_underflow, mk_smul_no_underflow);
END_DISABLE_WARNING;
#define MK_PARAMETRIC_UNARY_REDUCE(OP, BB_OP) \
void OP(expr * arg, unsigned n, expr_ref & result) { \
@ -315,7 +324,9 @@ void OP(expr * arg, unsigned n, expr_ref & result) { \
result = mk_mkbv(m_out); \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend);
END_DISABLE_WARNING;
void reduce_ite(expr * arg1, expr * arg2, expr * arg3, expr_ref & result) {
m_in1.reset();

View file

@ -20,6 +20,7 @@ Revision History:
#include "util/rational.h"
#include "util/common_msgs.h"
#include "util/manage_warnings.h"
#include "ast/rewriter/bit_blaster/bit_blaster_tpl.h"
#include "ast/ast_pp.h"
#include "ast/rewriter/rewriter_types.h"
@ -1075,12 +1076,14 @@ void bit_blaster_tpl<Cfg>::NAME(unsigned sz, expr * const * a_bits, expr * const
} \
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BINARY(mk_and, mk_and);
MK_BINARY(mk_or, mk_or);
MK_BINARY(mk_xor, mk_xor);
MK_BINARY(mk_xnor, mk_iff);
MK_BINARY(mk_nand, mk_nand);
MK_BINARY(mk_nor, mk_nor);
END_DISABLE_WARNING;
template<typename Cfg>
void bit_blaster_tpl<Cfg>::mk_redand(unsigned sz, expr * const * a_bits, expr_ref_vector & out_bits) {

View file

@ -22,6 +22,7 @@ Notes:
#include "ast/bv_decl_plugin.h"
#include "ast/arith_decl_plugin.h"
#include "ast/rewriter/mk_extract_proc.h"
#include "util/manage_warnings.h"
class bv_rewriter_core {
protected:
@ -237,12 +238,14 @@ public:
return result;
}
START_DISABLE_EXTRA_SEMI_WARNING;
MK_BV_BINARY(mk_bv_urem);
MK_BV_BINARY(mk_ule);
MK_BV_BINARY(mk_sle);
MK_BV_BINARY(mk_bv_add);
MK_BV_BINARY(mk_bv_mul);
MK_BV_BINARY(mk_bv_sub);
END_DISABLE_WARNING;
expr_ref mk_ubv2int(expr* a) {

View file

@ -21,6 +21,7 @@ Author:
#include "ast/seq_decl_plugin.h"
#include "ast/arith_decl_plugin.h"
#include "ast/rewriter/th_rewriter.h"
#include "util/manage_warnings.h"
namespace seq {
@ -147,7 +148,9 @@ namespace seq {
bool is_align(expr const* e) const { return is_skolem(symbol("seq.align.m"), e); }
bool is_align_l(expr const* e) const { return is_skolem(symbol("seq.align.l"), e); }
bool is_align_r(expr const* e) const { return is_skolem(symbol("seq.align.r"), e); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_BINARY(is_align);
END_DISABLE_WARNING;
bool is_post(expr* e, expr*& s, expr*& start);
bool is_pre(expr* e, expr*& s, expr*& i);
bool is_eq(expr* e, expr*& a, expr*& b) const;

View file

@ -25,6 +25,7 @@ Revision History:
#include "ast/ast.h"
#include "ast/char_decl_plugin.h"
#include "util/lbool.h"
#include "util/manage_warnings.h"
#include "util/zstring.h"
enum seq_sort_kind {
@ -271,10 +272,12 @@ public:
app* mk_skolem(symbol const& name, unsigned n, expr* const* args, sort* range);
bool is_skolem(expr const* e) const { return is_app_of(e, m_fid, _OP_SEQ_SKOLEM); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_BINARY(is_char_le);
MATCH_UNARY(is_char2int);
MATCH_UNARY(is_char2bv);
MATCH_UNARY(is_bv2char);
END_DISABLE_WARNING;
bool has_re() const { return seq.has_re(); }
bool has_seq() const { return seq.has_seq(); }
@ -394,6 +397,7 @@ public:
return (u.is_seq(s) && !u.is_string(s));
}
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_BINARY(is_concat);
MATCH_UNARY(is_length);
MATCH_TERNARY(is_extract);
@ -425,6 +429,7 @@ public:
MATCH_UNARY(is_to_code);
MATCH_BINARY(is_in_re);
MATCH_UNARY(is_unit);
END_DISABLE_WARNING;
void get_concat(expr* e, expr_ref_vector& es) const;
void get_concat(expr* e, ptr_vector<expr>& es) const;
@ -579,6 +584,7 @@ public:
bool is_of_pred(expr const* n) const { return is_app_of(n, m_fid, OP_RE_OF_PRED); }
bool is_reverse(expr const* n) const { return is_app_of(n, m_fid, OP_RE_REVERSE); }
bool is_derivative(expr const* n) const { return is_app_of(n, m_fid, OP_RE_DERIVATIVE); }
START_DISABLE_EXTRA_SEMI_WARNING;
MATCH_UNARY(is_to_re);
MATCH_BINARY(is_concat);
MATCH_BINARY(is_union);
@ -593,6 +599,7 @@ public:
MATCH_UNARY(is_of_pred);
MATCH_UNARY(is_reverse);
MATCH_BINARY(is_derivative);
END_DISABLE_WARNING;
bool is_loop(expr const* n, expr*& body, unsigned& lo, unsigned& hi) const;
bool is_loop(expr const* n, expr*& body, unsigned& lo) const;
bool is_loop(expr const* n, expr*& body, expr*& lo, expr*& hi) const;