mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +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
|
bool
|
||||||
copy_back()
|
copy_back()
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret = false;
|
||||||
datadir_iter_t *it = NULL;
|
datadir_iter_t *it = NULL;
|
||||||
datadir_node_t node;
|
datadir_node_t node;
|
||||||
char *dst_dir;
|
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_start= result;
|
||||||
const char *res_end= result + result_len - 2;
|
const char *res_end= result + result_len - 2;
|
||||||
size_t d_len;
|
size_t d_len;
|
||||||
char b_char;
|
|
||||||
|
|
||||||
while (len)
|
while (len)
|
||||||
{
|
{
|
||||||
@@ -1466,27 +1465,28 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
|||||||
|
|
||||||
if (*next_s)
|
if (*next_s)
|
||||||
{
|
{
|
||||||
memmove(result + d_len, "*****", 5);
|
const char b_char= *next_s++;
|
||||||
|
memset(result + d_len, '*', 5);
|
||||||
result+= d_len + 5;
|
result+= d_len + 5;
|
||||||
b_char= *(next_s++);
|
|
||||||
|
while (*next_s)
|
||||||
|
{
|
||||||
|
if (*next_s == b_char)
|
||||||
|
{
|
||||||
|
++next_s;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*next_s == '\\')
|
||||||
|
{
|
||||||
|
if (next_s[1])
|
||||||
|
next_s++;
|
||||||
|
}
|
||||||
|
next_s++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result+= d_len;
|
result+= d_len;
|
||||||
|
|
||||||
while (*next_s)
|
|
||||||
{
|
|
||||||
if (*next_s == b_char)
|
|
||||||
{
|
|
||||||
++next_s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*next_s == '\\')
|
|
||||||
{
|
|
||||||
if (next_s[1])
|
|
||||||
next_s++;
|
|
||||||
}
|
|
||||||
next_s++;
|
|
||||||
}
|
|
||||||
len-= (uint)(next_s - str);
|
len-= (uint)(next_s - str);
|
||||||
str= next_s;
|
str= next_s;
|
||||||
continue;
|
continue;
|
||||||
@@ -1494,19 +1494,23 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
|
|||||||
no_password:
|
no_password:
|
||||||
if (result >= res_end)
|
if (result >= res_end)
|
||||||
break;
|
break;
|
||||||
if ((b_char= escaped_char(*str)))
|
|
||||||
{
|
|
||||||
if (result+1 >= res_end)
|
|
||||||
break;
|
|
||||||
*(result++)= '\\';
|
|
||||||
*(result++)= b_char;
|
|
||||||
}
|
|
||||||
else if (is_space(*str))
|
|
||||||
*(result++)= ' ';
|
|
||||||
else
|
else
|
||||||
*(result++)= *str;
|
{
|
||||||
str++;
|
const char b_char= escaped_char(*str);
|
||||||
len--;
|
if (b_char)
|
||||||
|
{
|
||||||
|
if (result+1 >= res_end)
|
||||||
|
break;
|
||||||
|
*(result++)= '\\';
|
||||||
|
*(result++)= b_char;
|
||||||
|
}
|
||||||
|
else if (is_space(*str))
|
||||||
|
*(result++)= ' ';
|
||||||
|
else
|
||||||
|
*(result++)= *str;
|
||||||
|
str++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*result= 0;
|
*result= 0;
|
||||||
return result - res_start;
|
return result - res_start;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
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
|
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
|
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 ||
|
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
|
||||||
(item->type() == Item::REF_ITEM &&
|
(item->type() == Item::REF_ITEM &&
|
||||||
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
|
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
|
||||||
Item *producing_item;
|
|
||||||
Item_field *field_item= NULL;
|
Item_field *field_item= NULL;
|
||||||
Item_equal *item_equal= item->get_item_equal();
|
Item_equal *item_equal= item->get_item_equal();
|
||||||
table_map tab_map= sel->master_unit()->derived->table->map;
|
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);
|
List_iterator_fast<Item> li(sel->item_list);
|
||||||
if (field_item)
|
if (field_item)
|
||||||
{
|
{
|
||||||
|
Item *producing_item= NULL;
|
||||||
uint field_no= field_item->field->field_index;
|
uint field_no= field_item->field->field_index;
|
||||||
for (uint i= 0; i <= field_no; i++)
|
for (uint i= 0; i <= field_no; i++)
|
||||||
producing_item= li++;
|
producing_item= li++;
|
||||||
|
@@ -2389,12 +2389,15 @@ double Item_func_distance::val_real()
|
|||||||
MBR mbr1, mbr2;
|
MBR mbr1, mbr2;
|
||||||
const char *c_end;
|
const char *c_end;
|
||||||
|
|
||||||
|
if (args[0]->null_value || args[1]->null_value)
|
||||||
if ((null_value= (args[0]->null_value || args[1]->null_value ||
|
goto mem_error;
|
||||||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
|
g1= Geometry::construct(&buffer1, res1->ptr(), res1->length());
|
||||||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
|
if (!g1)
|
||||||
g1->get_mbr(&mbr1, &c_end) ||
|
goto mem_error;
|
||||||
g2->get_mbr(&mbr2, &c_end))))
|
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;
|
goto mem_error;
|
||||||
|
|
||||||
mbr1.add_mbr(&mbr2);
|
mbr1.add_mbr(&mbr2);
|
||||||
@@ -2543,7 +2546,7 @@ String *Item_func_pointonsurface::val_str(String *str)
|
|||||||
Geometry *g;
|
Geometry *g;
|
||||||
MBR mbr;
|
MBR mbr;
|
||||||
const char *c_end;
|
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;
|
String *result= 0;
|
||||||
const Gcalc_scan_iterator::point *pprev= NULL;
|
const Gcalc_scan_iterator::point *pprev= NULL;
|
||||||
uint32 srid;
|
uint32 srid;
|
||||||
|
@@ -6620,13 +6620,11 @@ void handle_connections_sockets()
|
|||||||
MYSQL_SOCKET sock= mysql_socket_invalid();
|
MYSQL_SOCKET sock= mysql_socket_invalid();
|
||||||
MYSQL_SOCKET new_sock= mysql_socket_invalid();
|
MYSQL_SOCKET new_sock= mysql_socket_invalid();
|
||||||
uint error_count=0;
|
uint error_count=0;
|
||||||
CONNECT *connect;
|
|
||||||
struct sockaddr_storage cAddr;
|
struct sockaddr_storage cAddr;
|
||||||
int ip_flags __attribute__((unused))=0;
|
int ip_flags __attribute__((unused))=0;
|
||||||
int socket_flags __attribute__((unused))= 0;
|
int socket_flags __attribute__((unused))= 0;
|
||||||
int extra_ip_flags __attribute__((unused))=0;
|
int extra_ip_flags __attribute__((unused))=0;
|
||||||
int flags=0,retval;
|
int flags=0,retval;
|
||||||
bool is_unix_sock;
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
int socket_count= 0;
|
int socket_count= 0;
|
||||||
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
|
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
|
||||||
@@ -6826,41 +6824,37 @@ void handle_connections_sockets()
|
|||||||
|
|
||||||
DBUG_PRINT("info", ("Creating CONNECT for new connection"));
|
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));
|
mysql_socket_getfd(unix_sock));
|
||||||
|
|
||||||
if (!(connect->vio=
|
if ((connect->vio=
|
||||||
mysql_socket_vio_new(new_sock,
|
mysql_socket_vio_new(new_sock,
|
||||||
is_unix_sock ? VIO_TYPE_SOCKET :
|
is_unix_sock ? VIO_TYPE_SOCKET :
|
||||||
VIO_TYPE_TCPIP,
|
VIO_TYPE_TCPIP,
|
||||||
is_unix_sock ? VIO_LOCALHOST: 0)))
|
is_unix_sock ? VIO_LOCALHOST: 0)))
|
||||||
{
|
{
|
||||||
delete connect;
|
if (is_unix_sock)
|
||||||
connect= 0; // Error handling below
|
connect->host= my_localhost;
|
||||||
|
|
||||||
|
if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
|
||||||
|
{
|
||||||
|
connect->extra_port= 1;
|
||||||
|
connect->scheduler= extra_thread_scheduler;
|
||||||
|
}
|
||||||
|
create_new_thread(connect);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connect)
|
/* Connect failure */
|
||||||
{
|
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||||
/* Connect failure */
|
(void) mysql_socket_close(new_sock);
|
||||||
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
statistic_increment(aborted_connects,&LOCK_status);
|
||||||
(void) mysql_socket_close(new_sock);
|
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||||
statistic_increment(aborted_connects,&LOCK_status);
|
|
||||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_unix_sock)
|
|
||||||
connect->host= my_localhost;
|
|
||||||
|
|
||||||
if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
|
|
||||||
{
|
|
||||||
connect->extra_port= 1;
|
|
||||||
connect->scheduler= extra_thread_scheduler;
|
|
||||||
}
|
|
||||||
create_new_thread(connect);
|
|
||||||
}
|
}
|
||||||
sd_notify(0, "STOPPING=1\n"
|
sd_notify(0, "STOPPING=1\n"
|
||||||
"STATUS=Shutdown in progress\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;
|
int was_cut;
|
||||||
longlong res;
|
longlong res;
|
||||||
enum_field_types f_type;
|
enum_field_types f_type;
|
||||||
bool have_warnings;
|
bool have_warnings= false;
|
||||||
|
|
||||||
if (fuzzydate & TIME_TIME_ONLY)
|
if (fuzzydate & TIME_TIME_ONLY)
|
||||||
{
|
{
|
||||||
|
@@ -2742,7 +2742,7 @@ fts_query_phrase_search(
|
|||||||
|
|
||||||
/* Ignore empty strings. */
|
/* Ignore empty strings. */
|
||||||
if (num_token > 0) {
|
if (num_token > 0) {
|
||||||
fts_string_t* token;
|
fts_string_t* token = NULL;
|
||||||
fts_fetch_t fetch;
|
fts_fetch_t fetch;
|
||||||
trx_t* trx = query->trx;
|
trx_t* trx = query->trx;
|
||||||
fts_ast_oper_t oper = query->oper;
|
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 max_field_lengths, extra_header_size, column_nr;
|
||||||
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
||||||
ulong reclength, real_reclength,min_pack_length;
|
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;
|
char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
|
||||||
ulong pack_reclength;
|
ulong pack_reclength;
|
||||||
ulonglong tot_length,max_rows, tmp;
|
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,
|
fn_format(kfilename, name, "", MARIA_NAME_IEXT,
|
||||||
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
||||||
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
||||||
klinkname_ptr= NullS;
|
|
||||||
/*
|
/*
|
||||||
Replace the current file.
|
Replace the current file.
|
||||||
Don't sync dir now if the data file has the same path.
|
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;
|
int old_log_was_recovered= 0, logs_found= 0;
|
||||||
uint old_flags= flags;
|
uint old_flags= flags;
|
||||||
uint32 start_file_num= 1;
|
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;
|
my_bool version_changed= 0;
|
||||||
DBUG_ENTER("translog_init_with_table");
|
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 aligned_key_start, block_length, res;
|
||||||
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
|
||||||
ulong reclength, real_reclength,min_pack_length;
|
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;
|
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
|
||||||
ulong pack_reclength;
|
ulong pack_reclength;
|
||||||
ulonglong tot_length,max_rows, tmp;
|
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,
|
fn_format(kfilename, name, "", MI_NAME_IEXT,
|
||||||
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
|
||||||
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
|
||||||
klinkname_ptr= 0;
|
|
||||||
/* Replace the current file */
|
/* Replace the current file */
|
||||||
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
|
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 char *nptr, char **endptr, int *error)
|
||||||
{
|
{
|
||||||
const uchar *s, *end, *start, *n_end, *true_end;
|
const uchar *s, *end, *start, *n_end, *true_end;
|
||||||
uchar c;
|
uchar UNINIT_VAR(c);
|
||||||
unsigned long i, j, k;
|
unsigned long i, j, k;
|
||||||
ulonglong li;
|
ulonglong li;
|
||||||
int negative;
|
int negative;
|
||||||
|
Reference in New Issue
Block a user