diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-13 18:21:30 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-13 18:21:30 +0300 |
commit | b811c6ecc74cc1421eedc92573447768d1eb7980 (patch) | |
tree | cbc5d2a9b6e5e86d7fea274c66bf1c62a38d8ebe | |
parent | 4bd56a697ff2d2edc230a82dbfcf4412ef0996df (diff) | |
download | mariadb-git-b811c6ecc74cc1421eedc92573447768d1eb7980.tar.gz |
Fix GCC 10.2.0 -Og -Wmaybe-uninitialized
Fix some more cases after merging
commit 31aef3ae99dff6b7154cf288b3dc508d367f19f8.
Some warnings look possibly genuine, others are clearly bogus.
-rw-r--r-- | sql/ha_partition.cc | 12 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 6 | ||||
-rw-r--r-- | sql/sql_repl.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 12 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 14 |
5 files changed, 30 insertions, 20 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index d694fedb831..d4cab001a9a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -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 @@ -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; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0d519edc5b3..5bdd3e10069 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -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 @@ -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) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index cd8a2129410..4b23348b306 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -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; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 04a19d6922e..b3d89eab472 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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 */ diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index a1eb74771ef..a4ee6d725e3 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -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 */ |