3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-10 10:57:15 +00:00
z3/src
davedets 69cd7e0c4c
Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768)
The page
https://github.com/Z3Prover/z3/blob/master/README-CMake.md#adding-z3-as-a-dependency-to-a-cmake-project
advises using the CMake FetchContent feature to include z3 as source
into other CMake project. I'm trying to do this to use Z3 within a
ClangTidy checker. This is one of a series of PR's aimed at getting Z3
to compile cleanly when included this way.

This initial PR fixes all the errors, allowing the compilation to
succeed. Subsequent diffs will address warnings.

I tested only the CMake compilation, on a Mac.

*Missing Z3_THROWs*

Update z3++.h to use Z3_THROW in a couple of places. Clang compiles with
exceptions disabled so we get messages like:

```
/Users/daviddetlefs/llvm-project/build_dbg/_deps/z3-src/src/api/c++/z3++.h:4928:17: error: cannot use 'throw' with exceptions disabled4928 |                 throw exception("rcf_num objects from different contexts");
```

NOTE TO REVIEWERS: I'm not complete clear on the usage conventions for
Z3_THROW. With exception disabled, it seems like the throwing function
will just continue. If there's somethign else that should be done, like
setting some error state, please let me know.

*CMake component name collision*

There was an error at the CMake level, a name collision (on "opt").
Apparently CMake components are named using a flat namespace, so it's
easy to see how this could occur. It seems to me that the right global
way to fix this would be to encourage people to use some form of
"qualified name" convention in naming their component. The fix I chose
was a local version of this, changing the Z3 component name to z3_opt.
(It didn't seem feasible to make the change in clang.)

NOTE TO REVIEWERS: If you think this is OK, please let me know if

a) You'd like me to also change the name of the opt directory, to keep
thecomponent-name == directory-name invariant, and

b) You'd like me to make this z3_ change more globally, to future-proof
(somewhat) against similar component name collisions.
2026-06-08 19:44:01 -07:00
..
ackermannization Fix off-by-one vulnerabilities: use range-based for on goals; cache loop bound 2026-02-19 22:37:22 +00:00
api Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
ast Fix right-side can_add indexing in sls_seq_plugin edit-distance repair (#9773) 2026-06-08 19:36:14 -07:00
cmd_context refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
math Fix mpz_manager leak in algebraic root comparison (#9654) 2026-05-28 09:06:05 -07:00
model disable test in tptp, move to native lambdas 2026-06-02 10:38:51 -07:00
muz spacer: enable model completion in arith qe_project (#9776) 2026-06-08 19:35:49 -07:00
nlsat making try-for tactic exception resilient on cancelation 2026-04-26 15:58:24 -07:00
opt Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
params prepare for lambda unfolding in ho-matcher and selectively enable ho matching 2026-05-22 13:25:01 -07:00
parsers Add SMT-LIB choice support via array OP_CHOICE and instantiate choice axioms in array solvers (#9649) 2026-05-27 10:05:06 -07:00
qe Cleanup thanks to Copilot (#9709) 2026-06-04 10:46:33 -07:00
sat refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
shell Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
smt refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
solver refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
tactic refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
test Fix right-side can_add indexing in sls_seq_plugin edit-distance repair (#9773) 2026-06-08 19:36:14 -07:00
util Handle SIGXCPU like a regular timeout (#9697) 2026-06-03 07:26:38 -07:00
CMakeLists.txt git bindings v1.0 2026-02-18 21:02:25 -08:00