diff options
author | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2023-02-07 13:57:20 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2023-02-09 16:09:08 +0200 |
commit | 08c852026ddaa1ae7717aa31950946c9da457f1f (patch) | |
tree | 71772994945015715929877efae9d4c5af3777a8 /plugin/handler_socket | |
parent | 8dab66141619f7e6a541a8d4a848596e919e9593 (diff) | |
download | mariadb-git-08c852026ddaa1ae7717aa31950946c9da457f1f.tar.gz |
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".
Diffstat (limited to 'plugin/handler_socket')
6 files changed, 9 insertions, 13 deletions
diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 9c0a2d81b98..17a7cd78c58 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -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 { diff --git a/plugin/handler_socket/handlersocket/database.hpp b/plugin/handler_socket/handlersocket/database.hpp index a4aee0874c7..ed5d00800d9 100644 --- a/plugin/handler_socket/handlersocket/database.hpp +++ b/plugin/handler_socket/handlersocket/database.hpp @@ -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; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr.hpp b/plugin/handler_socket/handlersocket/hstcpsvr.hpp index 811bfa25613..5fbed92402b 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr.hpp @@ -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); }; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp index 497581c27a7..25612adec0f 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp @@ -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); }; diff --git a/plugin/handler_socket/libhsclient/hstcpcli.hpp b/plugin/handler_socket/libhsclient/hstcpcli.hpp index 11dec8ebb0b..fa0d4db1742 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.hpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.hpp @@ -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; diff --git a/plugin/handler_socket/libhsclient/util.hpp b/plugin/handler_socket/libhsclient/util.hpp index 93d78cc7dc0..60b5441703d 100644 --- a/plugin/handler_socket/libhsclient/util.hpp +++ b/plugin/handler_socket/libhsclient/util.hpp @@ -13,7 +13,7 @@ namespace dena { /* boost::noncopyable */ struct noncopyable { - noncopyable() { } + noncopyable() = default; private: noncopyable(const noncopyable&); noncopyable& operator =(const noncopyable&); |