diff options
author | Michael Widenius <monty@mariadb.org> | 2018-04-11 02:20:22 +0300 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2018-04-16 20:16:43 +0300 |
commit | ddc5764303dd72f68d2c69cc574a6f42e8bcf86d (patch) | |
tree | ce22119346b027d359a909f7e272330dabd4c19b | |
parent | dbbe70e1cfe9d7635d9dba774a2c9dc61163b542 (diff) | |
download | mariadb-git-ddc5764303dd72f68d2c69cc574a6f42e8bcf86d.tar.gz |
Remove compiler warnings
- Remove unused variables
- Mark variables unused
- Fix wrong types
- Add no-strict-aliasing to BUILD scripts
-rwxr-xr-x | BUILD/SETUP.sh | 2 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 2 | ||||
-rw-r--r-- | sql/item_jsonfunc.cc | 2 | ||||
-rw-r--r-- | sql/item_sum.cc | 6 | ||||
-rw-r--r-- | sql/opt_split.cc | 2 | ||||
-rw-r--r-- | sql/rpl_rli.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 4 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 3 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 2 | ||||
-rw-r--r-- | storage/innobase/rem/rem0rec.cc | 10 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.cc | 2 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 2 | ||||
-rw-r--r-- | storage/spider/spd_trx.cc | 4 |
15 files changed, 25 insertions, 24 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 721ed3a4c45..e9bede9c746 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -140,7 +140,7 @@ elif [ "x$warning_mode" = "xmaintainer" ]; then debug_extra_cflags="-g3" else # Both C and C++ warnings - warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized" + warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing" # For more warnings, uncomment the following line # warnings="$warnings -Wshadow" diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 745a6adf8b9..1774f8473bb 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3036,7 +3036,7 @@ static dberr_t xb_assign_undo_space_start() byte* page; bool ret; dberr_t error = DB_SUCCESS; - ulint space, page_no; + ulint space, page_no __attribute__((unused)); if (srv_undo_tablespaces == 0) { return error; diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 4b2de7cf28b..58e50f5d3a1 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -2615,7 +2615,7 @@ String *Item_func_json_remove::val_str(String *str) { uint array_counters[JSON_DEPTH_LIMIT]; json_path_with_flags *c_path= paths + n_path; - const char *rem_start, *rem_end; + const char *rem_start= 0, *rem_end; const json_path_step_t *lp; uint n_item= 0; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 2ec7e3c338f..2d47aeb179d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2456,7 +2456,7 @@ Item *Item_sum_max::copy_or_same(THD* thd) bool Item_sum_max::add() { - Item *tmp_item; + Item * UNINIT_VAR(tmp_item); DBUG_ENTER("Item_sum_max::add"); DBUG_PRINT("enter", ("this: %p", this)); @@ -2661,7 +2661,7 @@ void Item_sum_num::reset_field() void Item_sum_hybrid::reset_field() { - Item *tmp_item, *arg0; + Item *UNINIT_VAR(tmp_item), *arg0; DBUG_ENTER("Item_sum_hybrid::reset_field"); arg0= args[0]; @@ -3018,7 +3018,7 @@ Item *Item_sum_avg::result_item(THD *thd, Field *field) void Item_sum_hybrid::update_field() { DBUG_ENTER("Item_sum_hybrid::update_field"); - Item *tmp_item; + Item *UNINIT_VAR(tmp_item); if (unlikely(direct_added)) { tmp_item= args[0]; diff --git a/sql/opt_split.cc b/sql/opt_split.cc index 6467706bc0b..063ca9fd940 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -862,7 +862,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, table_map tables_usable_for_splitting= spl_opt_info->tables_usable_for_splitting; KEYUSE_EXT *keyuse_ext= &join->ext_keyuses_for_splitting->at(0); - KEYUSE_EXT *best_key_keyuse_ext_start; + KEYUSE_EXT *UNINIT_VAR(best_key_keyuse_ext_start); TABLE *best_table= 0; double best_rec_per_key= DBL_MAX; SplM_plan_info *spl_plan= 0; diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 04109ddadb4..c79a6440e84 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1520,7 +1520,7 @@ scan_one_gtid_slave_pos_table(THD *thd, HASH *hash, DYNAMIC_ARRAY *array, LEX_CSTRING *tablename, void **out_hton) { TABLE_LIST tlist; - TABLE *table; + TABLE *UNINIT_VAR(table); bool table_opened= false; bool table_scanned= false; struct gtid_pos_element tmp_entry, *entry; diff --git a/sql/slave.cc b/sql/slave.cc index bf70db66f35..05b9c519017 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -356,7 +356,7 @@ end: static void handle_gtid_pos_auto_create_request(THD *thd, void *hton) { - int err; + int UNINIT_VAR(err); plugin_ref engine= NULL, *auto_engines; rpl_slave_state::gtid_pos_table *entry; StringBuffer<FN_REFLEN> loc_table_name; @@ -6069,7 +6069,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) { int error= 0; StringBuffer<1024> error_msg; - ulonglong inc_pos; + ulonglong inc_pos= 0; ulonglong event_pos; Relay_log_info *rli= &mi->rli; mysql_mutex_t *log_lock= rli->relay_log.get_log_lock(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 5ce6a6b001c..3de45b0ad66 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6548,7 +6548,7 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2, Query_arena *arena, backup; bool result= TRUE; bool first_outer_loop= TRUE; - Field *field_1, *field_2; + Field *field_1; field_visibility_t field_1_invisible, field_2_invisible; /* Leaf table references to which new natural join columns are added @@ -6572,6 +6572,8 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2, { bool found= FALSE; const LEX_CSTRING *field_name_1; + Field *field_2= 0; + /* true if field_name_1 is a member of using_fields */ bool is_using_column_1; if (!(nj_col_1= it_1.get_or_create_column_ref(thd, leaf_1))) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fbcf09758e6..2593bac7462 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4891,7 +4891,7 @@ end_with_restore_list: unit->set_limit(select_lex); MYSQL_DELETE_START(thd->query()); - Protocol *save_protocol; + Protocol * UNINIT_VAR(save_protocol); bool replaced_protocol= false; if (!select_lex->item_list.is_empty()) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 03edb023bdc..c71efede856 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1188,7 +1188,6 @@ buf_madvise_do_dump() { int ret= 0; buf_pool_t* buf_pool; - ulint n; buf_chunk_t* chunk; /* mirrors allocation in log_sys_init() */ @@ -1207,7 +1206,7 @@ buf_madvise_do_dump() buf_pool_mutex_enter_all(); - for (int i= 0; i < srv_buf_pool_instances; i++) + for (ulong i= 0; i < srv_buf_pool_instances; i++) { buf_pool = buf_pool_from_array(i); chunk = buf_pool->chunks; diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 4bd99ccd7d8..6adbebcd68c 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -967,7 +967,7 @@ buf_flush_init_for_writing( } } - uint32_t checksum; + uint32_t checksum= 0; switch (srv_checksum_algorithm_t(srv_checksum_algorithm)) { case SRV_CHECKSUM_ALGORITHM_INNODB: diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index dcc435c091f..3c7292ef1ca 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -322,7 +322,7 @@ rec_init_offsets_comp_ordinary( || dict_table_is_comp(index->table)); ut_ad(format != REC_LEAF_TEMP_COLUMNS_ADDED || index->n_fields == rec_offs_n_fields(offsets)); - ut_d(ulint n_null); + ut_d(ulint n_null= 0); switch (format) { case REC_LEAF_TEMP: @@ -1447,10 +1447,10 @@ rec_convert_dtuple_to_rec_comp( byte* end; byte* nulls = temp ? rec - 1 : rec - (REC_N_NEW_EXTRA_BYTES + 1); - byte* lens; + byte* UNINIT_VAR(lens); ulint len; ulint i; - ulint n_node_ptr_field; + ulint UNINIT_VAR(n_node_ptr_field); ulint fixed_len; ulint null_mask = 1; @@ -1835,7 +1835,7 @@ rec_copy_prefix_to_buf( ulint* buf_size) /*!< in/out: buffer size */ { const byte* nulls; - const byte* lens; + const byte* UNINIT_VAR(lens); ulint i; ulint prefix_len; ulint null_mask; @@ -2129,7 +2129,7 @@ rec_print_comp( ulint i; for (i = 0; i < rec_offs_n_fields(offsets); i++) { - const byte* data; + const byte* UNINIT_VAR(data); ulint len; if (rec_offs_nth_default(offsets, i)) { diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 55be50ba35b..2c111766445 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4177,7 +4177,7 @@ row_search_mvcc( trx_t* trx = prebuilt->trx; dict_index_t* clust_index; que_thr_t* thr; - const rec_t* rec; + const rec_t* UNINIT_VAR(rec); const dtuple_t* vrow = NULL; const rec_t* result_rec = NULL; const rec_t* clust_rec; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index f3376ebc584..aa567e90e5b 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -3091,7 +3091,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg, HA_CREATE_INFO *ha_create_info) { int error; - uint create_flags= 0, record_count, i; + uint create_flags= 0, record_count= 0, i; char buff[FN_REFLEN]; MARIA_KEYDEF *keydef; MARIA_COLUMNDEF *recinfo; diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 0a56eafeb6e..53c83026f50 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -2811,7 +2811,7 @@ int spider_internal_xa_commit_by_xid( SPIDER_TRX *trx, XID* xid ) { - TABLE *table_xa, *table_xa_member; + TABLE *table_xa, *table_xa_member= 0; int error_num; char xa_key[MAX_KEY_LENGTH]; char xa_member_key[MAX_KEY_LENGTH]; @@ -3046,7 +3046,7 @@ int spider_internal_xa_rollback_by_xid( SPIDER_TRX *trx, XID* xid ) { - TABLE *table_xa, *table_xa_member; + TABLE *table_xa, *table_xa_member= 0; int error_num; char xa_key[MAX_KEY_LENGTH]; char xa_member_key[MAX_KEY_LENGTH]; |