mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Apply clang-tidy to remove empty constructors / destructors
This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
This commit is contained in:
@ -189,9 +189,7 @@ database::database(const config& c)
|
||||
{
|
||||
}
|
||||
|
||||
database::~database()
|
||||
{
|
||||
}
|
||||
database::~database() = default;
|
||||
|
||||
dbcontext_ptr
|
||||
database::create_context(bool for_write) volatile
|
||||
@ -226,9 +224,7 @@ dbcontext::dbcontext(volatile database *d, bool for_write)
|
||||
user_level_lock_timeout = d->get_conf().get_int("wrlock_timeout", 12);
|
||||
}
|
||||
|
||||
dbcontext::~dbcontext()
|
||||
{
|
||||
}
|
||||
dbcontext::~dbcontext() = default;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -27,7 +27,7 @@ struct dbcontext_i;
|
||||
typedef std::auto_ptr<dbcontext_i> dbcontext_ptr;
|
||||
|
||||
struct database_i {
|
||||
virtual ~database_i() { }
|
||||
virtual ~database_i() = default;
|
||||
virtual dbcontext_ptr create_context(bool for_write) volatile = 0;
|
||||
virtual void stop() volatile = 0;
|
||||
virtual const config& get_conf() const volatile = 0;
|
||||
@ -57,7 +57,7 @@ struct prep_stmt {
|
||||
};
|
||||
|
||||
struct dbcallback_i {
|
||||
virtual ~dbcallback_i () { }
|
||||
virtual ~dbcallback_i() = default;
|
||||
virtual void dbcb_set_prep_stmt(size_t pst_id, const prep_stmt& v) = 0;
|
||||
virtual const prep_stmt *dbcb_get_prep_stmt(size_t pst_id) const = 0;
|
||||
virtual void dbcb_resp_short(uint32_t code, const char *msg) = 0;
|
||||
@ -111,7 +111,7 @@ struct cmd_exec_args {
|
||||
};
|
||||
|
||||
struct dbcontext_i {
|
||||
virtual ~dbcontext_i() { }
|
||||
virtual ~dbcontext_i() = default;
|
||||
virtual void init_thread(const void *stack_bottom,
|
||||
volatile int& shutdown_flag) = 0;
|
||||
virtual void term_thread() = 0;
|
||||
|
@ -47,7 +47,7 @@ struct hstcpsvr_i;
|
||||
typedef std::auto_ptr<hstcpsvr_i> hstcpsvr_ptr;
|
||||
|
||||
struct hstcpsvr_i {
|
||||
virtual ~hstcpsvr_i() { }
|
||||
virtual ~hstcpsvr_i() = default;
|
||||
virtual std::string start_listen() = 0;
|
||||
static hstcpsvr_ptr create(const config& conf);
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ struct hstcpsvr_worker_arg {
|
||||
};
|
||||
|
||||
struct hstcpsvr_worker_i {
|
||||
virtual ~hstcpsvr_worker_i() { }
|
||||
virtual ~hstcpsvr_worker_i() = default;
|
||||
virtual void run() = 0;
|
||||
static hstcpsvr_worker_ptr create(const hstcpsvr_worker_arg& arg);
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ struct hstcpcli_i;
|
||||
typedef std::auto_ptr<hstcpcli_i> hstcpcli_ptr;
|
||||
|
||||
struct hstcpcli_i {
|
||||
virtual ~hstcpcli_i() { }
|
||||
virtual ~hstcpcli_i() = default;
|
||||
virtual void close() = 0;
|
||||
virtual int reconnect() = 0;
|
||||
virtual bool stable_point() = 0;
|
||||
|
@ -13,7 +13,7 @@ namespace dena {
|
||||
|
||||
/* boost::noncopyable */
|
||||
struct noncopyable {
|
||||
noncopyable() { }
|
||||
noncopyable() = default;
|
||||
private:
|
||||
noncopyable(const noncopyable&);
|
||||
noncopyable& operator =(const noncopyable&);
|
||||
|
Reference in New Issue
Block a user