mirror of
https://github.com/Z3Prover/z3
synced 2026-08-02 20:23:27 +00:00
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. |
||
|---|---|---|
| .. | ||
| modules | ||
| check_link_atomic.cmake | ||
| cmake_uninstall.cmake.in | ||
| compiler_lto.cmake | ||
| compiler_warnings.cmake | ||
| cxx_compiler_flags_overrides.cmake | ||
| git_utils.cmake | ||
| msvc_legacy_quirks.cmake | ||
| target_arch_detect.cmake | ||
| target_arch_detect.cpp | ||
| z3_add_component.cmake | ||
| z3_add_cxx_flag.cmake | ||
| z3_append_linker_flag_list_to_target.cmake | ||
| Z3Config.cmake.in | ||