3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-16 03:55:42 +00:00

Fix clang warnings about casting away const. (#9933)

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 adds
```
"-Wcast-qual"
```
to the set of warnings enabled in the build.  This gives warnings like:
```
/Users/daviddetlefs/z3/src/ast/ast.cpp:2897:38: warning: cast from 'app *const *' to 'expr **' drops const qualifier [-Wcast-qual]
```
I fixed these by inserting consts. In some cases, a "const_cast<T>(...)"
was necessary.
This commit is contained in:
davedets 2026-06-23 18:57:46 -07:00 committed by GitHub
parent cd2915ff3c
commit 0adbcaf0d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 13 deletions

View file

@ -68,8 +68,8 @@ private:
inline ast_manager & m() const { return m_manager; }
// label for an expression
std::string label_of_expr(const expr * e) const {
expr_ref er((expr*)e, m());
std::string label_of_expr(const expr *e) const {
expr_ref er(const_cast<expr *>(e), m());
std::ostringstream out;
out << er << std::flush;
return escape_dot(out.str());