diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-30 12:48:26 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-30 12:49:53 +0300 |
commit | 46b785262b9f03c4d715fa8ebbeb0d9bc6bb71c0 (patch) | |
tree | c3b3d8d820d9ff8ff37ae4720ed961fc98bbff95 | |
parent | bc70862e13f32756695d5781c793f2525aeb7187 (diff) | |
download | mariadb-git-46b785262b9f03c4d715fa8ebbeb0d9bc6bb71c0.tar.gz |
Fix -Wunused for CMAKE_BUILD_TYPE=RelWithDebInfo
For release builds, do not declare unused variables.
unpack_row(): Omit a debug-only variable from WSREP diagnostic message.
create_wsrep_THD(): Fix -Wmaybe-uninitialized for the PSI_thread_key.
-rw-r--r-- | sql/mysqld.cc | 10 | ||||
-rw-r--r-- | sql/rpl_record.cc | 9 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_partition_admin.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 | ||||
-rw-r--r-- | sql/sys_vars.ic | 4 | ||||
-rw-r--r-- | sql/wsrep_thd.cc | 25 | ||||
-rw-r--r-- | storage/innobase/fil/fil0crypt.cc | 4 |
8 files changed, 23 insertions, 39 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 47c8b0b98af..889072a4cf5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1186,12 +1186,9 @@ PSI_statement_info stmt_info_new_packet; #endif #ifndef EMBEDDED_LIBRARY -void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused: count */) +void net_before_header_psi(struct st_net *net, void *thd, size_t /* unused: count */) { - THD *thd; - thd= static_cast<THD*> (user_data); - DBUG_ASSERT(thd != NULL); - + DBUG_ASSERT(thd); /* We only come where when the server is IDLE, waiting for the next command. Technically, it is a wait on a socket, which may take a long time, @@ -1200,7 +1197,8 @@ void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused Instead, start explicitly an IDLE event. */ MYSQL_SOCKET_SET_STATE(net->vio->mysql_socket, PSI_SOCKET_STATE_IDLE); - MYSQL_START_IDLE_WAIT(thd->m_idle_psi, &thd->m_idle_state); + MYSQL_START_IDLE_WAIT(static_cast<THD*>(thd)->m_idle_psi, + &static_cast<THD*>(thd)->m_idle_state); } void net_after_header_psi(struct st_net *net, void *user_data, diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 214738f930a..92d2c90be26 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2014, SkySQL Ab. + Copyright (c) 2008, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -318,7 +318,7 @@ unpack_row(rpl_group_info *rgi, normal unpack operation. */ uint16 const metadata= tabledef->field_metadata(i); - uchar const *const old_pack_ptr= pack_ptr; + IF_DBUG(uchar const *const old_pack_ptr= pack_ptr;,) pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata); DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;" @@ -336,10 +336,9 @@ unpack_row(rpl_group_info *rgi, Galera Node throws "Could not read field" error and drops out of cluster */ WSREP_WARN("ROW event unpack field: %s metadata: 0x%x;" - " pack_ptr: %p; conv_table %p conv_field %p table %s" + " conv_table %p conv_field %p table %s" " row_end: %p", - f->field_name, metadata, - old_pack_ptr, conv_table, conv_field, + f->field_name, metadata, conv_table, conv_field, (table_found) ? "found" : "not found", row_end ); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d6bbefc3be7..fa04eb6727c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8405,9 +8405,9 @@ bool st_select_lex::add_cross_joined_table(TABLE_LIST *left_op, TABLE_LIST *tbl; List<TABLE_LIST> *right_op_jl= right_op->join_list; - TABLE_LIST *r_tbl= right_op_jl->pop(); + IF_DBUG(const TABLE_LIST *r_tbl=,) right_op_jl->pop(); DBUG_ASSERT(right_op == r_tbl); - TABLE_LIST *l_tbl= right_op_jl->pop(); + IF_DBUG(const TABLE_LIST *l_tbl=,) right_op_jl->pop(); DBUG_ASSERT(left_op == l_tbl); TABLE_LIST *cj_nest; diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index c2fc237dc14..da0d0cdf2a8 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -60,7 +60,7 @@ bool Sql_cmd_alter_table_exchange_partition::execute(THD *thd) referenced from this structure will be modified. @todo move these into constructor... */ - HA_CREATE_INFO create_info(lex->create_info); + IF_DBUG(HA_CREATE_INFO create_info(lex->create_info);,) Alter_info alter_info(lex->alter_info, thd->mem_root); ulong priv_needed= ALTER_ACL | DROP_ACL | INSERT_ACL | CREATE_ACL; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 761e14e31d0..7b71973887e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10606,10 +10606,10 @@ bool Sql_cmd_create_table::execute(THD *thd) { DBUG_ENTER("Sql_cmd_create_table::execute"); LEX *lex= thd->lex; - TABLE_LIST *all_tables= lex->query_tables; SELECT_LEX *select_lex= &lex->select_lex; TABLE_LIST *first_table= select_lex->table_list.first; - DBUG_ASSERT(first_table == all_tables && first_table != 0); + DBUG_ASSERT(first_table == lex->query_tables); + DBUG_ASSERT(first_table != 0); bool link_to_local; TABLE_LIST *create_table= first_table; TABLE_LIST *select_tables= lex->create_last_non_select_table->next_global; diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index bef0235f1bc..a18440e550d 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -1,5 +1,5 @@ /* Copyright (c) 2002, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab. + Copyright (c) 2010, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -629,7 +629,7 @@ public: /* parse and feel list with default values */ if (thd) { - bool res= + IF_DBUG(bool res=,) sysvartrack_validate_value(thd, var->save_result.string_value.str, var->save_result.string_value.length); diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index da90faa74cf..413d7f97214 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -420,25 +420,12 @@ static bool create_wsrep_THD(wsrep_thread_args* args) { mysql_mutex_lock(&LOCK_thread_count); ulong old_wsrep_running_threads= wsrep_running_threads; -#ifdef HAVE_PSI_THREAD_INTERFACE - PSI_thread_key key; - - switch (args->thread_type) - { - case WSREP_APPLIER_THREAD: - key= key_wsrep_applier; - break; - case WSREP_ROLLBACKER_THREAD: - key= key_wsrep_rollbacker; - break; - default: - assert(0); - break; - } -#endif - - bool res= mysql_thread_create(key, &args->thread_id, &connection_attrib, start_wsrep_THD, - (void*)args); + DBUG_ASSERT(args->thread_type == WSREP_APPLIER_THREAD || + args->thread_type == WSREP_ROLLBACKER_THREAD); + bool res= mysql_thread_create(args->thread_type == WSREP_APPLIER_THREAD + ? key_wsrep_applier : key_wsrep_rollbacker, + &args->thread_id, &connection_attrib, + start_wsrep_THD, (void*)args); /* if starting a thread on server startup, wait until the this thread's THD is fully initialized (otherwise a THD initialization code might diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 90b9aba70aa..e1817985685 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2308,8 +2308,8 @@ static void fil_crypt_rotation_list_fill() /* Protect the tablespace while we may release fil_system->mutex. */ space->n_pending_ops++; - fil_space_t* s= fil_system->read_page0( - space->id); + ut_d(const fil_space_t* s=) + fil_system->read_page0(space->id); ut_ad(!s || s == space); space->n_pending_ops--; if (!space->size) { |