Skip to content

Commit 3473b67

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch #9: Fix -Wunused-parameter warnings in opt*
1 parent 6823935 commit 3473b67

14 files changed

+107
-131
lines changed

sql/handler.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,7 +4901,9 @@ class handler :public Sql_alloc
49014901
the old schema and table name in this method for some reason it
49024902
has to use ha_alter_info object to figure it out.
49034903
*/
4904-
virtual void notify_table_changed(Alter_inplace_info *ha_alter_info) { };
4904+
virtual void
4905+
notify_table_changed(Alter_inplace_info *ha_alter_info MY_ATTRIBUTE((unused)))
4906+
{ };
49054907

49064908
public:
49074909
/* End of On-line/in-place ALTER TABLE interface. */
@@ -5210,7 +5212,7 @@ class handler :public Sql_alloc
52105212
to data-dictionary only if storage engine supports atomic DDL
52115213
(i.e. has HTON_SUPPORTS_ATOMIC_DDL flag set).
52125214
*/
5213-
virtual int truncate(dd::Table *table_def)
5215+
virtual int truncate(dd::Table *table_def MY_ATTRIBUTE((unused)))
52145216
{ return HA_ERR_WRONG_COMMAND; }
52155217
virtual int optimize(THD*, HA_CHECK_OPT*)
52165218
{ return HA_ADMIN_NOT_IMPLEMENTED; }
@@ -5327,10 +5329,14 @@ class handler :public Sql_alloc
53275329
@retval 0 Success.
53285330
@retval non-0 Error.
53295331
*/
5330-
virtual int get_extra_columns_and_keys(const HA_CREATE_INFO *create_info,
5331-
const List<Create_field> *create_list,
5332-
const KEY *key_info, uint key_count,
5333-
dd::Table *table)
5332+
virtual int
5333+
get_extra_columns_and_keys(const HA_CREATE_INFO
5334+
*create_info MY_ATTRIBUTE((unused)),
5335+
const List<Create_field>
5336+
*create_list MY_ATTRIBUTE((unused)),
5337+
const KEY *key_info MY_ATTRIBUTE((unused)),
5338+
uint key_count MY_ATTRIBUTE((unused)),
5339+
dd::Table *table MY_ATTRIBUTE((unused)))
53345340
{ return 0; }
53355341

53365342
virtual bool set_ha_share_ref(Handler_share **arg_ha_share)

sql/item.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2559,7 +2559,7 @@ void Item_ident_for_show::make_field(Send_field *tmp_field)
25592559
tmp_field->field= false;
25602560
}
25612561

2562-
bool Item_ident_for_show::fix_fields(THD *thd, Item **ref)
2562+
bool Item_ident_for_show::fix_fields(THD*, Item**)
25632563
{
25642564
maybe_null= field->maybe_null();
25652565
decimals= field->decimals();

sql/item_cmpfunc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6118,7 +6118,7 @@ float Item_func_isnull::get_filtering_effect(table_map filter_for_table,
61186118
COND_FILTER_EQUALITY);
61196119
}
61206120

6121-
bool Item_func_isnull::resolve_type(THD *thd)
6121+
bool Item_func_isnull::resolve_type(THD*)
61226122
{
61236123
max_length= 1;
61246124
maybe_null= false;

sql/item_func.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ class Item_func_can_access_trigger : public Item_int_func
22452245
{}
22462246
longlong val_int();
22472247
const char *func_name() const { return "can_access_trigger"; }
2248-
bool resolve_type(THD *thd)
2248+
bool resolve_type(THD*)
22492249
{
22502250
max_length= 4;
22512251
maybe_null= true;
@@ -2262,7 +2262,7 @@ class Item_func_can_access_routine : public Item_int_func
22622262
{}
22632263
longlong val_int();
22642264
const char *func_name() const { return "can_access_routine"; }
2265-
bool resolve_type(THD *thd)
2265+
bool resolve_type(THD*)
22662266
{
22672267
max_length= 4;
22682268
maybe_null= true;
@@ -2278,7 +2278,7 @@ class Item_func_can_access_event : public Item_int_func
22782278
{}
22792279
longlong val_int();
22802280
const char *func_name() const { return "can_access_event"; }
2281-
bool resolve_type(THD *thd)
2281+
bool resolve_type(THD*)
22822282
{
22832283
max_length= 21;
22842284
maybe_null= true;

sql/item_json_func.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ class Item_func_json_pretty final :public Item_str_func
742742

743743
const char *func_name() const override { return "json_pretty"; }
744744

745-
bool resolve_type(THD *thd) override
745+
bool resolve_type(THD*) override
746746
{
747747
set_data_type_string(MAX_BLOB_WIDTH, &my_charset_utf8mb4_bin);
748748
return false;

sql/item_sum.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ class Item_sum_int :public Item_sum_num
795795
{ set_data_type_longlong(); }
796796
Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item)
797797
{ set_data_type_longlong(); }
798-
bool resolve_type(THD *thd) override
798+
bool resolve_type(THD*) override
799799
{
800800
maybe_null= false;
801801
for (uint i= 0; i < arg_count; i++)
@@ -896,7 +896,7 @@ class Item_sum_count :public Item_sum_int
896896
{
897897
return has_with_distinct() ? COUNT_DISTINCT_FUNC : COUNT_FUNC;
898898
}
899-
bool resolve_type(THD *thd) override
899+
bool resolve_type(THD*) override
900900
{
901901
maybe_null= false;
902902
null_value= FALSE;

sql/opt_explain_json.cc

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -251,10 +251,10 @@ class context : public Explain_context
251251
252252
This function is to be overloaded by subquery_ctx.
253253
*/
254-
virtual void set_child(context *child) {}
254+
virtual void set_child(context*) {}
255255

256256
/// associate CTX_UNION_RESULT node with CTX_UNION node
257-
virtual void set_union_result(union_result_ctx *ctx) { DBUG_ASSERT(0); }
257+
virtual void set_union_result(union_result_ctx*) { DBUG_ASSERT(0); }
258258

259259
/**
260260
Append a subquery node to the specified list of the unit node
@@ -265,8 +265,10 @@ class context : public Explain_context
265265
@retval false Ok
266266
@retval true Error
267267
*/
268-
virtual bool add_subquery(subquery_list_enum subquery_type,
269-
subquery_ctx *ctx) { DBUG_ASSERT(0);return true; }
268+
virtual bool
269+
add_subquery(subquery_list_enum subquery_type MY_ATTRIBUTE((unused)),
270+
subquery_ctx *ctx MY_ATTRIBUTE((unused)))
271+
{ DBUG_ASSERT(0);return true; }
270272
/**
271273
Format nested loop join subtree (if any) to JSON formatter
272274
@@ -275,7 +277,8 @@ class context : public Explain_context
275277
@retval false Ok
276278
@retval true Error
277279
*/
278-
virtual bool format_nested_loop(Opt_trace_context *json)
280+
virtual bool
281+
format_nested_loop(Opt_trace_context *json MY_ATTRIBUTE((unused)))
279282
{ DBUG_ASSERT(0); return true; }
280283

281284
/**
@@ -286,15 +289,17 @@ class context : public Explain_context
286289
@retval false Ok
287290
@retval true Error
288291
*/
289-
virtual bool add_join_tab(joinable_ctx *ctx) { DBUG_ASSERT(0);return true; }
292+
virtual bool add_join_tab(joinable_ctx *ctx MY_ATTRIBUTE((unused)))
293+
{ DBUG_ASSERT(0);return true; }
290294

291295
/**
292296
Set nested ORDER BY/GROUP BY/DISTINCT node to @c ctx
293297
294298
@retval false Ok
295299
@retval true Error
296300
*/
297-
virtual void set_sort(sort_ctx *ctx) { DBUG_ASSERT(0); }
301+
virtual void set_sort(sort_ctx *ctx MY_ATTRIBUTE((unused)))
302+
{ DBUG_ASSERT(0); }
298303

299304
/**
300305
Add a query specification node to the CTX_UNION node
@@ -304,7 +309,8 @@ class context : public Explain_context
304309
@retval false Ok
305310
@retval true Error
306311
*/
307-
virtual bool add_query_spec(context *ctx) { DBUG_ASSERT(0); return true; }
312+
virtual bool add_query_spec(context *ctx MY_ATTRIBUTE((unused)))
313+
{ DBUG_ASSERT(0); return true; }
308314

309315
/**
310316
Try to associate a derived subquery node with this or underlying node
@@ -315,7 +321,7 @@ class context : public Explain_context
315321
@retval false Can't associate: this node or its child nodes are not
316322
derived from the subquery
317323
*/
318-
virtual bool find_and_set_derived(context *subquery)
324+
virtual bool find_and_set_derived(context *subquery MY_ATTRIBUTE((unused)))
319325
{
320326
DBUG_ASSERT(0);
321327
return false;
@@ -332,21 +338,22 @@ class context : public Explain_context
332338
0 subqusery were added
333339
1 error occured
334340
*/
335-
virtual int add_where_subquery(subquery_ctx *ctx,
336-
SELECT_LEX_UNIT *subquery)
341+
virtual int
342+
add_where_subquery(subquery_ctx *ctx MY_ATTRIBUTE((unused)),
343+
SELECT_LEX_UNIT *subquery MY_ATTRIBUTE((unused)))
337344
{
338345
DBUG_ASSERT(0);
339346
return false;
340347
}
341348

342349
/// Helper function to format output for derived subquery if any
343-
virtual bool format_derived(Opt_trace_context *json) { return false; }
350+
virtual bool format_derived(Opt_trace_context*) { return false; }
344351

345352
/// Helper function to format output for associated WHERE subqueries if any
346-
virtual bool format_where(Opt_trace_context *json) { return false; }
353+
virtual bool format_where(Opt_trace_context*) { return false; }
347354

348355
/// Helper function to format output for HAVING, ORDER/GROUP BY subqueries
349-
virtual bool format_unit(Opt_trace_context *json) { return false; }
356+
virtual bool format_unit(Opt_trace_context*) { return false; }
350357
};
351358

352359

@@ -582,7 +589,7 @@ class table_base_ctx : virtual public context, virtual public qep_row
582589
virtual bool format_body(Opt_trace_context *json, Opt_trace_object *obj);
583590

584591
public:
585-
virtual size_t id(bool hide)
592+
virtual size_t id(bool)
586593
{
587594
return col_id.is_empty() ? 0 : col_id.value;
588595
}
@@ -878,7 +885,7 @@ class message_ctx : public joinable_ctx,
878885
}
879886

880887
virtual int add_where_subquery(subquery_ctx *ctx,
881-
SELECT_LEX_UNIT *subquery)
888+
SELECT_LEX_UNIT*)
882889
{
883890
return where_subqueries.push_back(ctx);
884891
}
@@ -1608,7 +1615,7 @@ class union_ctx : public unit_ctx
16081615
{}
16091616

16101617
private:
1611-
virtual bool format_body(Opt_trace_context *json, Opt_trace_object *obj)
1618+
virtual bool format_body(Opt_trace_context *json, Opt_trace_object*)
16121619
{
16131620
if (union_result)
16141621
return (union_result->format(json)) || format_unit(json);

0 commit comments

Comments
 (0)