3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-08-03 20:53:30 +00:00
z3/src/sat
davedets d46fbad3b6
Make implicit switch case fall-throughs explicit (#10284)
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 enable the "-Wimplicit-fallthrough" warning, then fix all the
warnings this gets
in the clang build, by:
* Augmenting UNREACHABLE to add __builtin_unreachable(), which
suppresses
warnings for fallthrough in that cse.
* Adding Z3_fallthrough in many cases, to make it clear that
fallthroughs are intentional.
* Adding [[noreturn]] to functions that throw, so the compiler knows
they don't fall through to the next case.
* In a couple of cases, there's a fall-through to a default case, which
does "break", or "return nullptr". In those cases, I duplicated the
action in the preceding case, to make it more self-contained, and robust
in the face of change.

In some cases, I am concerned about whether the warnings are identifying
real bugs. For example, the fall-throughs in these files seem at least a
little suspect:
nnf.cpp
seq_rewriter.cpp
lar_solver.cpp 

while very probably correct, also seem at least a tiny bit suspect.
However, this PR does *not* attempt to change any behavior, only to
silence the warnings. It would be great if somebody with more knowledge
of the code could vet these cases. If vetted, the explicit presence of
the Z3_fallthrough would reassure future readers of the code that the
fall-through is intentional, not accidental.
2026-07-29 09:05:42 -07:00
..
sat_solver Fix unsound model from parallel QF_BV solving (#10133) (#10142) 2026-07-16 11:47:07 -07:00
smt Make implicit switch case fall-throughs explicit (#10284) 2026-07-29 09:05:42 -07:00
tactic Make implicit switch case fall-throughs explicit (#10284) 2026-07-29 09:05:42 -07:00
CMakeLists.txt remove stale experimental code #8063 2025-12-12 05:49:05 +00:00
dimacs.cpp deal with compiler warnings and include value exchange prior to final check. 2025-01-24 09:40:33 -08:00
dimacs.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_aig_finder.cpp Fix static analysis issues: null dereferences, unsafe casts, branch clones, uninitialized members (#9424) 2026-04-29 13:37:11 -07:00
sat_aig_finder.h remove a hundred implicit constructors/destructors 2021-05-23 14:25:01 +01:00
sat_allocator.h booyah 2020-07-04 15:56:30 -07:00
sat_anf_simplifier.cpp Refactor sat_anf_simplifier to use C++17 structured bindings (#8358) 2026-01-27 09:59:26 -08:00
sat_anf_simplifier.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_asymm_branch.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_asymm_branch.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_asymm_branch_params.pyg bug fixes 2018-02-19 21:49:03 -08:00
sat_bcd.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_bcd.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_big.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_big.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause_set.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause_set.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause_use_list.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_clause_use_list.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_cleaner.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_cleaner.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_config.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_config.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_ddfw_wrapper.cpp flip tabu on predicate being repaired, add model rotation code 2025-01-02 14:39:36 -08:00
sat_ddfw_wrapper.h Remove redundant overridden default destructors (#8191) 2026-01-14 18:41:26 +00:00
sat_drat.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
sat_drat.h Replace empty destructors with = default for compiler optimization (#8189) 2026-01-13 10:50:10 -08:00
sat_elim_eqs.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_elim_eqs.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_extension.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_gc.cpp Standardize for-loop increments to prefix form (++i) (#8199) 2026-01-14 19:55:31 -08:00
sat_integrity_checker.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_integrity_checker.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_justification.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_local_search.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
sat_local_search.h remove default destructors 2024-10-02 22:20:12 +01:00
sat_lookahead.cpp Fix 13 compiler warnings: sign-comparison and unused parameters (#8215) 2026-01-16 16:00:42 -08:00
sat_lookahead.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_model_converter.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_model_converter.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_mus.cpp replace some copies with moves 2026-02-09 22:45:28 +00:00
sat_mus.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_npn3_finder.cpp No need to hash quaternaries for AND. 2020-03-01 04:10:25 -08:00
sat_npn3_finder.h remove a hundred implicit constructors/destructors 2021-05-23 14:25:01 +01:00
sat_parallel.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_parallel.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_prob.cpp create insert-fresh and insert for indexed_uint_set to make use cases with non-fresh inserts easier 2023-08-03 09:48:07 -07:00
sat_prob.h fix #6599 2023-02-18 14:18:02 -08:00
sat_probing.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_probing.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_proof_trim.cpp fix bug in trim code missing dependecy 2025-06-07 15:39:05 -07:00
sat_proof_trim.h Migrate codebase to std::string_view (except z3++.h) (#8266) 2026-01-21 09:30:41 -08:00
sat_scc.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_scc.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_scc_params.pyg working on completing ATE/ALA for acce and abce 2018-01-29 20:32:06 -08:00
sat_simplifier.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_simplifier.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_simplifier_params.pyg remove unused bdd based variable elimination 2025-04-14 16:07:41 -07:00
sat_solver.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_solver.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_solver_core.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_types.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_watched.cpp Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_watched.h Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat_xor_finder.cpp replace some copies with moves 2026-02-09 22:45:28 +00:00
sat_xor_finder.h remove a hundred implicit constructors/destructors 2021-05-23 14:25:01 +01:00