mirror of
https://github.com/Z3Prover/z3
synced 2026-08-03 04:33:28 +00:00
Test PR for disabling semicolon warnings (#10169)
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. https://github.com/Z3Prover/z3/pull/10020 deleted a number of unnecessary (and, by a strict interpretation, illegal) semicolons. These were detected by adding -Wextra-semi to CLANG_ONLY_WARNINGS during testing. The PR did not eliminate all such unnecessary/illegal semi-colons; Nikolaj Bjorner argued that some IDEs would be confused by doing so for macro invocations, which otherwise look like function calls. So it left those, and did not include adding -Wextra-semi to CLANG_ONLY_WARNINGS in the PR. I'm worried that not having -Wextra-semi will allow instances of the semis we'd like to eliminate to creep back in. This PR introduces a mechanism to disable the warnings for regions with such macro invocations, and uses that mechanism for one file. If accepted, a subsequent PR would use this mechanism in all the remaining places, so that there is a clean clang build with -Wextra-semi. I verified that: * It compiles cleanly for if the enable/disable macros have null definitions, as they would for non-clang compilations. * It compiles cleanly for a clang build without -Wextra-semis. * It compiles successfully, albeit with *many* warnings, for a clang build with-Wextra-semis -- but none of those errors are for the regions in ast.h where the warning is disabled.
This commit is contained in:
parent
ae190b8b88
commit
e2df18faaf
2 changed files with 65 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ Revision History:
|
|||
#include "util/z3_exception.h"
|
||||
#include "util/dependency.h"
|
||||
#include "util/rlimit.h"
|
||||
#include "util/manage_warnings.h"
|
||||
#include <variant>
|
||||
#include <span>
|
||||
#include <initializer_list>
|
||||
|
|
@ -2168,6 +2169,7 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
START_DISABLE_EXTRA_SEMI_WARNING;
|
||||
MATCH_UNARY(is_not);
|
||||
MATCH_BINARY(is_eq);
|
||||
MATCH_BINARY(is_implies);
|
||||
|
|
@ -2176,6 +2178,7 @@ public:
|
|||
MATCH_BINARY(is_xor);
|
||||
MATCH_TERNARY(is_and);
|
||||
MATCH_TERNARY(is_or);
|
||||
END_DISABLE_WARNING;
|
||||
|
||||
bool is_iff(expr const* n, expr*& lhs, expr*& rhs) const { return is_eq(n, lhs, rhs) && is_bool(lhs); }
|
||||
|
||||
|
|
@ -2311,9 +2314,11 @@ public:
|
|||
bool is_apply_def(expr const * e) const { return is_app_of(e, basic_family_id, PR_APPLY_DEF); }
|
||||
bool is_skolemize(expr const * e) const { return is_app_of(e, basic_family_id, PR_SKOLEMIZE); }
|
||||
|
||||
START_DISABLE_EXTRA_SEMI_WARNING;
|
||||
MATCH_UNARY(is_asserted);
|
||||
MATCH_UNARY(is_hypothesis);
|
||||
MATCH_UNARY(is_lemma);
|
||||
END_DISABLE_WARNING;
|
||||
|
||||
bool has_fact(proof const * p) const {
|
||||
SASSERT(is_proof(p));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue