Commit b811c6ec authored by Marko Mäkelä's avatar Marko Mäkelä

Fix GCC 10.2.0 -Og -Wmaybe-uninitialized

Fix some more cases after merging
commit 31aef3ae.
Some warnings look possibly genuine, others are clearly bogus.
parent 4bd56a69
/*
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
......@@ -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));
......@@ -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");
......@@ -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;
}
......
/*
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
......@@ -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;
......@@ -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)
......
......@@ -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;
......
......@@ -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 */
......@@ -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 */
......
......@@ -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 */
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment