3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-19 07:06:28 +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"
"-Wsuggest-override"
"-Winconsistent-missing-override"
"-Wmissing-field-initializers"
)
set(MSVC_WARNINGS "/W3")

View file

@ -115,7 +115,7 @@ public:
}
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 {
@ -137,7 +137,7 @@ public:
}
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 {
@ -161,10 +161,10 @@ public:
return find_core(k) != nullptr;
}
void remove(key const & k) {
m_table.remove(key_data{k});
void remove(key const &k) {
m_table.remove(key_data{k, value()});
}
void erase(key const & k) {
remove(k);
}

View file

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

View file

@ -30,6 +30,10 @@ class symbol_table {
struct key_data {
symbol m_key;
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 {
@ -116,8 +120,8 @@ public:
result = e->get_data().m_data;
return true;
}
bool contains(symbol key) const {
bool contains(symbol key) const {
return m_sym_table.contains(key_data{key});
}