1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +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

@ -2212,7 +2212,7 @@ public:
{ return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* Never called */ }
virtual ~TABLE_READ_PLAN() {} /* Remove gcc warning */
virtual ~TABLE_READ_PLAN() = default; /* Remove gcc warning */
/**
Add basic info for this TABLE_READ_PLAN to the optimizer trace.
@ -2247,7 +2247,7 @@ public:
TRP_RANGE(SEL_ARG *key_arg, uint idx_arg, uint mrr_flags_arg)
: key(key_arg), key_idx(idx_arg), mrr_flags(mrr_flags_arg)
{}
virtual ~TRP_RANGE() {} /* Remove gcc warning */
virtual ~TRP_RANGE() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc)
@ -2294,8 +2294,8 @@ void TRP_RANGE::trace_basic_info(PARAM *param,
class TRP_ROR_INTERSECT : public TABLE_READ_PLAN
{
public:
TRP_ROR_INTERSECT() {} /* Remove gcc warning */
virtual ~TRP_ROR_INTERSECT() {} /* Remove gcc warning */
TRP_ROR_INTERSECT() = default; /* Remove gcc warning */
virtual ~TRP_ROR_INTERSECT() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
@ -2320,8 +2320,8 @@ public:
class TRP_ROR_UNION : public TABLE_READ_PLAN
{
public:
TRP_ROR_UNION() {} /* Remove gcc warning */
virtual ~TRP_ROR_UNION() {} /* Remove gcc warning */
TRP_ROR_UNION() = default; /* Remove gcc warning */
virtual ~TRP_ROR_UNION() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
TABLE_READ_PLAN **first_ror; /* array of ptrs to plans for merged scans */
@ -2353,8 +2353,8 @@ void TRP_ROR_UNION::trace_basic_info(PARAM *param,
class TRP_INDEX_INTERSECT : public TABLE_READ_PLAN
{
public:
TRP_INDEX_INTERSECT() {} /* Remove gcc warning */
virtual ~TRP_INDEX_INTERSECT() {} /* Remove gcc warning */
TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */
virtual ~TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
TRP_RANGE **range_scans; /* array of ptrs to plans of intersected scans */
@ -2390,8 +2390,8 @@ void TRP_INDEX_INTERSECT::trace_basic_info(PARAM *param,
class TRP_INDEX_MERGE : public TABLE_READ_PLAN
{
public:
TRP_INDEX_MERGE() {} /* Remove gcc warning */
virtual ~TRP_INDEX_MERGE() {} /* Remove gcc warning */
TRP_INDEX_MERGE() = default; /* Remove gcc warning */
virtual ~TRP_INDEX_MERGE() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
TRP_RANGE **range_scans; /* array of ptrs to plans of merged scans */
@ -2459,7 +2459,7 @@ public:
if (key_infix_len)
memcpy(this->key_infix, key_infix_arg, key_infix_len);
}
virtual ~TRP_GROUP_MIN_MAX() {} /* Remove gcc warning */
virtual ~TRP_GROUP_MIN_MAX() = default; /* Remove gcc warning */
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
@ -9664,7 +9664,6 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
DBUG_RETURN(tree2);
SEL_TREE *result= NULL;
key_map result_keys;
key_map ored_keys;
SEL_TREE *rtree[2]= {NULL,NULL};
SEL_IMERGE *imerge[2]= {NULL, NULL};