Skip to content

Commit 3f705a2

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch mysql#19: Fix -Wunused-parameter warnings in release build.
1 parent e80e0e3 commit 3f705a2

File tree

110 files changed

+365
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+365
-273
lines changed

client/mysql_config_editor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ extern "C" {
227227
static bool
228228
my_program_get_one_option(int optid,
229229
const struct my_option *opt MY_ATTRIBUTE((unused)),
230-
char *argument)
230+
char *argument MY_ATTRIBUTE((unused)))
231231
{
232232
switch(optid) {
233233
case '#':

plugin/replication_observers_example/replication_observers_example.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static void dump_transaction_calls()
201201
/*
202202
Transaction lifecycle events observers.
203203
*/
204-
static int trans_before_dml(Trans_param*, int& out_val)
204+
static int trans_before_dml(Trans_param*, int& out_val MY_ATTRIBUTE((unused)))
205205
{
206206
trans_before_dml_call++;
207207

@@ -293,7 +293,7 @@ static int before_commit_tests(Trans_param *param,
293293
}
294294
#endif
295295

296-
static int trans_before_commit(Trans_param *param)
296+
static int trans_before_commit(Trans_param *param MY_ATTRIBUTE((unused)))
297297
{
298298
trans_before_commit_call++;
299299

@@ -329,7 +329,7 @@ static int trans_after_commit(Trans_param*)
329329
return 0;
330330
}
331331

332-
static int trans_after_rollback(Trans_param *param)
332+
static int trans_after_rollback(Trans_param *param MY_ATTRIBUTE((unused)))
333333
{
334334
trans_after_rollback_call++;
335335

plugin/rewriter/rewriter_plugin.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,10 @@ static void log_nonrewritten_query(MYSQL_THD thd, const uchar *digest_buf,
340340
query when the plugin is active. The function extracts the digest of the
341341
query. If the digest matches an existing rewrite rule, it is executed.
342342
*/
343-
static int rewrite_query_notify(MYSQL_THD thd, mysql_event_class_t event_class,
344-
const void *event)
343+
static
344+
int rewrite_query_notify(MYSQL_THD thd,
345+
mysql_event_class_t event_class MY_ATTRIBUTE((unused)),
346+
const void *event)
345347
{
346348
DBUG_ASSERT(event_class == MYSQL_AUDIT_PARSE_CLASS);
347349

plugin/version_token/version_token.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,10 @@ static int parse_vtokens(char *input, enum command type)
515515
@param event_class audit API event class
516516
@param event pointer to the audit API event data
517517
*/
518-
static int version_token_check(MYSQL_THD thd,
519-
mysql_event_class_t event_class,
520-
const void *event)
518+
static
519+
int version_token_check(MYSQL_THD thd,
520+
mysql_event_class_t event_class MY_ATTRIBUTE((unused)),
521+
const void *event)
521522
{
522523
char *sess_var;
523524

rapid/plugin/x/ngs/src/protocol_encoder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void Protocol_encoder::log_protobuf(const char *direction_name, Request &request
258258

259259
void
260260
Protocol_encoder::log_protobuf(const char *direction_name MY_ATTRIBUTE((unused)),
261-
const Message *message)
261+
const Message *message MY_ATTRIBUTE((unused)))
262262
{
263263
#ifdef USE_MYSQLX_FULL_PROTO
264264
std::string text_message;

rapid/plugin/x/src/xpl_regex.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2016, 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
@@ -22,7 +22,7 @@
2222
namespace
2323
{
2424

25-
inline void check_result(const int err)
25+
inline void check_result(const int err MY_ATTRIBUTE((unused)))
2626
{
2727
DBUG_ASSERT( err == 0 );
2828
}

sql/binlog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8796,7 +8796,7 @@ static const char* g_stage_name[] = {
87968796
*/
87978797

87988798
bool
8799-
MYSQL_BIN_LOG::change_stage(THD *thd,
8799+
MYSQL_BIN_LOG::change_stage(THD *thd MY_ATTRIBUTE((unused)),
88008800
Stage_manager::StageID stage, THD *queue,
88018801
mysql_mutex_t *leave_mutex,
88028802
mysql_mutex_t *enter_mutex)

sql/dd/impl/cache/storage_adapter.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ bool Storage_adapter::get(THD *thd,
187187

188188
// Drop a dictionary object from core storage.
189189
template <typename T>
190-
void Storage_adapter::core_drop(THD *thd, const T *object)
190+
void Storage_adapter::core_drop(THD *thd MY_ATTRIBUTE((unused)),
191+
const T *object)
191192
{
192193
DBUG_ASSERT(s_use_fake_storage || thd->is_dd_system_thread());
193194
DBUG_ASSERT(bootstrap::stage() <= bootstrap::BOOTSTRAP_CREATED);

sql/dd/impl/sdi.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,11 @@ sdi_t serialize(const Tablespace &tablespace)
398398
}
399399

400400

401-
template <class Dd_type>
402-
bool generic_deserialize(THD *thd, const sdi_t &sdi,
403-
const String_type &object_type_name, Dd_type *dst,
404-
String_type *schema_name_from_sdi= nullptr)
401+
template <class Dd_type> bool
402+
generic_deserialize(THD *thd, const sdi_t &sdi,
403+
const String_type &object_type_name MY_ATTRIBUTE((unused)),
404+
Dd_type *dst,
405+
String_type *schema_name_from_sdi= nullptr)
405406
{
406407
RJ_Document doc;
407408
doc.Parse<0>(sdi.c_str());

sql/event_queue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Event_queue::empty_queue()
518518
*/
519519

520520
void
521-
Event_queue::dbug_dump_queue(time_t now)
521+
Event_queue::dbug_dump_queue(time_t now MY_ATTRIBUTE((unused)))
522522
{
523523
#ifndef DBUG_OFF
524524
DBUG_ENTER("Event_queue::dbug_dump_queue");

sql/field.cc

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,7 +3548,8 @@ int Field_tiny::cmp(const uchar *a_ptr, const uchar *b_ptr)
35483548
return (a < b) ? -1 : (a > b) ? 1 : 0;
35493549
}
35503550

3551-
size_t Field_tiny::make_sort_key(uchar *to, size_t length)
3551+
size_t Field_tiny::make_sort_key(uchar *to,
3552+
size_t length MY_ATTRIBUTE((unused)))
35523553
{
35533554
DBUG_ASSERT(length == 1);
35543555
if (unsigned_flag)
@@ -3786,7 +3787,8 @@ int Field_short::cmp(const uchar *a_ptr, const uchar *b_ptr)
37863787
return (a < b) ? -1 : (a > b) ? 1 : 0;
37873788
}
37883789

3789-
size_t Field_short::make_sort_key(uchar *to, size_t length)
3790+
size_t Field_short::make_sort_key(uchar *to,
3791+
size_t length MY_ATTRIBUTE((unused)))
37903792
{
37913793
DBUG_ASSERT(length == 2);
37923794
#ifdef WORDS_BIGENDIAN
@@ -3994,7 +3996,8 @@ int Field_medium::cmp(const uchar *a_ptr, const uchar *b_ptr)
39943996
return (a < b) ? -1 : (a > b) ? 1 : 0;
39953997
}
39963998

3997-
size_t Field_medium::make_sort_key(uchar *to, size_t length)
3999+
size_t Field_medium::make_sort_key(uchar *to,
4000+
size_t length MY_ATTRIBUTE((unused)))
39984001
{
39994002
DBUG_ASSERT(length == 3);
40004003
if (unsigned_flag)
@@ -4243,7 +4246,8 @@ int Field_long::cmp(const uchar *a_ptr, const uchar *b_ptr)
42434246
return (a < b) ? -1 : (a > b) ? 1 : 0;
42444247
}
42454248

4246-
size_t Field_long::make_sort_key(uchar *to, size_t length)
4249+
size_t Field_long::make_sort_key(uchar *to,
4250+
size_t length MY_ATTRIBUTE((unused)))
42474251
{
42484252
DBUG_ASSERT(length == 4);
42494253
#ifdef WORDS_BIGENDIAN
@@ -5828,7 +5832,8 @@ int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr)
58285832
}
58295833

58305834

5831-
size_t Field_timestamp::make_sort_key(uchar *to, size_t length)
5835+
size_t Field_timestamp::make_sort_key(uchar *to,
5836+
size_t length MY_ATTRIBUTE((unused)))
58325837
{
58335838
DBUG_ASSERT(length == 4);
58345839
#ifdef WORDS_BIGENDIAN
@@ -6220,7 +6225,8 @@ int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr)
62206225
}
62216226

62226227

6223-
size_t Field_time::make_sort_key(uchar *to, size_t length)
6228+
size_t Field_time::make_sort_key(uchar *to,
6229+
size_t length MY_ATTRIBUTE((unused)))
62246230
{
62256231
DBUG_ASSERT(length == 3);
62266232
to[0] = (uchar) (ptr[2] ^ 128);
@@ -6630,7 +6636,8 @@ int Field_newdate::cmp(const uchar *a_ptr, const uchar *b_ptr)
66306636
}
66316637

66326638

6633-
size_t Field_newdate::make_sort_key(uchar *to, size_t length)
6639+
size_t Field_newdate::make_sort_key(uchar *to,
6640+
size_t length MY_ATTRIBUTE((unused)))
66346641
{
66356642
DBUG_ASSERT(length == 3);
66366643
to[0] = ptr[2];
@@ -8591,7 +8598,6 @@ uchar *Field_blob::pack(uchar *to, const uchar *from,
85918598
simply is used as a pass-through to the original unpack() method for
85928599
blob fields.
85938600
8594-
@param to Destination of the data
85958601
@param from Source of the data
85968602
@param param_data @c TRUE if base types should be stored in little-
85978603
endian format, @c FALSE if native format should
@@ -8601,15 +8607,15 @@ uchar *Field_blob::pack(uchar *to, const uchar *from,
86018607
86028608
@return New pointer into memory based on from + length of the data
86038609
*/
8604-
const uchar *Field_blob::unpack(uchar *to,
8610+
const uchar *Field_blob::unpack(uchar*,
86058611
const uchar *from,
86068612
uint param_data,
86078613
bool low_byte_first)
86088614
{
86098615
DBUG_ENTER("Field_blob::unpack");
8610-
DBUG_PRINT("enter", ("to: %p; from: %p;"
8616+
DBUG_PRINT("enter", ("from: %p;"
86118617
" param_data: %u; low_byte_first: %d",
8612-
to, from, param_data, low_byte_first));
8618+
from, param_data, low_byte_first));
86138619
uint const master_packlength=
86148620
param_data > 0 ? param_data & 0xFF : packlength;
86158621
uint32 const length= get_length(from, master_packlength, low_byte_first);

sql/item.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10240,7 +10240,8 @@ bool Item_cache_row::cache_value()
1024010240
}
1024110241

1024210242

10243-
void Item_cache_row::illegal_method_call(const char *method) const
10243+
void Item_cache_row::
10244+
illegal_method_call(const char *method MY_ATTRIBUTE((unused))) const
1024410245
{
1024510246
DBUG_ENTER("Item_cache_row::illegal_method_call");
1024610247
DBUG_PRINT("error", ("!!! %s method was called for row item", method));

sql/item_cmpfunc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ class Eq_creator :public Linear_comp_creator
398398
class Equal_creator :public Linear_comp_creator
399399
{
400400
public:
401-
virtual const char* symbol(bool invert) const
401+
virtual const char* symbol(bool invert MY_ATTRIBUTE((unused))) const
402402
{
403403
// This will never be called with true.
404404
DBUG_ASSERT(!invert);

sql/item_json_func.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,9 @@ bool Item_func_json_extract::val_json(Json_wrapper *wr)
20602060
@param[in] v the JSON item matched
20612061
@return true if v is a top level item
20622062
*/
2063-
static inline bool wrapped_top_level_item(Json_path *path, Json_dom *v)
2063+
static inline
2064+
bool wrapped_top_level_item(Json_path *path MY_ATTRIBUTE((unused)),
2065+
Json_dom *v)
20642066
{
20652067
if (v->parent())
20662068
return false;

sql/item_row.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ bool Item_row::itemize(Parse_context *pc, Item **res)
9090
}
9191

9292

93-
void Item_row::illegal_method_call(const char *method) const
93+
void Item_row::
94+
illegal_method_call(const char *method MY_ATTRIBUTE((unused))) const
9495
{
9596
DBUG_ENTER("Item_row::illegal_method_call");
9697
DBUG_PRINT("error", ("!!! %s method was called for row item", method));

sql/item_sum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class Item_sum :public Item_result_field
473473
Type type() const override { return SUM_FUNC_ITEM; }
474474
virtual enum Sumfunctype sum_func() const= 0;
475475
virtual void fix_after_pullout(SELECT_LEX*,
476-
SELECT_LEX *removed_select) override
476+
SELECT_LEX *removed_select MY_ATTRIBUTE((unused))) override
477477
{
478478
// Just make sure we are not aggregating into a context that is merged up.
479479
DBUG_ASSERT(base_select != removed_select &&

sql/key.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length)
548548
*/
549549
int key_cmp2(KEY_PART_INFO *key_part,
550550
const uchar *key1, uint key1_length,
551-
const uchar *key2, uint key2_length)
551+
const uchar *key2,
552+
uint key2_length MY_ATTRIBUTE((unused)))
552553
{
553554
DBUG_ASSERT(key_part && key1 && key2);
554555
DBUG_ASSERT((key1_length == key2_length) && key1_length != 0 );

sql/opt_range.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,7 +2782,9 @@ class TABLE_READ_PLAN
27822782
static void *operator new(size_t size, MEM_ROOT *mem_root,
27832783
const std::nothrow_t &arg MY_ATTRIBUTE((unused))= std::nothrow) throw ()
27842784
{ return alloc_root(mem_root, size); }
2785-
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
2785+
static void operator delete(void *ptr MY_ATTRIBUTE((unused)),
2786+
size_t size MY_ATTRIBUTE((unused)))
2787+
{ TRASH(ptr, size); }
27862788
static void operator delete(void*, MEM_ROOT*,
27872789
const std::nothrow_t &) throw ()
27882790
{ /* Never called */ }
@@ -15529,9 +15531,10 @@ static void append_range_all_keyparts(Opt_trace_array *range_trace,
1552915531
@param tree The SEL_TREE that will be printed to debug log
1553015532
@param param PARAM from test_quick_select
1553115533
*/
15532-
static inline void dbug_print_tree(const char *tree_name,
15533-
SEL_TREE *tree,
15534-
const RANGE_OPT_PARAM *param)
15534+
static inline
15535+
void dbug_print_tree(const char *tree_name MY_ATTRIBUTE((unused)),
15536+
SEL_TREE *tree MY_ATTRIBUTE((unused)),
15537+
const RANGE_OPT_PARAM *param MY_ATTRIBUTE((unused)))
1553515538
{
1553615539
#ifndef DBUG_OFF
1553715540
if (_db_enabled_())

sql/opt_trace.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ class Opt_trace_stmt
190190
size_t alloced_length() const
191191
{ return trace_buffer.alloced_length() + query_buffer.alloced_length(); }
192192

193-
void assert_current_struct(const Opt_trace_struct *s) const
193+
void assert_current_struct
194+
(const Opt_trace_struct *s MY_ATTRIBUTE((unused))) const
194195
{ DBUG_ASSERT(current_struct == s); }
195196

196197
/// @see Opt_trace_context::missing_privilege()

sql/parse_file.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,10 @@ File_parser::parse(uchar* base, MEM_ROOT *mem_root,
584584
*/
585585

586586
bool
587-
File_parser_dummy_hook::process_unknown_string(const char *&unknown_key,
588-
uchar*, MEM_ROOT*,
589-
const char*)
587+
File_parser_dummy_hook::
588+
process_unknown_string(const char *&unknown_key MY_ATTRIBUTE((unused)),
589+
uchar*, MEM_ROOT*,
590+
const char*)
590591
{
591592
DBUG_ENTER("file_parser_dummy_hook::process_unknown_string");
592593
DBUG_PRINT("info", ("Unknown key: '%60s'", unknown_key));

sql/partition_info.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3260,7 +3260,8 @@ bool partition_info::same_key_column_order(List<Create_field> *create_list)
32603260
}
32613261

32623262

3263-
void partition_info::print_debug(const char *str, uint *value)
3263+
void partition_info::print_debug(const char *str MY_ATTRIBUTE((unused)),
3264+
uint *value)
32643265
{
32653266
DBUG_ENTER("print_debug");
32663267
if (value)

sql/partitioning/partition_handler.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ Partition_share::~Partition_share()
143143
@retval false Success.
144144
*/
145145

146-
bool Partition_share::init_auto_inc_mutex(TABLE_SHARE *table_share)
146+
bool Partition_share::
147+
init_auto_inc_mutex(TABLE_SHARE *table_share MY_ATTRIBUTE((unused)))
147148
{
148149
DBUG_ENTER("Partition_share::init_auto_inc_mutex");
149150
DBUG_ASSERT(!auto_inc_mutex);
@@ -175,10 +176,11 @@ bool Partition_share::init_auto_inc_mutex(TABLE_SHARE *table_share)
175176
@param next_insert_id Next insert id (first non used auto inc value).
176177
@param max_reserved End of reserved auto inc range.
177178
*/
178-
void
179-
Partition_share::release_auto_inc_if_possible(THD *thd, TABLE_SHARE *table_share,
180-
const ulonglong next_insert_id,
181-
const ulonglong max_reserved)
179+
void Partition_share::
180+
release_auto_inc_if_possible(THD *thd,
181+
TABLE_SHARE *table_share MY_ATTRIBUTE((unused)),
182+
const ulonglong next_insert_id,
183+
const ulonglong max_reserved)
182184
{
183185
DBUG_ASSERT(auto_inc_mutex);
184186

@@ -2832,7 +2834,8 @@ int Partition_helper::ph_index_next(uchar *buf)
28322834
@retval != 0 Error code
28332835
*/
28342836

2835-
int Partition_helper::ph_index_next_same(uchar *buf, uint keylen)
2837+
int Partition_helper::ph_index_next_same(uchar *buf,
2838+
uint keylen MY_ATTRIBUTE((unused)))
28362839
{
28372840
DBUG_ENTER("Partition_helper::ph_index_next_same");
28382841

sql/rpl_context.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Session_consistency_gtids_ctx::register_ctx_change_listener(
176176
}
177177

178178
void Session_consistency_gtids_ctx::unregister_ctx_change_listener(
179-
Session_consistency_gtids_ctx::Ctx_change_listener* listener)
179+
Session_consistency_gtids_ctx::Ctx_change_listener* listener MY_ATTRIBUTE((unused)))
180180
{
181181
DBUG_ASSERT(m_listener == listener || m_listener == NULL);
182182

sql/rpl_gtid_execution.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static inline bool is_already_logged_transaction(const THD *thd)
361361
362362
@param thd The calling thread.
363363
*/
364-
static inline void skip_statement(const THD *thd)
364+
static inline void skip_statement(const THD *thd MY_ATTRIBUTE((unused)))
365365
{
366366
DBUG_ENTER("skip_statement");
367367

0 commit comments

Comments
 (0)