mirror of
https://github.com/Z3Prover/z3
synced 2026-08-02 12:13:25 +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. (1 more flag after this!)
This one adds the flag -Wgnu-anonymous-struct. Z3 uses this anonymous
struct idiom, usually when using a struct as one of the members of a
union, as in:
```
union {
justification * m_js;
unsigned m_lidx;
struct {
enode * m_lhs;
enode * m_rhs;
};
};
```
This is not, strictly speaking, legal C++ (at least according to
Google's AI summary -- and the existence of this flag in Clang implies
that it is a GNU extension). You need to give the struct a member name
in the outer union to prevent the warning.
I'm of two minds on this. On the one hand it's not hurting anything, and
all the major compilers seem to support the idiom. On the other hand,
well, why do we have standards if we're going to ignore them in favor of
de-facto standards?
I submit this PR to show the size of the changes necessary to eliminate
the use of the extension. Personally, I'd do it, but I would gladly
withdraw the PR in favor of one that just silences the warning, if that
was the reviewer's preference.
|
||
|---|---|---|
| .. | ||
| 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 | ||