3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-08 20:21:23 +00:00

remove default destructors & some default constructors

Another ~700 KB reduction in binary size
This commit is contained in:
Nuno Lopes 2024-09-04 22:30:23 +01:00
parent 0837e3b8e8
commit 8061765574
66 changed files with 22 additions and 131 deletions

View file

@ -609,7 +609,7 @@ public:
struct key_value {
Key m_key;
Value m_value;
key_value() {}
key_value() = default;
key_value(Key const & k):m_key(k) {}
key_value(Key const & k, Value const & v):m_key(k), m_value(v) {}
};

View file

@ -30,7 +30,7 @@ class optional {
}
public:
optional() {}
optional() = default;
explicit optional(const T & val) {
m_obj = alloc(T, val);
@ -116,13 +116,13 @@ public:
*/
template<typename T>
class optional<T*> {
T * m_ptr;
T * m_ptr = nullptr;
static optional m_undef;
public:
optional():m_ptr(nullptr) {}
optional() = default;
explicit optional(T * val):m_ptr(val) {}

View file

@ -366,12 +366,11 @@ class params {
};
typedef std::pair<symbol, value> entry;
svector<entry> m_entries;
std::atomic<unsigned> m_ref_count;
std::atomic<unsigned> m_ref_count = 0;
void del_value(entry & e);
void del_values();
public:
params():m_ref_count(0) {}
~params() {
reset();
}

View file

@ -23,13 +23,10 @@ Notes:
template<class T>
class queue {
vector<T> m_elems;
unsigned m_head;
unsigned m_capacity;
unsigned m_head = 0;
unsigned m_capacity = 0;
public:
queue(): m_head(0), m_capacity(0) {}
void push(T const& t) { m_elems.push_back(t); }
bool empty() const {

View file

@ -41,8 +41,8 @@ public:
ADD_INITIALIZER('rational::initialize();')
ADD_FINALIZER('rational::finalize();')
*/
rational() {}
rational() = default;
rational(rational const & r) { m().set(m_val, r.m_val); }
rational(rational&&) = default;

View file

@ -21,7 +21,7 @@ Revision History:
#include "util/rational.h"
class s_integer {
int m_val;
int m_val = 0;
static s_integer m_zero;
static s_integer m_one;
static s_integer m_minus_one;
@ -41,7 +41,7 @@ public:
std::string to_string() const;
public:
s_integer(): m_val(0) {}
s_integer() = default;
explicit s_integer(int n):m_val(n) {}
struct i64 {};
explicit s_integer(int64_t i, i64):m_val(static_cast<int>(i)) {}

View file

@ -29,9 +29,8 @@ class small_object_allocator {
static const unsigned NUM_SLOTS = (SMALL_OBJ_SIZE >> PTR_ALIGNMENT);
struct chunk {
chunk* m_next{ nullptr };
char* m_curr{ nullptr };
char* m_curr = m_data;
char m_data[CHUNK_SIZE];
chunk():m_curr(m_data) {}
};
chunk * m_chunks[NUM_SLOTS];
void * m_free_list[NUM_SLOTS];

View file

@ -1170,7 +1170,7 @@ public:
template<typename T>
class ptr_vector : public vector<T *, false> {
public:
ptr_vector():vector<T *, false>() {}
ptr_vector() = default;
ptr_vector(unsigned s):vector<T *, false>(s) {}
ptr_vector(unsigned s, T * elem):vector<T *, false>(s, elem) {}
ptr_vector(unsigned s, T * const * data):vector<T *, false>(s, const_cast<T**>(data)) {}
@ -1190,7 +1190,7 @@ public:
template<typename T, typename SZ = unsigned>
class svector : public vector<T, false, SZ> {
public:
svector():vector<T, false, SZ>() {}
svector() = default;
svector(SZ s):vector<T, false, SZ>(s) {}
svector(SZ s, T const & elem):vector<T, false, SZ>(s, elem) {}
svector(SZ s, T const * data):vector<T, false, SZ>(s, data) {}