mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +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:
21
sql/table.h
21
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; }
|
||||
|
Reference in New Issue
Block a user