3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-17 12:35:44 +00:00

Remove unnecessary semicolons (Attempt 2) (#10020)

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 is a second version of https://github.com/Z3Prover/z3/pull/9957. I
address @NikolajBjorner 's comments about not changing the semicolons
after macro invocations, because some editors work better with them
present. It now, to the best of my ability, only deletes semis:

* after the closing brace of namespace decl.
* after the closing brace of an extern "C" decl.
* after a function definition.

This PR is very large, but it consists entirely of deletions of
semicolons in these situations.

(If there was a way to update the previous PR, which had been closed,
and that is preferable, please let me know. I couldn't figure it out.)
This commit is contained in:
davedets 2026-07-02 12:47:29 -07:00 committed by GitHub
parent 69444de05b
commit 6ac3075022
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
429 changed files with 477 additions and 476 deletions

View file

@ -24,7 +24,7 @@ class sexpr;
namespace algebraic_numbers {
class anum;
class manager;
};
}
enum arith_sort_kind {
REAL_SORT,

View file

@ -171,7 +171,7 @@ namespace datatype {
size* subst(obj_map<sort, size*>& S) override;
sort_size eval(obj_map<sort, sort_size> const& S) override { return S[m_param]; }
};
};
}
class def {
ast_manager& m;
@ -465,7 +465,7 @@ namespace datatype {
sort_ref mk_tuple_datatype(svector<std::pair<symbol, sort*>> const& elems, symbol const& name, symbol const& test, func_decl_ref& tup, func_decl_ref_vector& accs);
};
};
}
typedef datatype::accessor accessor_decl;
typedef datatype::constructor constructor_decl;

View file

@ -648,7 +648,7 @@ namespace datalog {
m_fid = m.mk_family_id(symbol("datalog_relation"));
}
return m_fid;
};
}
arith_util& dl_decl_util::arith() const {
if (!m_arith) m_arith = alloc(arith_util, m);
@ -788,4 +788,4 @@ namespace datalog {
return m.mk_app(f, num_args, args);
}
};
}

View file

@ -199,5 +199,5 @@ namespace datalog {
};
};
}

View file

@ -319,14 +319,14 @@ namespace euf {
struct eq_pp {
ac_plugin const& p; eq const& e;
eq_pp(ac_plugin const& p, eq const& e) : p(p), e(e) {};
eq_pp(ac_plugin const& p, eq const& e) : p(p), e(e) {}
eq_pp(ac_plugin const& p, unsigned eq_id): p(p), e(p.m_active[eq_id]) {}
std::ostream& display(std::ostream& out) const { return p.display_equation(out, e); }
};
struct eq_pp_ll {
ac_plugin const& p; eq const& e;
eq_pp_ll(ac_plugin const& p, eq const& e) : p(p), e(e) {};
eq_pp_ll(ac_plugin const& p, eq const& e) : p(p), e(e) {}
eq_pp_ll(ac_plugin const& p, unsigned eq_id) : p(p), e(p.m_active[eq_id]) {}
std::ostream& display(std::ostream& out) const { return p.display_equation_ll(out, e); }
};

View file

@ -276,5 +276,5 @@ namespace euf {
return find(n) == n;
}
};
}

View file

@ -179,7 +179,7 @@ namespace euf {
};
};
}

View file

@ -81,5 +81,5 @@ namespace euf {
static void ground_subterms(expr* e, ptr_vector<app>& ground);
};
};
}

View file

@ -47,7 +47,7 @@ namespace euf {
virtual void merge_eh(enode* n1, enode* n2) = 0;
virtual void diseq_eh(enode* eq) {};
virtual void diseq_eh(enode* eq) {}
virtual void propagate() = 0;

View file

@ -94,7 +94,7 @@ namespace has_skolem_functions_ns {
void operator()(app const * n) const { if (n->get_decl()->is_skolem() && n->get_num_args() > 0) throw found(); }
void operator()(quantifier * n) const {}
};
};
}
bool has_skolem_functions(expr * n) {
has_skolem_functions_ns::proc p;

View file

@ -195,4 +195,4 @@ namespace format_ns {
return fm(m).mk_app(fid(m), OP_NIL);
}
};
}

View file

@ -198,6 +198,6 @@ namespace format_ns {
return mk_seq4(m, begin, end, proc, static_cast<unsigned>(strlen(lp)), lp, rp);
}
};
}

View file

@ -162,10 +162,10 @@ public:
void dbg_decouple(const char * prefix, expr_ref & e);
expr_ref_vector m_extra_assertions;
special_t const & get_min_max_specials() const { return m_min_max_ufs; };
const2bv_t const & get_const2bv() const { return m_const2bv; };
const2bv_t const & get_rm_const2bv() const { return m_rm_const2bv; };
uf2bvuf_t const & get_uf2bvuf() const { return m_uf2bvuf; };
special_t const & get_min_max_specials() const { return m_min_max_ufs; }
const2bv_t const & get_const2bv() const { return m_const2bv; }
const2bv_t const & get_rm_const2bv() const { return m_rm_const2bv; }
uf2bvuf_t const & get_uf2bvuf() const { return m_uf2bvuf; }
protected:
void mk_one(func_decl *f, expr_ref & sign, expr_ref & result);

View file

@ -167,7 +167,7 @@ namespace macro_manager_ns {
}
}
};
};
}
/**
\brief Mark all func_decls used in exprs as forbidden.

View file

@ -71,7 +71,7 @@ void quasi_macros::find_occurrences(expr * e) {
default: UNREACHABLE();
}
}
};
}
bool quasi_macros::is_non_ground_uninterp(expr const * e) const {
return is_non_ground(e) && is_uninterp(e);

View file

@ -58,7 +58,7 @@ namespace polymorphism {
void undo() override {
i.m_in_decl_queue.mark(i.m_decl_queue.back(), false);
i.m_decl_queue.pop_back();
};
}
};
struct remove_back : public trail {

View file

@ -115,5 +115,5 @@ namespace q {
return r;
}
};
}

View file

@ -149,6 +149,6 @@ namespace q {
quantifier_stat * operator()(quantifier * q, unsigned generation);
};
};
}

View file

@ -60,7 +60,7 @@ namespace recfun {
func_decl_ref m_pred; //<! predicate used for this case
expr_ref_vector m_guards; //<! conjunction that is equivalent to this case
expr_ref m_rhs; //<! if guard is true, `f(t1...tn) = rhs` holds
def * m_def = nullptr;; //<! definition this is a part of
def * m_def = nullptr; //<! definition this is a part of
bool m_immediate = false; //<! does `rhs` contain no defined_fun/case_pred?
case_def(ast_manager& m):
@ -92,7 +92,7 @@ namespace recfun {
expr * get_guard(unsigned i) const { return m_guards[i]; }
expr * get_rhs() const { return m_rhs; }
unsigned num_guards() const { return m_guards.size(); }
bool is_immediate() const { return m_immediate; };
bool is_immediate() const { return m_immediate; }
void set_is_immediate(bool b) { m_immediate = b; }
};

View file

@ -34,7 +34,7 @@ public:
typedef rational numeral;
typedef std::pair<numeral, numeral> interval;
typedef obj_map<app, numeral> bound_map;
bv_bounds(ast_manager& m) : m_m(m), m_bv_util(m), m_okay(true) {};
bv_bounds(ast_manager& m) : m_m(m), m_bv_util(m), m_okay(true) {}
~bv_bounds();
public: // bounds addition methods
br_status rewrite(unsigned limit, func_decl * f, unsigned num, expr * const * args, expr_ref& result);

View file

@ -123,5 +123,5 @@ namespace seq {
};
};
}

View file

@ -727,5 +727,5 @@ namespace seq {
};
}

View file

@ -167,5 +167,5 @@ namespace seq {
};
};
}

View file

@ -171,5 +171,5 @@ namespace seq {
};
};
}

View file

@ -101,5 +101,5 @@ void distribute_forall_simplifier::reduce() {
if (r != d.fml())
m_fmls.update(idx, dependent_expr(m, r, mp(d.pr(), pr), d.dep()));
}
};
}

View file

@ -62,7 +62,7 @@ void propagate_values::add_sub(dependent_expr const& de) {
else if (m.is_value(y) && m_shared.is_shared(x))
m_subst.insert(x, y, dep);
}
};
}
void propagate_values::reduce() {
m_shared.reset();

View file

@ -36,7 +36,7 @@ namespace sls {
for (unsigned i = 1; i < a.sel->num_args(); ++i)
h ^= a.sel->get_arg(i)->get_root()->hash();
return h;
};
}
};
struct select_args_eq {
bool operator()(select_args const& a, select_args const& b) const {
@ -103,13 +103,13 @@ namespace sls {
euf::enode* mk_select(euf::egraph& g, euf::enode* b, euf::enode* sel);
void resolve_conflict();
size_t* to_ptr(sat::literal l) { return reinterpret_cast<size_t*>((size_t)(l.index() << 4)); };
size_t* to_ptr(sat::literal l) { return reinterpret_cast<size_t*>((size_t)(l.index() << 4)); }
size_t* to_ptr(euf::enode* t) { return reinterpret_cast<size_t*>((reinterpret_cast<size_t>(t) << 4) + 1); }
size_t* to_ptr(unsigned n) { return reinterpret_cast<size_t*>((size_t)(n << 4) + 3); }
bool is_literal(size_t* p) { return (reinterpret_cast<size_t>(p) & 3) == 0; }
bool is_index(size_t* p) { return (reinterpret_cast<size_t>(p) & 3) == 3; }
bool is_enode(size_t* p) { return (reinterpret_cast<size_t>(p) & 3) == 1; }
sat::literal to_literal(size_t* p) { return sat::to_literal(static_cast<unsigned>(reinterpret_cast<size_t>(p) >> 4)); };
sat::literal to_literal(size_t* p) { return sat::to_literal(static_cast<unsigned>(reinterpret_cast<size_t>(p) >> 4)); }
euf::enode* to_enode(size_t* p) { return reinterpret_cast<euf::enode*>(reinterpret_cast<size_t>(p) >> 4); }
unsigned to_index(size_t* p) { return static_cast<unsigned>(reinterpret_cast<size_t>(p) >> 4); }

View file

@ -871,8 +871,8 @@ namespace sls {
if (m_la.m_config.use_top_level_assertions)
return m_la.ctx.input_assertions().get(idx);
return m_la.ctx.atom(m_la.ctx.root_literals()[idx].var());
};
}
}
}

View file

@ -40,7 +40,7 @@ class sls_tracker {
mpz m_zero, m_one, m_two;
struct value_score {
value_score() : value(unsynch_mpz_manager::mk_z(0)) {};
value_score() : value(unsynch_mpz_manager::mk_z(0)) {}
value_score(value_score&&) noexcept = default;
value_score(const value_score &other) {
m = other.m;

View file

@ -44,15 +44,15 @@ namespace sls {
virtual expr_ref get_value(expr* e) = 0;
virtual bool is_fixed(expr* e, expr_ref& value) { return false; }
virtual void initialize() = 0;
virtual void start_propagation() {};
virtual void start_propagation() {}
virtual bool propagate() = 0;
virtual void propagate_literal(sat::literal lit) = 0;
virtual void repair_literal(sat::literal lit) = 0;
virtual bool repair_down(app* e) = 0;
virtual void repair_up(app* e) = 0;
virtual bool is_sat() = 0;
virtual void on_rescale() {};
virtual void on_restart() {};
virtual void on_rescale() {}
virtual void on_restart() {}
virtual std::ostream& display(std::ostream& out) const = 0;
virtual bool set_value(expr* e, expr* v) = 0;
virtual void collect_statistics(statistics& st) const = 0;

View file

@ -52,8 +52,8 @@ namespace sls {
bool is_user_sort(sort* s) { return s->get_family_id() == user_sort_family_id; }
size_t* to_ptr(sat::literal l) { return reinterpret_cast<size_t*>((size_t)(l.index() << 4)); };
sat::literal to_literal(size_t* p) { return sat::to_literal(static_cast<unsigned>(reinterpret_cast<size_t>(p) >> 4)); };
size_t* to_ptr(sat::literal l) { return reinterpret_cast<size_t*>((size_t)(l.index() << 4)); }
sat::literal to_literal(size_t* p) { return sat::to_literal(static_cast<unsigned>(reinterpret_cast<size_t>(p) >> 4)); }
void validate_model();
void log_clause(sat::literal_vector const& lits);