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 /storage/innobase/include | |
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 'storage/innobase/include')
-rw-r--r-- | storage/innobase/include/buf0buf.h | 8 | ||||
-rw-r--r-- | storage/innobase/include/dict0types.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/ib0mutex.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/os0file.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/rem0rec.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/row0mysql.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/sync0types.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/trx0purge.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/ut0mutex.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/ut0new.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/ut0ut.h | 2 |
11 files changed, 16 insertions, 16 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index e61e3e4c283..27fb673a01f 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1868,7 +1868,7 @@ public: , m_hp() {} /** Destructor */ - virtual ~HazardPointer() {} + virtual ~HazardPointer() = default; /** Get current value */ buf_page_t* get() const @@ -1922,7 +1922,7 @@ public: HazardPointer(buf_pool, mutex) {} /** Destructor */ - ~FlushHp() override {} + ~FlushHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to @@ -1943,7 +1943,7 @@ public: HazardPointer(buf_pool, mutex) {} /** Destructor */ - ~LRUHp() override {} + ~LRUHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to @@ -1967,7 +1967,7 @@ public: LRUHp(buf_pool, mutex) {} /** Destructor */ - ~LRUItr() override {} + ~LRUItr() override = default; /** Selects from where to start a scan. If we have scanned too deep into the LRU list it resets the value to the tail diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 76ffef236a1..5c4aaf8c87a 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -109,7 +109,7 @@ struct table_name_t char* m_name; /** Default constructor */ - table_name_t() {} + table_name_t() = default; /** Constructor */ table_name_t(char* name) : m_name(name) {} diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h index de1d208fff4..fa493f4f4a1 100644 --- a/storage/innobase/include/ib0mutex.h +++ b/storage/innobase/include/ib0mutex.h @@ -542,7 +542,7 @@ struct PolicyMutex #endif /* UNIV_PFS_MUTEX */ } - ~PolicyMutex() { } + ~PolicyMutex() = default; /** @return non-const version of the policy */ Policy& policy() UNIV_NOTHROW diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 646f964df7f..be363b8eea5 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -264,7 +264,7 @@ public: } /** Destructor */ - ~IORequest() { } + ~IORequest() = default; /** @return true if ignore missing flag is set */ static bool ignore_missing(ulint type) diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 23956dcb068..0f749470d1d 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1343,7 +1343,7 @@ public: } /** Destructor */ - ~rec_printer() override {} + ~rec_printer() override = default; private: /** Copy constructor */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index a2a03b549ab..fc40efd945d 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -824,7 +824,7 @@ struct row_prebuilt_t { /** Callback for row_mysql_sys_index_iterate() */ struct SysIndexCallback { - virtual ~SysIndexCallback() { } + virtual ~SysIndexCallback() = default; /** Callback method @param mtr current mini transaction diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index b0510e82524..25e37f9da17 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -392,7 +392,7 @@ struct OSMutex { } /** Destructor */ - ~OSMutex() { } + ~OSMutex() = default; /** Destroy the mutex */ void destroy() @@ -743,7 +743,7 @@ public: } /** Destructor */ - ~LatchMeta() { } + ~LatchMeta() = default; /** Constructor @param[in] id Latch id diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index a5a27555f5d..74c9a8f8b8d 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -78,7 +78,7 @@ public: typedef trx_rsegs_t::iterator iterator; typedef trx_rsegs_t::const_iterator const_iterator; - TrxUndoRsegs() {} + TrxUndoRsegs() = default; /** Constructor */ TrxUndoRsegs(trx_rseg_t& rseg) diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h index abdd5729d43..2ae4657e2a0 100644 --- a/storage/innobase/include/ut0mutex.h +++ b/storage/innobase/include/ut0mutex.h @@ -111,10 +111,10 @@ in the debug version. */ class MutexMonitor { public: /** Constructor */ - MutexMonitor() { } + MutexMonitor() = default; /** Destructor */ - ~MutexMonitor() { } + ~MutexMonitor() = default; /** Enable the mutex monitoring */ void enable(); diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index a190b872549..3d25cb3029a 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -299,7 +299,7 @@ public: { } #else - ut_allocator() {} + ut_allocator() = default; ut_allocator(PSI_memory_key) {} #endif /* UNIV_PFS_MEMORY */ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 7031fc47f6a..4af67160251 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -340,7 +340,7 @@ class logger { protected: /* This class must not be used directly */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() {} + ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() = default; public: template<typename T> ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger& operator<<(const T& rhs) |