Skip to content

Commit

Permalink
Fix GCC 10.2.0 -Og -Wmaybe-uninitialized
Browse files Browse the repository at this point in the history
Fix some more cases after merging
commit 31aef3a.
Some warnings look possibly genuine, others are clearly bogus.
  • Loading branch information
dr-m committed Aug 13, 2020
1 parent 4bd56a6 commit b811c6e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
12 changes: 6 additions & 6 deletions sql/ha_partition.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
Copyright (c) 2009, 2020, MariaDB
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
Expand Down Expand Up @@ -6380,7 +6380,7 @@ ha_rows ha_partition::multi_range_read_info(uint keyno, uint n_ranges,
{
uint i;
handler **file;
ha_rows rows;
ha_rows rows= 0;
DBUG_ENTER("ha_partition::multi_range_read_info");
DBUG_PRINT("enter", ("partition this: %p", this));

Expand Down Expand Up @@ -9516,7 +9516,6 @@ double ha_partition::read_time(uint index, uint ranges, ha_rows rows)

ha_rows ha_partition::records()
{
int error;
ha_rows tot_rows= 0;
uint i;
DBUG_ENTER("ha_partition::records");
Expand All @@ -9525,9 +9524,10 @@ ha_rows ha_partition::records()
i < m_tot_parts;
i= bitmap_get_next_set(&m_part_info->read_partitions, i))
{
ha_rows rows;
if (unlikely((error= m_file[i]->pre_records()) ||
(rows= m_file[i]->records()) == HA_POS_ERROR))
if (unlikely(m_file[i]->pre_records()))
DBUG_RETURN(HA_POS_ERROR);
const ha_rows rows= m_file[i]->records();
if (unlikely(rows == HA_POS_ERROR))
DBUG_RETURN(HA_POS_ERROR);
tot_rows+= rows;
}
Expand Down
6 changes: 3 additions & 3 deletions sql/item_strfunc.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Corporation
Copyright (c) 2009, 2020, 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
Expand Down Expand Up @@ -646,7 +646,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
THD *thd= current_thd;
String *res;
String *res= NULL;
uint i;

null_value=0;
Expand All @@ -656,7 +656,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
if ((res= args[i]->val_str(str)))
break;
}
if (i == arg_count)
if (!res)
goto null;

if (res != str)
Expand Down
6 changes: 5 additions & 1 deletion sql/sql_repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,15 @@ static int send_file(THD *thd)
We need net_flush here because the client will not know it needs to send
us the file name until it has processed the load event entry
*/
if (unlikely(net_flush(net) || (packet_len = my_net_read(net)) == packet_error))
if (unlikely(net_flush(net)))
{
read_error:
errmsg = "while reading file name";
goto err;
}
packet_len= my_net_read(net);
if (unlikely(packet_len == packet_error))
goto read_error;

// terminate with \0 for fn_format
*((char*)net->read_pos + packet_len) = 0;
Expand Down
12 changes: 8 additions & 4 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -4451,9 +4451,11 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$1, false)
: NULL;

if (unlikely(!spc || !(spv = spc->find_variable(&$1, false))))
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));

/* An SP local variable */
Expand All @@ -4465,9 +4467,11 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$3, false)
: NULL;

if (unlikely(!spc || !(spv = spc->find_variable(&$3, false))))
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));

/* An SP local variable */
Expand Down
14 changes: 8 additions & 6 deletions sql/sql_yacc_ora.yy
Original file line number Diff line number Diff line change
Expand Up @@ -4205,9 +4205,10 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;

if (unlikely(!spc || !(spv = spc->find_variable(&$1, false))))
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$1, false)
: NULL;
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));

/* An SP local variable */
Expand All @@ -4219,9 +4220,10 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;

if (unlikely(!spc || !(spv = spc->find_variable(&$3, false))))
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$3, false)
: NULL;
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));

/* An SP local variable */
Expand Down

0 comments on commit b811c6e

Please sign in to comment.