summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-08-03 14:37:55 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2018-08-03 14:37:55 +0200
commit701f0b8e366f957e8256e4741ca48424c84b7234 (patch)
tree0da96b6ad4ce9c98ad5d992d69b2e5112970b890
parent9d42eb5e28303adb4d9467ac3e9c3be35d46e643 (diff)
downloadmariadb-git-701f0b8e366f957e8256e4741ca48424c84b7234.tar.gz
Fix gcc 7.3 compiler warnings.
-rw-r--r--sql/opt_range.cc5
-rw-r--r--sql/opt_subselect.cc6
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_explain.cc2
-rw-r--r--sql/sql_partition.cc12
-rw-r--r--sql/table.cc2
7 files changed, 27 insertions, 8 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0315b91b8be..1e29efda0d1 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7307,7 +7307,8 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
param->current_table);
#ifdef HAVE_SPATIAL
Field::geometry_type sav_geom_type;
- if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ const bool geometry= field_item->field->type() == MYSQL_TYPE_GEOMETRY;
+ if (geometry)
{
sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
/* We have to be able to store all sorts of spatial features here */
@@ -7342,7 +7343,7 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
#ifdef HAVE_SPATIAL
- if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ if (geometry)
{
((Field_geom*) field_item->field)->geom_type= sav_geom_type;
}
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index ca5398197bd..85f5645949e 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -2776,8 +2776,8 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
LooseScan detector in best_access_path)
*/
remaining_tables &= ~new_join_tab->table->map;
- table_map dups_producing_tables, prev_dups_producing_tables,
- prev_sjm_lookup_tables;
+ table_map dups_producing_tables, prev_dups_producing_tables= 0,
+ prev_sjm_lookup_tables= 0;
if (idx == join->const_tables)
dups_producing_tables= 0;
@@ -2788,7 +2788,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
if ((emb_sj_nest= new_join_tab->emb_sj_nest))
dups_producing_tables |= emb_sj_nest->sj_inner_tables;
- Semi_join_strategy_picker **strategy, **prev_strategy;
+ Semi_join_strategy_picker **strategy, **prev_strategy= NULL;
if (idx == join->const_tables)
{
/* First table, initialize pickers */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b3269660a7c..3fab00a46df 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2891,7 +2891,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
ulong query_length= 0;
bool clear_role= FALSE;
char buff[512];
- enum_binlog_format save_binlog_format;
+ enum_binlog_format save_binlog_format=
+ thd->get_current_stmt_binlog_format();
const CSET_STRING query_save __attribute__((unused)) = thd->query_string;
DBUG_ENTER("acl_set_default_role");
@@ -2922,6 +2923,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0))
{
thd->set_query(buff, query_length, system_charset_info);
+ // Attention!!! here is implicit goto error;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index ab721fd0585..53e451511d5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3562,6 +3562,10 @@ public:
*format= (enum_binlog_format) variables.binlog_format;
*current_format= current_stmt_binlog_format;
}
+ inline enum_binlog_format get_current_stmt_binlog_format()
+ {
+ return current_stmt_binlog_format;
+ }
inline void set_binlog_format(enum_binlog_format format,
enum_binlog_format current_format)
{
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 82107f9b922..a1d6764d8e4 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -895,7 +895,7 @@ void Explain_select::print_explain_json(Explain_query *query,
{
Sort_and_group_tracker::Iterator iter(&ops_tracker);
enum_qep_action action;
- Filesort_tracker *fs_tracker;
+ Filesort_tracker *fs_tracker= NULL;
while ((action= iter.get_next(&fs_tracker)) != EXPL_ACTION_EOF)
{
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 65c76127de9..05ef69e5795 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -8313,6 +8313,12 @@ int create_partition_name(char *out, size_t outlen, const char *in1,
end= strxnmov(out, outlen-1, in1, "#P#", transl_part, "#TMP#", NullS);
else if (name_variant == RENAMED_PART_NAME)
end= strxnmov(out, outlen-1, in1, "#P#", transl_part, "#REN#", NullS);
+ else
+ {
+ DBUG_ASSERT(0);
+ out[0]= 0;
+ end= out + (outlen-1);
+ }
if (end - out == static_cast<ptrdiff_t>(outlen-1))
{
my_error(ER_PATH_LENGTH, MYF(0), longest_str(in1, transl_part));
@@ -8355,6 +8361,12 @@ int create_subpartition_name(char *out, size_t outlen,
else if (name_variant == RENAMED_PART_NAME)
end= strxnmov(out, outlen-1, in1, "#P#", transl_part_name,
"#SP#", transl_subpart_name, "#REN#", NullS);
+ else
+ {
+ DBUG_ASSERT(0);
+ out[0]= 0;
+ end= out + (outlen-1);
+ }
if (end - out == static_cast<ptrdiff_t>(outlen-1))
{
my_error(ER_PATH_LENGTH, MYF(0),
diff --git a/sql/table.cc b/sql/table.cc
index b267df96139..b3a1c2eaa3d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1723,7 +1723,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
keyinfo= share->key_info;
uint primary_key= my_strcasecmp(system_charset_info, share->keynames.type_names[0],
primary_key_name) ? MAX_KEY : 0;
- KEY* key_first_info;
+ KEY* key_first_info= NULL;
if (primary_key >= MAX_KEY && keyinfo->flags & HA_NOSAME)
{