Skip to content

Commit a432077

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch #12: Fix -Wunused-parameter warnings in sql*, part 2.
1 parent 79f7cbd commit a432077

26 files changed

+123
-182
lines changed

sql/opt_hints.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,15 @@ class Opt_hints : public Sql_alloc
238238
239239
@return true if all hint objects are resolved, false otherwise.
240240
*/
241-
virtual bool is_resolved(opt_hints_enum type_arg) { return resolved; }
241+
virtual bool is_resolved(opt_hints_enum type_arg MY_ATTRIBUTE((unused)))
242+
{ return resolved; }
242243
/**
243244
Set hint to unresolved state.
244245
245246
@param type_arg hint type
246247
*/
247-
virtual void set_unresolved(opt_hints_enum type_arg) {}
248+
virtual void set_unresolved(opt_hints_enum type_arg MY_ATTRIBUTE((unused)))
249+
{}
248250
/**
249251
If ignore_print() returns true, hint is not printed
250252
in Opt_hints::print() function. Atm used for
@@ -255,7 +257,8 @@ class Opt_hints : public Sql_alloc
255257
@return true if the hint should not be printed
256258
in Opt_hints::print() function, false otherwise.
257259
*/
258-
virtual bool ignore_print(opt_hints_enum type_arg) const { return false; }
260+
virtual bool ignore_print(opt_hints_enum type_arg MY_ATTRIBUTE((unused))) const
261+
{ return false; }
259262
void incr_resolved_children() { resolved_children++; }
260263
Mem_root_array<Opt_hints*> *child_array_ptr() { return &child_array; }
261264

sql/set_var.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool opened)
772772
}
773773
}
774774
err:
775-
free_underlaid_joins(thd, thd->lex->select_lex);
775+
free_underlaid_joins(thd->lex->select_lex);
776776
DBUG_RETURN(error);
777777
}
778778

sql/sql_insert.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ bool Sql_cmd_insert_base::prepare_inner(THD *thd)
12031203
DBUG_RETURN(true); /* purecov: inspected */
12041204

12051205
if (insert_table->has_gcol() &&
1206-
validate_gc_assignment(thd, &insert_field_list, values, insert_table))
1206+
validate_gc_assignment(&insert_field_list, values, insert_table))
12071207
DBUG_RETURN(true);
12081208
}
12091209

@@ -1323,7 +1323,7 @@ bool Sql_cmd_insert_base::prepare_inner(THD *thd)
13231323
}
13241324

13251325
if (insert_table->has_gcol() &&
1326-
validate_gc_assignment(thd, &insert_field_list,
1326+
validate_gc_assignment(&insert_field_list,
13271327
unit->get_unit_column_types(), insert_table))
13281328
DBUG_RETURN(true);
13291329
}
@@ -1367,7 +1367,7 @@ bool Sql_cmd_insert_base::prepare_inner(THD *thd)
13671367
DBUG_RETURN(true);
13681368

13691369
if (insert_table->has_gcol() &&
1370-
validate_gc_assignment(thd, &update_field_list, &update_value_list,
1370+
validate_gc_assignment(&update_field_list, &update_value_list,
13711371
insert_table))
13721372
DBUG_RETURN(true);
13731373

sql/sql_join_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void JOIN_CACHE::calc_record_fields()
194194
for ( ; tab < qep_tab ; tab++)
195195
{
196196
uint used_fields, used_fieldlength, used_blobs;
197-
calc_used_field_length(join->thd, tab->table(),
197+
calc_used_field_length(tab->table(),
198198
tab->keep_current_rowid,
199199
&used_fields, &used_fieldlength, &used_blobs,
200200
&tab->used_null_fields, &tab->used_uneven_bit_fields);

sql/sql_planner.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ cache_record_length(JOIN *join,uint idx)
8585
{
8686
uint length=0;
8787
JOIN_TAB **pos,**end;
88-
THD *thd=join->thd;
8988

9089
for (pos=join->best_ref+join->const_tables,end=join->best_ref+idx ;
9190
pos != end ;
@@ -100,7 +99,7 @@ cache_record_length(JOIN *join,uint idx)
10099
(1) keep_current_rowid: we don't know if Duplicate Weedout may be
101100
used, length will thus be inaccurate, this is acceptable.
102101
*/
103-
calc_used_field_length(thd, join_tab->table(),
102+
calc_used_field_length(join_tab->table(),
104103
false, // (1)
105104
&used_fields, &join_tab->used_fieldlength,
106105
&used_blobs, &used_null_fields,

sql/sql_plugin.cc

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static SHOW_TYPE pluginvar_show_type(st_mysql_sys_var *plugin_var);
473473
*/
474474
class sys_var_pluginvar: public sys_var
475475
{
476-
static bool on_check_pluginvar(sys_var *self, THD *thd, set_var *var);
476+
static bool on_check_pluginvar(sys_var *self, THD*, set_var *var);
477477
public:
478478
st_plugin_int *plugin;
479479
st_mysql_sys_var *plugin_var;
@@ -487,14 +487,15 @@ class sys_var_pluginvar: public sys_var
487487
const char *orig_pluginvar_name;
488488

489489
static void *operator new(size_t size, MEM_ROOT *mem_root,
490-
const std::nothrow_t &arg= std::nothrow) throw ()
490+
const std::nothrow_t &arg MY_ATTRIBUTE((unused))=
491+
std::nothrow) throw ()
491492
{ return alloc_root(mem_root, size); }
492493

493494
static void operator delete(void *ptr_arg,size_t size)
494495
{ TRASH(ptr_arg, size); }
495496

496-
static void operator delete(void *ptr, MEM_ROOT *mem_root,
497-
const std::nothrow_t &arg) throw ()
497+
static void operator delete(void*, MEM_ROOT*,
498+
const std::nothrow_t&) throw ()
498499
{ /* never called */ }
499500

500501
sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
@@ -522,8 +523,8 @@ class sys_var_pluginvar: public sys_var
522523
uchar* global_value_ptr(THD *thd, LEX_STRING *base)
523524
{ return do_value_ptr(thd, OPT_GLOBAL, base); }
524525
bool do_check(THD *thd, set_var *var);
525-
virtual void session_save_default(THD *thd, set_var *var) {}
526-
virtual void global_save_default(THD *thd, set_var *var) {}
526+
virtual void session_save_default(THD*, set_var*) {}
527+
virtual void global_save_default(THD*, set_var*) {}
527528
bool session_update(THD *thd, set_var *var);
528529
bool global_update(THD *thd, set_var *var);
529530
bool is_default(THD *thd, set_var *var);
@@ -545,7 +546,7 @@ static int test_plugin_options(MEM_ROOT *, st_plugin_int *,
545546
int *, char **);
546547
static bool register_builtin(st_mysql_plugin *, st_plugin_int *,
547548
st_plugin_int **);
548-
static void unlock_variables(THD *thd, struct System_variables *vars);
549+
static void unlock_variables(struct System_variables *vars);
549550
static void cleanup_variables(THD *thd, struct System_variables *vars);
550551
static void plugin_vars_free_values(sys_var *vars);
551552
static bool plugin_var_memalloc_session_update(THD *thd,
@@ -2117,8 +2118,8 @@ void plugin_shutdown(void)
21172118
/*
21182119
release any plugin references held.
21192120
*/
2120-
unlock_variables(NULL, &global_system_variables);
2121-
unlock_variables(NULL, &max_system_variables);
2121+
unlock_variables(&global_system_variables);
2122+
unlock_variables(&max_system_variables);
21222123
}
21232124
}
21242125

@@ -2624,7 +2625,7 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_double_t, double);
26242625
default variable data check and update functions
26252626
****************************************************************************/
26262627

2627-
static int check_func_bool(THD *thd, st_mysql_sys_var *var,
2628+
static int check_func_bool(THD*, st_mysql_sys_var*,
26282629
void *save, st_mysql_value *value)
26292630
{
26302631
char buff[STRING_BUFFER_USUAL_SIZE];
@@ -2740,7 +2741,7 @@ static int check_func_longlong(THD *thd, st_mysql_sys_var *var,
27402741
value->is_unsigned(value), orig);
27412742
}
27422743

2743-
static int check_func_str(THD *thd, st_mysql_sys_var *var,
2744+
static int check_func_str(THD *thd, st_mysql_sys_var*,
27442745
void *save, st_mysql_value *value)
27452746
{
27462747
char buff[STRING_BUFFER_USUAL_SIZE];
@@ -2755,7 +2756,7 @@ static int check_func_str(THD *thd, st_mysql_sys_var *var,
27552756
}
27562757

27572758

2758-
static int check_func_enum(THD *thd, st_mysql_sys_var *var,
2759+
static int check_func_enum(THD*, st_mysql_sys_var *var,
27592760
void *save, st_mysql_value *value)
27602761
{
27612762
char buff[STRING_BUFFER_USUAL_SIZE];
@@ -2793,7 +2794,7 @@ static int check_func_enum(THD *thd, st_mysql_sys_var *var,
27932794
}
27942795

27952796

2796-
static int check_func_set(THD *thd, st_mysql_sys_var *var,
2797+
static int check_func_set(THD*, st_mysql_sys_var *var,
27972798
void *save, st_mysql_value *value)
27982799
{
27992800
char buff[STRING_BUFFER_USUAL_SIZE], *error= 0;
@@ -2848,41 +2849,41 @@ static int check_func_double(THD *thd, st_mysql_sys_var *var,
28482849
}
28492850

28502851

2851-
static void update_func_bool(THD *thd, st_mysql_sys_var *var,
2852+
static void update_func_bool(THD*, st_mysql_sys_var*,
28522853
void *tgt, const void *save)
28532854
{
28542855
*(my_bool *) tgt= *(my_bool *) save ? TRUE : FALSE;
28552856
}
28562857

28572858

2858-
static void update_func_int(THD *thd, st_mysql_sys_var *var,
2859-
void *tgt, const void *save)
2859+
static void update_func_int(THD*, st_mysql_sys_var*,
2860+
void *tgt, const void *save)
28602861
{
28612862
*(int *)tgt= *(int *) save;
28622863
}
28632864

28642865

2865-
static void update_func_long(THD *thd, st_mysql_sys_var *var,
2866+
static void update_func_long(THD*, st_mysql_sys_var*,
28662867
void *tgt, const void *save)
28672868
{
28682869
*(long *)tgt= *(long *) save;
28692870
}
28702871

28712872

2872-
static void update_func_longlong(THD *thd, st_mysql_sys_var *var,
2873-
void *tgt, const void *save)
2873+
static void update_func_longlong(THD*, st_mysql_sys_var*,
2874+
void *tgt, const void *save)
28742875
{
28752876
*(longlong *)tgt= *(ulonglong *) save;
28762877
}
28772878

28782879

2879-
static void update_func_str(THD *thd, st_mysql_sys_var *var,
2880+
static void update_func_str(THD*, st_mysql_sys_var*,
28802881
void *tgt, const void *save)
28812882
{
28822883
*(char **) tgt= *(char **) save;
28832884
}
28842885

2885-
static void update_func_double(THD *thd, st_mysql_sys_var *var,
2886+
static void update_func_double(THD*, st_mysql_sys_var*,
28862887
void *tgt, const void *save)
28872888
{
28882889
*(double *) tgt= *(double *) save;
@@ -3331,7 +3332,7 @@ void plugin_thdvar_init(THD *thd, bool enable_plugins)
33313332
/*
33323333
Unlocks all system variables which hold a reference
33333334
*/
3334-
static void unlock_variables(THD *thd, struct System_variables *vars)
3335+
static void unlock_variables(struct System_variables *vars)
33353336
{
33363337
intern_plugin_unlock(NULL, vars->table_plugin);
33373338
intern_plugin_unlock(NULL, vars->temp_table_plugin);
@@ -3376,7 +3377,7 @@ void plugin_thdvar_cleanup(THD *thd, bool enable_plugins)
33763377
if (enable_plugins)
33773378
{
33783379
Mutex_lock plugin_lock(&LOCK_plugin);
3379-
unlock_variables(thd, &thd->variables);
3380+
unlock_variables(&thd->variables);
33803381
size_t idx;
33813382
if ((idx= thd->lex->plugins.size()))
33823383
{
@@ -3668,7 +3669,7 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
36683669

36693670

36703671
uchar* sys_var_pluginvar::do_value_ptr(THD *running_thd, THD *target_thd, enum_var_type type,
3671-
LEX_STRING *base)
3672+
LEX_STRING*)
36723673
{
36733674
uchar* result;
36743675

@@ -3909,13 +3910,12 @@ ulonglong sys_var_pluginvar::get_max_value()
39093910
sys_var_pluginvar::do_check(), PLUGIN_VAR_NODEFAULT
39103911
39113912
@param self the sys_var structure for the variable being set
3912-
@param thd the current thread
39133913
@param var the data about the value being set
39143914
@return is the setting valid
39153915
@retval true not valid
39163916
@retval false valid
39173917
*/
3918-
bool sys_var_pluginvar::on_check_pluginvar(sys_var *self, THD *thd, set_var *var)
3918+
bool sys_var_pluginvar::on_check_pluginvar(sys_var *self, THD*, set_var *var)
39193919
{
39203920
/* This handler is installed only if NO_DEFAULT is specified */
39213921
DBUG_ASSERT(((sys_var_pluginvar *) self)->plugin_var->flags &
@@ -4046,12 +4046,10 @@ static void plugin_opt_set_limits(struct my_option *options,
40464046
options->arg_type= OPT_ARG;
40474047
}
40484048

4049-
extern "C" my_bool get_one_plugin_option(int optid, const struct my_option *,
4049+
extern "C" my_bool get_one_plugin_option(int, const struct my_option*,
40504050
char *);
40514051

4052-
my_bool get_one_plugin_option(int optid MY_ATTRIBUTE((unused)),
4053-
const struct my_option *opt,
4054-
char *argument)
4052+
my_bool get_one_plugin_option(int, const struct my_option*, char*)
40554053
{
40564054
return 0;
40574055
}

0 commit comments

Comments
 (0)