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 /sql/table.h | |
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 'sql/table.h')
-rw-r--r-- | sql/table.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/table.h b/sql/table.h index 799675ac775..3adcc887a2c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -132,14 +132,13 @@ public: void restore_env(THD *thd, Object_creation_ctx *backup_ctx); protected: - Object_creation_ctx() {} + Object_creation_ctx() = default; virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0; virtual void change_env(THD *thd) const = 0; public: - virtual ~Object_creation_ctx() - { } + virtual ~Object_creation_ctx() = default; }; /*************************************************************************/ @@ -540,7 +539,7 @@ protected: public: Table_check_intact(bool keys= false) : has_keys(keys) {} - virtual ~Table_check_intact() {} + virtual ~Table_check_intact() = default; /** Checks whether a table is intact. */ bool check(TABLE *table, const TABLE_FIELD_DEF *table_def); @@ -712,7 +711,7 @@ public: struct TABLE_SHARE { - TABLE_SHARE() {} /* Remove gcc warning */ + TABLE_SHARE() = default; /* Remove gcc warning */ /** Category of this table. */ TABLE_CATEGORY table_category; @@ -1229,7 +1228,7 @@ struct vers_select_conds_t; struct TABLE { - TABLE() {} /* Remove gcc warning */ + TABLE() = default; /* Remove gcc warning */ TABLE_SHARE *s; handler *file; @@ -2191,7 +2190,7 @@ class Index_hint; struct TABLE_CHAIN { - TABLE_CHAIN() {} + TABLE_CHAIN() = default; TABLE_LIST **start_pos; TABLE_LIST ** end_pos; @@ -2202,7 +2201,7 @@ struct TABLE_CHAIN struct TABLE_LIST { - TABLE_LIST() {} /* Remove gcc warning */ + TABLE_LIST() = default; /* Remove gcc warning */ enum prelocking_types { @@ -2981,8 +2980,8 @@ class Item; class Field_iterator: public Sql_alloc { public: - Field_iterator() {} /* Remove gcc warning */ - virtual ~Field_iterator() {} + Field_iterator() = default; /* Remove gcc warning */ + virtual ~Field_iterator() = default; virtual void set(TABLE_LIST *)= 0; virtual void next()= 0; virtual bool end_of_fields()= 0; /* Return 1 at end of list */ @@ -3043,7 +3042,7 @@ class Field_iterator_natural_join: public Field_iterator Natural_join_column *cur_column_ref; public: Field_iterator_natural_join() :cur_column_ref(NULL) {} - ~Field_iterator_natural_join() {} + ~Field_iterator_natural_join() = default; void set(TABLE_LIST *table); void next(); bool end_of_fields() { return !cur_column_ref; } |