From 9990027f872764d64e6a450fe9988fb9a7263c5c Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 15 Jan 2019 17:05:42 +0200 Subject: [PATCH] Fixed compiler warnings from optimized builds --- sql/mysqld.cc | 2 +- sql/sql_delete.cc | 4 +--- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 2 ++ storage/connect/plugutil.cpp | 2 +- storage/innobase/handler/handler0alter.cc | 6 +++--- storage/maria/test_ma_backup.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6ff019fdaea..a7e29811dd1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4908,8 +4908,8 @@ int reinit_ssl() ssl_acceptor_fd= new_fd; ssl_acceptor_stats.init(); mysql_rwlock_unlock(&LOCK_ssl_refresh); - return 0; #endif + return 0; } static void end_ssl() diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 148c2371a6b..1630d335559 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -319,9 +319,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, DBUG_RETURN(true); } - TABLE *table= table_list->table; - DBUG_ASSERT(table); - + DBUG_ASSERT(table_list->table); DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute()); // conds could be cached from previous SP call diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1b8f448553b..bba2d33bea7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -9342,7 +9342,7 @@ bool LEX::parsed_insert_select(SELECT_LEX *first_select) return true; // fix "main" select - SELECT_LEX *blt= pop_select(); + SELECT_LEX *blt __attribute__((unused))= pop_select(); DBUG_ASSERT(blt == &builtin_select); push_select(first_select); return false; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 40ba3b6e7b7..49ff46c2bf9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3438,12 +3438,14 @@ public: void pop_context() { DBUG_ENTER("LEX::pop_context"); +#ifndef DBUG_OFF Name_resolution_context *context= context_stack.pop(); DBUG_PRINT("info", ("Pop context %p Select: %p (%d)", context, context->select_lex, (context->select_lex ? context->select_lex->select_number: 0))); +#endif DBUG_VOID_RETURN; } diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 048f00be75f..6790e7eb45c 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -526,7 +526,7 @@ BOOL PlugSubSet(void *memp, uint size) /***********************************************************************/ /* Use it to export a function that do throwing. */ /***********************************************************************/ -void *DoThrow(int n) +static void *DoThrow(int n) { throw n; } /* end of DoThrow */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 2295e3fa5bf..e00380374eb 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -167,7 +167,7 @@ to instant->dropped[] template inline void dict_table_t::init_instant(const dict_table_t& table) { - const dict_index_t& oindex = *table.indexes.start; + const dict_index_t& oindex __attribute__((unused))= *table.indexes.start; dict_index_t& index = *indexes.start; const unsigned u = index.first_user_field(); DBUG_ASSERT(u == oindex.first_user_field()); @@ -785,9 +785,9 @@ inline void dict_table_t::rollback_instant( index->get_n_nullable(index->n_core_fields)); const dict_col_t* const new_cols = cols; - const dict_col_t* const new_cols_end = cols + n_cols; + const dict_col_t* const new_cols_end __attribute__((unused)) = cols + n_cols; const dict_v_col_t* const new_v_cols = v_cols; - const dict_v_col_t* const new_v_cols_end = v_cols + n_v_cols; + const dict_v_col_t* const new_v_cols_end __attribute__((unused))= v_cols + n_v_cols; cols = old_cols; col_names = old_col_names; diff --git a/storage/maria/test_ma_backup.c b/storage/maria/test_ma_backup.c index 439ea7fd665..2a9a6704ecb 100644 --- a/storage/maria/test_ma_backup.c +++ b/storage/maria/test_ma_backup.c @@ -32,7 +32,7 @@ static int create_test_table(const char *table_name, int stage); static int copy_table(const char *table_name, int stage); static void create_record(uchar *record,uint rownr); -int main(int argc,char *argv[]) +int main(int argc __attribute__((unused)), char *argv[]) { int error= 1; int i;