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

@ -191,7 +191,7 @@ class ACL_USER :public ACL_USER_BASE,
{
public:
ACL_USER() { }
ACL_USER() = default;
ACL_USER(THD *thd, const LEX_USER &combo,
const Account_options &options,
const ulong privileges);
@ -328,7 +328,7 @@ class ACL_PROXY_USER :public ACL_ACCESS
MYSQL_PROXIES_PRIV_GRANTOR,
MYSQL_PROXIES_PRIV_TIMESTAMP } proxy_table_fields;
public:
ACL_PROXY_USER () {};
ACL_PROXY_USER () = default;
void init(const char *host_arg, const char *user_arg,
const char *proxied_host_arg, const char *proxied_user_arg,
@ -919,7 +919,7 @@ class User_table: public Grant_table_base
virtual longlong get_password_lifetime () const = 0;
virtual int set_password_lifetime (longlong x) const = 0;
virtual ~User_table() {}
virtual ~User_table() = default;
private:
friend class Grant_tables;
virtual int setup_sysvars() const = 0;
@ -1250,7 +1250,7 @@ class User_table_tabular: public User_table
return 1;
}
virtual ~User_table_tabular() {}
virtual ~User_table_tabular() = default;
private:
friend class Grant_tables;
@ -1566,7 +1566,7 @@ class User_table_json: public User_table
int set_password_expired (bool x) const
{ return x ? set_password_last_changed(0) : 0; }
~User_table_json() {}
~User_table_json() = default;
private:
friend class Grant_tables;
static const uint JSON_SIZE=1024;
@ -5181,7 +5181,7 @@ public:
GRANT_NAME(const char *h, const char *d,const char *u,
const char *t, ulong p, bool is_routine);
GRANT_NAME (TABLE *form, bool is_routine);
virtual ~GRANT_NAME() {};
virtual ~GRANT_NAME() = default;
virtual bool ok() { return privs != 0; }
void set_user_details(const char *h, const char *d,
const char *u, const char *t,
@ -11446,8 +11446,7 @@ public:
: is_grave(FALSE)
{}
virtual ~Silence_routine_definer_errors()
{}
virtual ~Silence_routine_definer_errors() = default;
virtual bool handle_condition(THD *thd,
uint sql_errno,