mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Remove compiler warnings
- Remove unused variables - Mark variables unused - Fix wrong types - Add no-strict-aliasing to BUILD scripts
This commit is contained in:
parent
dbbe70e1cf
commit
ddc5764303
15 changed files with 25 additions and 24 deletions
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue