1
0
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:
Vicențiu Ciorbaru
2023-02-07 13:57:20 +02:00
parent 8dab661416
commit 08c852026d
242 changed files with 1101 additions and 1341 deletions

View File

@ -396,7 +396,7 @@ public:
invisible(false)
{}
Key(const Key &rhs, MEM_ROOT *mem_root);
virtual ~Key() {}
virtual ~Key() = default;
/* Equality comparison of keys (ignoring name) */
friend bool foreign_key_prefix(Key *a, Key *b);
/**
@ -1096,7 +1096,7 @@ public:
Query_arena() { INIT_ARENA_DBUG_INFO; }
virtual Type type() const;
virtual ~Query_arena() {};
virtual ~Query_arena() = default;
inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; }
inline bool is_stmt_prepare_or_first_sp_execute() const
@ -1147,7 +1147,7 @@ public:
Query_arena_memroot() : Query_arena()
{}
virtual ~Query_arena_memroot() {}
virtual ~Query_arena_memroot() = default;
};
@ -1263,7 +1263,7 @@ public:
my_bool query_cache_is_applicable;
/* This constructor is called for backup statements */
Statement() {}
Statement() = default;
Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
enum enum_state state_arg, ulong id_arg);
@ -1349,7 +1349,7 @@ struct st_savepoint {
class Security_context {
public:
Security_context() {} /* Remove gcc warning */
Security_context() = default; /* Remove gcc warning */
/*
host - host of the client
user - user of the client, set to NULL until the user has been read from
@ -1768,7 +1768,7 @@ protected:
m_prev_internal_handler(NULL)
{}
virtual ~Internal_error_handler() {}
virtual ~Internal_error_handler() = default;
public:
/**
@ -1826,7 +1826,7 @@ public:
/* Ignore error */
return TRUE;
}
Dummy_error_handler() {} /* Remove gcc warning */
Dummy_error_handler() = default; /* Remove gcc warning */
};
@ -1863,7 +1863,7 @@ public:
class Drop_table_error_handler : public Internal_error_handler
{
public:
Drop_table_error_handler() {}
Drop_table_error_handler() = default;
public:
bool handle_condition(THD *thd,
@ -5232,7 +5232,7 @@ public:
example for a duplicate row entry written to a temp table.
*/
virtual int send_data(List<Item> &items)=0;
virtual ~select_result_sink() {};
virtual ~select_result_sink() = default;
void reset(THD *thd_arg) { thd= thd_arg; }
};
@ -5264,7 +5264,7 @@ public:
ha_rows est_records; /* estimated number of records in the result */
select_result(THD *thd_arg): select_result_sink(thd_arg), est_records(0) {}
void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; }
virtual ~select_result() {};
virtual ~select_result() = default;
/**
Change wrapped select_result.
@ -6313,7 +6313,7 @@ class user_var_entry
{
CHARSET_INFO *m_charset;
public:
user_var_entry() {} /* Remove gcc warning */
user_var_entry() = default; /* Remove gcc warning */
LEX_CSTRING name;
char *value;
size_t length;
@ -6434,7 +6434,7 @@ public:
enum type { SESSION_VAR, LOCAL_VAR, PARAM_VAR };
type scope;
my_var(const LEX_CSTRING *j, enum type s) : name(*j), scope(s) { }
virtual ~my_var() {}
virtual ~my_var() = default;
virtual bool set(THD *thd, Item *val) = 0;
virtual my_var_sp *get_my_var_sp() { return NULL; }
};
@ -6455,7 +6455,7 @@ public:
: my_var(j, LOCAL_VAR),
m_rcontext_handler(rcontext_handler),
m_type_handler(type_handler), offset(o), sp(s) { }
~my_var_sp() { }
~my_var_sp() = default;
bool set(THD *thd, Item *val);
my_var_sp *get_my_var_sp() { return this; }
const Type_handler *type_handler() const { return m_type_handler; }
@ -6484,7 +6484,7 @@ class my_var_user: public my_var {
public:
my_var_user(const LEX_CSTRING *j)
: my_var(j, SESSION_VAR) { }
~my_var_user() { }
~my_var_user() = default;
bool set(THD *thd, Item *val);
};
@ -6497,7 +6497,7 @@ public:
select_dumpvar(THD *thd_arg)
:select_result_interceptor(thd_arg), row_count(0), m_var_sp_row(NULL)
{ var_list.empty(); }
~select_dumpvar() {}
~select_dumpvar() = default;
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
int send_data(List<Item> &items);
bool send_eof();