3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-30 20:38:56 +00:00

Fix "missing field initializer" warnings.

This commit is contained in:
David Detlefs 2026-06-18 19:22:05 -07:00
parent 8cb5f32ef7
commit 75b81900d5
4 changed files with 24 additions and 14 deletions

View file

@ -23,6 +23,7 @@ set(CLANG_ONLY_WARNINGS
"-Wc99-extensions" "-Wc99-extensions"
"-Wsuggest-override" "-Wsuggest-override"
"-Winconsistent-missing-override" "-Winconsistent-missing-override"
"-Wmissing-field-initializers"
) )
set(MSVC_WARNINGS "/W3") set(MSVC_WARNINGS "/W3")

View file

@ -115,7 +115,7 @@ public:
} }
entry * find_core(key const & k) const { entry * find_core(key const & k) const {
return m_table.find_core(key_data{k}); return m_table.find_core(key_data{k, value()});
} }
bool find(key const & k, value & v) const { bool find(key const & k, value & v) const {
@ -137,7 +137,7 @@ public:
} }
iterator find_iterator(key const & k) const { iterator find_iterator(key const & k) const {
return m_table.find(key_data{k}); return m_table.find(key_data{k, value()});
} }
value const & find(key const& k) const { value const & find(key const& k) const {
@ -161,10 +161,10 @@ public:
return find_core(k) != nullptr; return find_core(k) != nullptr;
} }
void remove(key const & k) { void remove(key const &k) {
m_table.remove(key_data{k}); m_table.remove(key_data{k, value()});
} }
void erase(key const & k) { void erase(key const & k) {
remove(k); remove(k);
} }

View file

@ -62,6 +62,11 @@ public:
struct key_data { struct key_data {
Key * m_key = nullptr; Key * m_key = nullptr;
Value m_value; Value m_value;
key_data() : m_key(nullptr), m_value(Value()) {}
key_data(Key * key) : m_key(key), m_value(Value()) {}
key_data(Key * key, const Value& value) : m_key(key), m_value(value) {}
Value const & get_value() const { return m_value; } Value const & get_value() const { return m_value; }
Key & get_key () const { return *m_key; } Key & get_key () const { return *m_key; }
unsigned hash() const { return m_key->hash(); } unsigned hash() const { return m_key->hash(); }
@ -156,8 +161,8 @@ public:
obj_map_entry * insert_if_not_there3(Key * k, Value const & v) { obj_map_entry * insert_if_not_there3(Key * k, Value const & v) {
return m_table.insert_if_not_there2({k, v}); return m_table.insert_if_not_there2({k, v});
} }
obj_map_entry * find_core(Key * k) const { obj_map_entry *find_core(Key *k) const {
return m_table.find_core({k}); return m_table.find_core({k});
} }
@ -188,8 +193,8 @@ public:
value & operator[](key * k) { value & operator[](key * k) {
return find(k); return find(k);
} }
iterator find_iterator(Key * k) const { iterator find_iterator(Key *k) const {
return m_table.find(key_data{k}); return m_table.find(key_data{k});
} }
@ -197,10 +202,10 @@ public:
return find_core(k) != nullptr; return find_core(k) != nullptr;
} }
void remove(Key * k) { void remove(Key *k) {
m_table.remove(key_data{k}); m_table.remove(key_data{k, value()});
} }
void erase(Key * k) { void erase(Key * k) {
remove(k); remove(k);
} }

View file

@ -30,6 +30,10 @@ class symbol_table {
struct key_data { struct key_data {
symbol m_key; symbol m_key;
T m_data; T m_data;
key_data() {}
key_data(const symbol &key) : m_key(key) {}
key_data(const symbol &key, const T &data) : m_key(key), m_data(data) {}
}; };
struct key_data_hash_proc { struct key_data_hash_proc {
@ -116,8 +120,8 @@ public:
result = e->get_data().m_data; result = e->get_data().m_data;
return true; return true;
} }
bool contains(symbol key) const { bool contains(symbol key) const {
return m_sym_table.contains(key_data{key}); return m_sym_table.contains(key_data{key});
} }