mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix GCC 10.2.0 -Og -Wmaybe-uninitialized
For some reason, GCC emits more -Wmaybe-uninitialized warnings when using the flag -Og than when using -O2. Many of the warnings look genuine.
This commit is contained in:
@ -1786,7 +1786,7 @@ apply_log_finish()
|
||||
bool
|
||||
copy_back()
|
||||
{
|
||||
bool ret;
|
||||
bool ret = false;
|
||||
datadir_iter_t *it = NULL;
|
||||
datadir_node_t node;
|
||||
char *dst_dir;
|
||||
|
@ -1428,7 +1428,6 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
||||
const char *res_start= result;
|
||||
const char *res_end= result + result_len - 2;
|
||||
size_t d_len;
|
||||
char b_char;
|
||||
|
||||
while (len)
|
||||
{
|
||||
@ -1466,12 +1465,9 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
||||
|
||||
if (*next_s)
|
||||
{
|
||||
memmove(result + d_len, "*****", 5);
|
||||
const char b_char= *next_s++;
|
||||
memset(result + d_len, '*', 5);
|
||||
result+= d_len + 5;
|
||||
b_char= *(next_s++);
|
||||
}
|
||||
else
|
||||
result+= d_len;
|
||||
|
||||
while (*next_s)
|
||||
{
|
||||
@ -1487,6 +1483,10 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
||||
}
|
||||
next_s++;
|
||||
}
|
||||
}
|
||||
else
|
||||
result+= d_len;
|
||||
|
||||
len-= (uint)(next_s - str);
|
||||
str= next_s;
|
||||
continue;
|
||||
@ -1494,7 +1494,10 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
||||
no_password:
|
||||
if (result >= res_end)
|
||||
break;
|
||||
if ((b_char= escaped_char(*str)))
|
||||
else
|
||||
{
|
||||
const char b_char= escaped_char(*str);
|
||||
if (b_char)
|
||||
{
|
||||
if (result+1 >= res_end)
|
||||
break;
|
||||
@ -1508,6 +1511,7 @@ no_password:
|
||||
str++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
*result= 0;
|
||||
return result - res_start;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation
|
||||
Copyright (c) 2010, 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
|
||||
@ -7212,7 +7212,6 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
|
||||
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
|
||||
(item->type() == Item::REF_ITEM &&
|
||||
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
|
||||
Item *producing_item;
|
||||
Item_field *field_item= NULL;
|
||||
Item_equal *item_equal= item->get_item_equal();
|
||||
table_map tab_map= sel->master_unit()->derived->table->map;
|
||||
@ -7234,6 +7233,7 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
|
||||
List_iterator_fast<Item> li(sel->item_list);
|
||||
if (field_item)
|
||||
{
|
||||
Item *producing_item= NULL;
|
||||
uint field_no= field_item->field->field_index;
|
||||
for (uint i= 0; i <= field_no; i++)
|
||||
producing_item= li++;
|
||||
|
@ -2389,12 +2389,15 @@ double Item_func_distance::val_real()
|
||||
MBR mbr1, mbr2;
|
||||
const char *c_end;
|
||||
|
||||
|
||||
if ((null_value= (args[0]->null_value || args[1]->null_value ||
|
||||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
|
||||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
|
||||
g1->get_mbr(&mbr1, &c_end) ||
|
||||
g2->get_mbr(&mbr2, &c_end))))
|
||||
if (args[0]->null_value || args[1]->null_value)
|
||||
goto mem_error;
|
||||
g1= Geometry::construct(&buffer1, res1->ptr(), res1->length());
|
||||
if (!g1)
|
||||
goto mem_error;
|
||||
g2= Geometry::construct(&buffer2, res2->ptr(), res2->length());
|
||||
if (!g2)
|
||||
goto mem_error;
|
||||
if (g1->get_mbr(&mbr1, &c_end) || g2->get_mbr(&mbr2, &c_end))
|
||||
goto mem_error;
|
||||
|
||||
mbr1.add_mbr(&mbr2);
|
||||
@ -2543,7 +2546,7 @@ String *Item_func_pointonsurface::val_str(String *str)
|
||||
Geometry *g;
|
||||
MBR mbr;
|
||||
const char *c_end;
|
||||
double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
|
||||
double UNINIT_VAR(px), UNINIT_VAR(py), x0, UNINIT_VAR(y0);
|
||||
String *result= 0;
|
||||
const Gcalc_scan_iterator::point *pprev= NULL;
|
||||
uint32 srid;
|
||||
|
@ -6620,13 +6620,11 @@ void handle_connections_sockets()
|
||||
MYSQL_SOCKET sock= mysql_socket_invalid();
|
||||
MYSQL_SOCKET new_sock= mysql_socket_invalid();
|
||||
uint error_count=0;
|
||||
CONNECT *connect;
|
||||
struct sockaddr_storage cAddr;
|
||||
int ip_flags __attribute__((unused))=0;
|
||||
int socket_flags __attribute__((unused))= 0;
|
||||
int extra_ip_flags __attribute__((unused))=0;
|
||||
int flags=0,retval;
|
||||
bool is_unix_sock;
|
||||
#ifdef HAVE_POLL
|
||||
int socket_count= 0;
|
||||
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
|
||||
@ -6826,32 +6824,17 @@ void handle_connections_sockets()
|
||||
|
||||
DBUG_PRINT("info", ("Creating CONNECT for new connection"));
|
||||
|
||||
if ((connect= new CONNECT()))
|
||||
if (CONNECT *connect= new CONNECT())
|
||||
{
|
||||
is_unix_sock= (mysql_socket_getfd(sock) ==
|
||||
const bool is_unix_sock= (mysql_socket_getfd(sock) ==
|
||||
mysql_socket_getfd(unix_sock));
|
||||
|
||||
if (!(connect->vio=
|
||||
if ((connect->vio=
|
||||
mysql_socket_vio_new(new_sock,
|
||||
is_unix_sock ? VIO_TYPE_SOCKET :
|
||||
VIO_TYPE_TCPIP,
|
||||
is_unix_sock ? VIO_LOCALHOST: 0)))
|
||||
{
|
||||
delete connect;
|
||||
connect= 0; // Error handling below
|
||||
}
|
||||
}
|
||||
|
||||
if (!connect)
|
||||
{
|
||||
/* Connect failure */
|
||||
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||
(void) mysql_socket_close(new_sock);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_unix_sock)
|
||||
connect->host= my_localhost;
|
||||
|
||||
@ -6861,6 +6844,17 @@ void handle_connections_sockets()
|
||||
connect->scheduler= extra_thread_scheduler;
|
||||
}
|
||||
create_new_thread(connect);
|
||||
continue;
|
||||
}
|
||||
|
||||
delete connect;
|
||||
}
|
||||
|
||||
/* Connect failure */
|
||||
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||
(void) mysql_socket_close(new_sock);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
}
|
||||
sd_notify(0, "STOPPING=1\n"
|
||||
"STATUS=Shutdown in progress\n");
|
||||
|
@ -358,7 +358,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
|
||||
int was_cut;
|
||||
longlong res;
|
||||
enum_field_types f_type;
|
||||
bool have_warnings;
|
||||
bool have_warnings= false;
|
||||
|
||||
if (fuzzydate & TIME_TIME_ONLY)
|
||||
{
|
||||
|
@ -2742,7 +2742,7 @@ fts_query_phrase_search(
|
||||
|
||||
/* Ignore empty strings. */
|
||||
if (num_token > 0) {
|
||||
fts_string_t* token;
|
||||
fts_string_t* token = NULL;
|
||||
fts_fetch_t fetch;
|
||||
trx_t* trx = query->trx;
|
||||
fts_ast_oper_t oper = query->oper;
|
||||
|
@ -75,7 +75,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
|
||||
uint max_field_lengths, extra_header_size, column_nr;
|
||||
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
||||
ulong reclength, real_reclength,min_pack_length;
|
||||
char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr;
|
||||
char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr= NullS;
|
||||
char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
|
||||
ulong pack_reclength;
|
||||
ulonglong tot_length,max_rows, tmp;
|
||||
@ -889,7 +889,6 @@ int maria_create(const char *name, enum data_file_type datafile_type,
|
||||
fn_format(kfilename, name, "", MARIA_NAME_IEXT,
|
||||
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
||||
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
||||
klinkname_ptr= NullS;
|
||||
/*
|
||||
Replace the current file.
|
||||
Don't sync dir now if the data file has the same path.
|
||||
|
@ -3614,7 +3614,8 @@ my_bool translog_init_with_table(const char *directory,
|
||||
int old_log_was_recovered= 0, logs_found= 0;
|
||||
uint old_flags= flags;
|
||||
uint32 start_file_num= 1;
|
||||
TRANSLOG_ADDRESS sure_page, last_page, last_valid_page, checkpoint_lsn;
|
||||
TRANSLOG_ADDRESS UNINIT_VAR(sure_page), last_page, last_valid_page,
|
||||
checkpoint_lsn;
|
||||
my_bool version_changed= 0;
|
||||
DBUG_ENTER("translog_init_with_table");
|
||||
|
||||
|
@ -46,7 +46,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
uint aligned_key_start, block_length, res;
|
||||
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
||||
ulong reclength, real_reclength,min_pack_length;
|
||||
char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr;
|
||||
char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr= 0;
|
||||
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
|
||||
ulong pack_reclength;
|
||||
ulonglong tot_length,max_rows, tmp;
|
||||
@ -622,7 +622,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
fn_format(kfilename, name, "", MI_NAME_IEXT,
|
||||
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
||||
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
||||
klinkname_ptr= 0;
|
||||
/* Replace the current file */
|
||||
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ my_strtoll10_mb2(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *nptr, char **endptr, int *error)
|
||||
{
|
||||
const uchar *s, *end, *start, *n_end, *true_end;
|
||||
uchar c;
|
||||
uchar UNINIT_VAR(c);
|
||||
unsigned long i, j, k;
|
||||
ulonglong li;
|
||||
int negative;
|
||||
|
Reference in New Issue
Block a user