Skip to content

Commit 66fbbd6

Browse files
committed
Bug#24296291: FIX -WUNUSED-PARAMETER WARNINGS
Patch #20: Fix -Wunused-parameter warnings with various non-default build options such as without performance schema, with openssl, with innodb memcached, with ndb and without profiling.
1 parent 6539e65 commit 66fbbd6

28 files changed

+98
-66
lines changed

plugin/innodb_memcached/innodb_memcache/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ IF(CMAKE_C_FLAGS MATCHES "-Werror")
3131
STRING(REGEX REPLACE "-Wdeclaration-after-statement" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
3232
ENDIF(CMAKE_C_FLAGS MATCHES "-Werror")
3333

34-
# Set extra flags for the C compiler
34+
# Set extra flags for the C/CXX compiler
3535
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
3636
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-aliasing")
37+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
3738
ENDIF()
3839

3940
SET(MCD__UTILITITY_SOURCES

plugin/keyring/file_io.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ bool is_super_user()
4747
return has_super_privilege;
4848
}
4949

50-
File File_io::open(PSI_file_key file_data_key, const char *filename, int flags,
51-
myf myFlags)
50+
File File_io::open(PSI_file_key file_data_key MY_ATTRIBUTE((unused)),
51+
const char *filename, int flags, myf myFlags)
5252
{
5353
File file= mysql_file_open(file_data_key, filename, flags, MYF(0));
5454
if (file < 0 && (myFlags & MY_WME))

plugin/semisync/semisync_master_ack_receiver.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ void Ack_receiver::remove_slave(THD *thd)
184184
function_exit(kWho);
185185
}
186186

187-
inline void Ack_receiver::set_stage_info(const PSI_stage_info &stage)
187+
inline void Ack_receiver::
188+
set_stage_info(const PSI_stage_info &stage MY_ATTRIBUTE((unused)))
188189
{
189190
#ifdef HAVE_PSI_STAGE_INTERFACE
190191
MYSQL_SET_STAGE(stage.m_key, __FILE__, __LINE__);

rapid/plugin/x/ngs/ngs_common/operations_factory.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class Socket: public Socket_interface {
4848
: m_mysql_socket(mysql_socket) {
4949
}
5050

51-
Socket(PSI_socket_key key, int domain, int type, int protocol)
51+
Socket(PSI_socket_key key MY_ATTRIBUTE((unused)),
52+
int domain, int type, int protocol)
5253
: m_mysql_socket(mysql_socket_socket(key, domain, type, protocol)) {
5354
}
5455

@@ -60,7 +61,8 @@ class Socket: public Socket_interface {
6061
return mysql_socket_bind(m_mysql_socket, addr, len);
6162
}
6263

63-
virtual MYSQL_SOCKET accept(PSI_socket_key key, struct sockaddr *addr, socklen_t *addr_len) {
64+
virtual MYSQL_SOCKET accept(PSI_socket_key key MY_ATTRIBUTE((unused)),
65+
struct sockaddr *addr, socklen_t *addr_len) {
6466
return mysql_socket_accept(key, m_mysql_socket, addr, addr_len);
6567
}
6668

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#include "ngs/memory.h"
2828

2929

30-
void ngs::thread_create(PSI_thread_key key, Thread_t *thread,
30+
void ngs::thread_create(PSI_thread_key key MY_ATTRIBUTE((unused)),
31+
Thread_t *thread,
3132
Start_routine_t func, void *arg)
3233
{
3334
my_thread_attr_t connection_attrib;
@@ -50,7 +51,7 @@ int ngs::thread_join(Thread_t *thread, void **ret)
5051
}
5152

5253

53-
ngs::Mutex::Mutex(PSI_mutex_key key)
54+
ngs::Mutex::Mutex(PSI_mutex_key key MY_ATTRIBUTE((unused)))
5455
{
5556
mysql_mutex_init(key, &m_mutex, NULL);
5657
}
@@ -69,7 +70,7 @@ ngs::Mutex::operator mysql_mutex_t*()
6970

7071

7172

72-
ngs::RWLock::RWLock(PSI_rwlock_key key)
73+
ngs::RWLock::RWLock(PSI_rwlock_key key MY_ATTRIBUTE((unused)))
7374
{
7475
mysql_rwlock_init(key, &m_rwlock);
7576
}
@@ -81,7 +82,7 @@ ngs::RWLock::~RWLock()
8182
}
8283

8384

84-
ngs::Cond::Cond(PSI_cond_key key)
85+
ngs::Cond::Cond(PSI_cond_key key MY_ATTRIBUTE((unused)))
8586
{
8687
mysql_cond_init(key, &m_cond);
8788
}

sql/conn_handler/init_net_server_extension.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
PSI_statement_info stmt_info_new_packet;
4141
#endif
4242

43-
static void net_before_header_psi(struct st_net *net, void *user_data,
43+
static void net_before_header_psi(struct st_net *net MY_ATTRIBUTE((unused)),
44+
void *user_data,
4445
size_t /* unused: count */)
4546
{
4647
THD *thd;
@@ -61,7 +62,8 @@ static void net_before_header_psi(struct st_net *net, void *user_data,
6162
}
6263
}
6364

64-
static void net_after_header_psi(struct st_net *net, void *user_data,
65+
static void net_after_header_psi(struct st_net *net MY_ATTRIBUTE((unused)),
66+
void *user_data,
6567
size_t /* unused: count */, bool rc)
6668
{
6769
THD *thd;

sql/item.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2629,7 +2629,8 @@ class Item : public Parse_tree_node
26292629
@retval true if this expression cannot be used for partial update
26302630
of @a field
26312631
*/
2632-
virtual bool mark_for_partial_update(Field *field) { return true; }
2632+
virtual bool mark_for_partial_update(Field *field MY_ATTRIBUTE((unused)))
2633+
{ return true; }
26332634
};
26342635

26352636

sql/log.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ bool is_valid_log_name(const char *name, size_t len)
623623
*/
624624

625625
static File mysql_file_real_name_reopen(File file,
626-
#ifdef HAVE_PSI_INTERFACE
626+
#ifdef HAVE_PSI_FILE_INTERFACE
627627
PSI_file_key log_file_key,
628628
#endif
629629
int open_flags,
@@ -726,7 +726,7 @@ bool File_query_log::open()
726726

727727
/* Reopen and get real path. */
728728
if ((file= mysql_file_real_name_reopen(file,
729-
#ifdef HAVE_PSI_INTERFACE
729+
#ifdef HAVE_PSI_FILE_INTERFACE
730730
m_log_file_key,
731731
#endif
732732
O_CREAT | O_WRONLY | O_APPEND,

sql/parse_tree_nodes.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -3588,17 +3588,15 @@ class PT_static_privilege final : public PT_role_or_privilege
35883588
class PT_dynamic_privilege final : public PT_role_or_privilege
35893589
{
35903590
LEX_STRING ident;
3591-
const Trivial_array<LEX_CSTRING> *columns;
35923591

35933592
public:
35943593
PT_dynamic_privilege(const POS &pos,
3595-
const LEX_STRING &ident,
3596-
const Trivial_array<LEX_CSTRING> *columns)
3594+
const LEX_STRING &ident)
35973595
: PT_role_or_privilege(pos), ident(ident)
35983596
{}
35993597

36003598
Privilege *get_privilege(THD *thd) override
3601-
{ return new(thd->mem_root) Dynamic_privilege(ident, columns); }
3599+
{ return new(thd->mem_root) Dynamic_privilege(ident, nullptr); }
36023600
};
36033601

36043602

sql/rpl_gtid_execution.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ bool gtid_pre_statement_post_implicit_commit_checks(THD *thd)
605605
}
606606

607607

608-
void gtid_set_performance_schema_values(const THD *thd)
608+
void gtid_set_performance_schema_values(const THD *thd MY_ATTRIBUTE((unused)))
609609
{
610610
DBUG_ENTER("gtid_set_performance_schema_values");
611611
#ifdef HAVE_PSI_TRANSACTION_INTERFACE

sql/rpl_handler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ Observer_info::Observer_info(void *ob, st_plugin_int *p)
6363

6464

6565
Delegate::Delegate(
66-
#ifdef HAVE_PSI_INTERFACE
66+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
6767
PSI_rwlock_key key
6868
#endif
6969
)
7070
{
7171
inited= FALSE;
72-
#ifdef HAVE_PSI_INTERFACE
72+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
7373
if (mysql_rwlock_init(key, &lock))
7474
return;
7575
#else

sql/rpl_handler.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Delegate {
135135
}
136136

137137
explicit Delegate(
138-
#ifdef HAVE_PSI_INTERFACE
138+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
139139
PSI_rwlock_key key
140140
#endif
141141
);
@@ -154,7 +154,7 @@ class Delegate {
154154
bool inited;
155155
};
156156

157-
#ifdef HAVE_PSI_INTERFACE
157+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
158158
extern PSI_rwlock_key key_rwlock_Trans_delegate_lock;
159159
#endif
160160

@@ -164,7 +164,7 @@ class Trans_delegate
164164

165165
Trans_delegate()
166166
: Delegate(
167-
#ifdef HAVE_PSI_INTERFACE
167+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
168168
key_rwlock_Trans_delegate_lock
169169
#endif
170170
)
@@ -186,7 +186,7 @@ class Trans_delegate
186186
uint& number_of_tables);
187187
};
188188

189-
#ifdef HAVE_PSI_INTERFACE
189+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
190190
extern PSI_rwlock_key key_rwlock_Server_state_delegate_lock;
191191
#endif
192192

@@ -196,7 +196,7 @@ class Server_state_delegate
196196

197197
Server_state_delegate()
198198
: Delegate(
199-
#ifdef HAVE_PSI_INTERFACE
199+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
200200
key_rwlock_Server_state_delegate_lock
201201
#endif
202202
)
@@ -211,7 +211,7 @@ class Server_state_delegate
211211
int after_server_shutdown(THD *thd);
212212
};
213213

214-
#ifdef HAVE_PSI_INTERFACE
214+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
215215
extern PSI_rwlock_key key_rwlock_Binlog_storage_delegate_lock;
216216
#endif
217217

@@ -221,7 +221,7 @@ class Binlog_storage_delegate
221221

222222
Binlog_storage_delegate()
223223
: Delegate(
224-
#ifdef HAVE_PSI_INTERFACE
224+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
225225
key_rwlock_Binlog_storage_delegate_lock
226226
#endif
227227
)
@@ -234,7 +234,7 @@ class Binlog_storage_delegate
234234
my_off_t log_pos);
235235
};
236236

237-
#ifdef HAVE_PSI_INTERFACE
237+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
238238
extern PSI_rwlock_key key_rwlock_Binlog_transmit_delegate_lock;
239239
#endif
240240

@@ -244,7 +244,7 @@ class Binlog_transmit_delegate
244244

245245
Binlog_transmit_delegate()
246246
: Delegate(
247-
#ifdef HAVE_PSI_INTERFACE
247+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
248248
key_rwlock_Binlog_transmit_delegate_lock
249249
#endif
250250
)
@@ -265,7 +265,7 @@ class Binlog_transmit_delegate
265265
int after_reset_master(THD *thd, ushort flags);
266266
};
267267

268-
#ifdef HAVE_PSI_INTERFACE
268+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
269269
extern PSI_rwlock_key key_rwlock_Binlog_relay_IO_delegate_lock;
270270
#endif
271271

@@ -275,7 +275,7 @@ class Binlog_relay_IO_delegate
275275

276276
Binlog_relay_IO_delegate()
277277
: Delegate(
278-
#ifdef HAVE_PSI_INTERFACE
278+
#ifdef HAVE_PSI_RWLOCK_INTERFACE
279279
key_rwlock_Binlog_relay_IO_delegate_lock
280280
#endif
281281
)

sql/rpl_slave.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ static inline int fill_mts_gaps_and_recover(Master_info* mi)
12311231
sql_print_information("MTS recovery: starting coordinator thread to fill MTS "
12321232
"gaps.");
12331233
recovery_error= start_slave_thread(
1234-
#ifdef HAVE_PSI_INTERFACE
1234+
#ifdef HAVE_PSI_THREAD_INTERFACE
12351235
key_thread_slave_sql,
12361236
#endif
12371237
handle_slave_sql, &rli->run_lock,
@@ -1934,7 +1934,7 @@ terminate_slave_thread(THD *thd,
19341934

19351935

19361936
bool start_slave_thread(
1937-
#ifdef HAVE_PSI_INTERFACE
1937+
#ifdef HAVE_PSI_THREAD_INTERFACE
19381938
PSI_thread_key thread_key,
19391939
#endif
19401940
my_start_routine h_func, mysql_mutex_t *start_lock,
@@ -2071,7 +2071,7 @@ bool start_slave_threads(bool need_lock_slave, bool wait_for_start,
20712071

20722072
if (thread_mask & SLAVE_IO)
20732073
is_error= start_slave_thread(
2074-
#ifdef HAVE_PSI_INTERFACE
2074+
#ifdef HAVE_PSI_THREAD_INTERFACE
20752075
key_thread_slave_io,
20762076
#endif
20772077
handle_slave_io, lock_io, lock_cond_io,
@@ -2094,7 +2094,7 @@ bool start_slave_threads(bool need_lock_slave, bool wait_for_start,
20942094
}
20952095
if (!is_error)
20962096
is_error= start_slave_thread(
2097-
#ifdef HAVE_PSI_INTERFACE
2097+
#ifdef HAVE_PSI_THREAD_INTERFACE
20982098
key_thread_slave_sql,
20992099
#endif
21002100
handle_slave_sql, lock_sql, lock_cond_sql,
@@ -4360,13 +4360,13 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
43604360
*/
43614361
thd->set_new_thread_id();
43624362

4363-
#ifdef HAVE_PSI_INTERFACE
4363+
#ifdef HAVE_PSI_THREAD_INTERFACE
43644364
/*
43654365
Populate the PROCESSLIST_ID in the instrumentation.
43664366
*/
43674367
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
43684368
PSI_THREAD_CALL(set_thread_id)(psi, thd->thread_id());
4369-
#endif /* HAVE_PSI_INTERFACE */
4369+
#endif /* HAVE_PSI_THREAD_INTERFACE */
43704370

43714371
DBUG_EXECUTE_IF("simulate_io_slave_error_on_init",
43724372
simulate_error|= (1 << SLAVE_THD_IO););
@@ -5669,7 +5669,7 @@ extern "C" void *handle_slave_io(void *arg)
56695669
THD_CHECK_SENTRY(thd);
56705670
mi->info_thd = thd;
56715671

5672-
#ifdef HAVE_PSI_INTERFACE
5672+
#ifdef HAVE_PSI_THREAD_INTERFACE
56735673
// save the instrumentation for IO thread in mi->info_thd
56745674
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
56755675
thd_set_psi(mi->info_thd, psi);
@@ -6263,7 +6263,7 @@ static void *handle_slave_worker(void *arg)
62636263
ulonglong purge_size= 0;
62646264
struct slave_job_item _item, *job_item= &_item;
62656265
Global_THD_manager *thd_manager= Global_THD_manager::get_instance();
6266-
#ifdef HAVE_PSI_INTERFACE
6266+
#ifdef HAVE_PSI_THREAD_INTERFACE
62676267
struct PSI_thread *psi;
62686268
#endif
62696269
Rpl_filter* rpl_filter;
@@ -6283,7 +6283,7 @@ static void *handle_slave_worker(void *arg)
62836283
mysql_mutex_unlock(&w->info_thd_lock);
62846284
thd->thread_stack = (char*)&thd;
62856285

6286-
#ifdef HAVE_PSI_INTERFACE
6286+
#ifdef HAVE_PSI_THREAD_INTERFACE
62876287
// save the instrumentation for worker thread in w->info_thd
62886288
psi= PSI_THREAD_CALL(get_thread)();
62896289
thd_set_psi(w->info_thd, psi);
@@ -7313,7 +7313,7 @@ extern "C" void *handle_slave_sql(void *arg)
73137313
mysql_mutex_lock(&rli->info_thd_lock);
73147314
rli->info_thd= thd;
73157315

7316-
#ifdef HAVE_PSI_INTERFACE
7316+
#ifdef HAVE_PSI_THREAD_INTERFACE
73177317
// save the instrumentation for SQL thread in rli->info_thd
73187318
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
73197319
thd_set_psi(rli->info_thd, psi);

sql/rpl_slave.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report,
388388
mysql_cond_wait() on start_cond, start_lock
389389
*/
390390
bool start_slave_thread(
391-
#ifdef HAVE_PSI_INTERFACE
391+
#ifdef HAVE_PSI_THREAD_INTERFACE
392392
PSI_thread_key thread_key,
393393
#endif
394394
my_start_routine h_func,

sql/rwlock_scoped_lock.cc

+5-3
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
@@ -26,8 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */
2626
@param file File in which lock acquisition is to be presented.
2727
@param line Line of file in which lock acquisition is to be presented.
2828
*/
29-
rwlock_scoped_lock::rwlock_scoped_lock(
30-
mysql_rwlock_t* lock, bool lock_for_write, const char* file, int line)
29+
rwlock_scoped_lock::rwlock_scoped_lock(mysql_rwlock_t* lock,
30+
bool lock_for_write,
31+
const char* file MY_ATTRIBUTE((unused)),
32+
int line MY_ATTRIBUTE((unused)))
3133
: m_lock(lock)
3234
{
3335
if (lock_for_write)

0 commit comments

Comments
 (0)