summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-16 14:52:42 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-17 07:37:39 +0200
commitd76f5774fe70c51577cfbfdddcbfb3309d51f06e (patch)
tree579994269a0b9d569e0ac2b4ca024e8027dc4551 /sql
parent3b7aa3017b65dcf11d33617e954e1cb471703582 (diff)
downloadmariadb-git-d76f5774fe70c51577cfbfdddcbfb3309d51f06e.tar.gz
MDEV-13459 Warnings, when compiling with gcc-7.x
mostly caused by -Wimplicit-fallthrough
Diffstat (limited to 'sql')
-rw-r--r--sql/events.cc8
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_partition.cc1
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_strfunc.cc4
-rw-r--r--sql/log.cc5
-rw-r--r--sql/log_event.cc15
-rw-r--r--sql/opt_sum.cc1
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/sql_admin.cc1
-rw-r--r--sql/sql_lex.cc4
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_plugin.cc74
-rw-r--r--sql/sql_prepare.cc1
-rw-r--r--sql/sql_repl.cc1
-rw-r--r--sql/sql_show.cc1
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_yacc.yy10
21 files changed, 71 insertions, 75 deletions
diff --git a/sql/events.cc b/sql/events.cc
index 763c75e77b0..008b6223702 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -185,8 +185,8 @@ common_1_lev_code:
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_HOUR_SECOND:
{
ulonglong tmp_expr= expr;
@@ -202,8 +202,8 @@ common_1_lev_code:
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_DAY_SECOND:
{
ulonglong tmp_expr= expr;
@@ -225,8 +225,8 @@ common_1_lev_code:
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
- }
break;
+ }
case INTERVAL_DAY_MICROSECOND:
case INTERVAL_HOUR_MICROSECOND:
case INTERVAL_MINUTE_MICROSECOND:
@@ -240,6 +240,8 @@ common_1_lev_code:
break;
case INTERVAL_WEEK:
expr/= 7;
+ close_quote= FALSE;
+ break;
default:
close_quote= FALSE;
break;
diff --git a/sql/field.cc b/sql/field.cc
index 716d522a196..a2e0caaa50d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -9218,7 +9218,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
case MYSQL_TYPE_DATE:
/* We don't support creation of MYSQL_TYPE_DATE anymore */
sql_type= MYSQL_TYPE_NEWDATE;
- /* fall trough */
+ /* fall through */
case MYSQL_TYPE_NEWDATE:
length= MAX_DATE_WIDTH;
break;
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index e048dbad5e6..b2c2140d4dc 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -7331,6 +7331,7 @@ void ha_partition::print_error(int error, myf errflag)
m_err_rec= NULL;
DBUG_VOID_RETURN;
}
+ /* fall through */
default:
{
if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION))
diff --git a/sql/item.cc b/sql/item.cc
index a8913e97fe9..3c633ddc9ca 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6004,7 +6004,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
collation.collation);
break;
}
- /* Fall through to make_string_field() */
+ /* fall through */
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING:
diff --git a/sql/item_func.cc b/sql/item_func.cc
index cfccd66ea8a..00006a25a8d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -863,6 +863,7 @@ void Item_func_num1::fix_length_and_dec()
break;
case TIME_RESULT:
cached_result_type= DECIMAL_RESULT;
+ /* fall through */
case DECIMAL_RESULT:
decimals= args[0]->decimal_scale(); // Do not preserve NOT_FIXED_DEC
max_length= args[0]->max_length;
@@ -2038,6 +2039,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value)
return decimal_value;
case E_DEC_DIV_ZERO:
signal_divide_by_null();
+ /* fall through */
default:
null_value= 1;
return 0;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 756ab5152ca..939e518e386 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4430,7 +4430,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
goto null;
case DYN_COL_INT:
signed_value= 1; // For error message
- /* fall_trough */
+ /* fall through */
case DYN_COL_UINT:
if (signed_value || val.x.ulong_value <= LONGLONG_MAX)
{
@@ -4443,7 +4443,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
}
/* let double_to_datetime_with_warn() issue the warning message */
val.x.double_value= static_cast<double>(ULONGLONG_MAX);
- /* fall_trough */
+ /* fall through */
case DYN_COL_DOUBLE:
if (double_to_datetime_with_warn(val.x.double_value, ltime, fuzzy_date,
0 /* TODO */))
diff --git a/sql/log.cc b/sql/log.cc
index f8c256e645f..5b4ba87ef52 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -7261,8 +7261,10 @@ void TC_LOG_MMAP::close()
mysql_cond_destroy(&COND_pool);
mysql_cond_destroy(&COND_active);
mysql_cond_destroy(&COND_queue_busy);
+ /* fall through */
case 5:
data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails
+ /* fall through */
case 4:
for (i=0; i < npages; i++)
{
@@ -7271,10 +7273,13 @@ void TC_LOG_MMAP::close()
mysql_mutex_destroy(&pages[i].lock);
mysql_cond_destroy(&pages[i].cond);
}
+ /* fall through */
case 3:
my_free(pages);
+ /* fall through */
case 2:
my_munmap((char*)data, (size_t)file_length);
+ /* fall through */
case 1:
mysql_file_close(fd, MYF(0));
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d5b5b5a4870..18e4cfbf187 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6437,21 +6437,6 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
uint bytes_read= ((val + val_len) - start);
-#ifndef DBUG_OFF
- bool old_pre_checksum_fd= description_event->is_version_before_checksum(
- &description_event->server_version_split);
-#endif
- DBUG_ASSERT((bytes_read == data_written -
- (old_pre_checksum_fd ||
- (description_event->checksum_alg ==
- BINLOG_CHECKSUM_ALG_OFF)) ?
- 0 : BINLOG_CHECKSUM_LEN)
- ||
- (bytes_read == data_written -1 -
- (old_pre_checksum_fd ||
- (description_event->checksum_alg ==
- BINLOG_CHECKSUM_ALG_OFF)) ?
- 0 : BINLOG_CHECKSUM_LEN));
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 1a8c6be5f41..f717be5ba3f 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -1047,6 +1047,7 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond)
case Item_func::LT_FUNC:
case Item_func::LE_FUNC:
less_fl= 1;
+ /* fall through */
case Item_func::GT_FUNC:
case Item_func::GE_FUNC:
{
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index d8b901701cb..512bf296135 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -34,8 +34,6 @@
partition_info *partition_info::get_clone()
{
- if (!this)
- return 0;
List_iterator<partition_element> part_it(partitions);
partition_element *part;
partition_info *clone= new partition_info();
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 69364eaa43f..14a57914560 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -139,7 +139,7 @@ sp_get_item_value(THD *thd, Item *item, String *str)
case DECIMAL_RESULT:
if (item->field_type() != MYSQL_TYPE_BIT)
return item->val_str(str);
- else {/* Bit type is handled as binary string */}
+ /* fall through */
case STRING_RESULT:
{
String *result= item->val_str(str);
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 55effcd7002..7cddf50a896 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -54,7 +54,6 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list)
if (thd->stmt_da->is_ok())
thd->stmt_da->reset_diagnostics_area();
table_list->table= NULL;
- result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
DBUG_RETURN(result_code);
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 6611fd43876..6f94f1fbe63 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1147,12 +1147,14 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
state= MY_LEX_HEX_NUMBER;
break;
}
+ /* fall through */
case MY_LEX_IDENT_OR_BIN:
if (lip->yyPeek() == '\'')
{ // Found b'bin-number'
state= MY_LEX_BIN_NUMBER;
break;
}
+ /* fall through */
case MY_LEX_IDENT:
const char *start;
#if defined(USE_MB) && defined(USE_MB_IDENT)
@@ -1499,7 +1501,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
state= MY_LEX_USER_VARIABLE_DELIMITER;
break;
}
- /* " used for strings */
+ /* fall through */ /* " used for strings */
case MY_LEX_STRING: // Incomplete text string
if (!(yylval->lex_str.str = get_text(lip, 1, 1)))
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ba0520de4bb..d003a13ae09 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2481,7 +2481,7 @@ case SQLCOM_PREPARE:
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
partition_info *part_info= thd->lex->part_info;
- if (part_info && !(part_info= thd->lex->part_info->get_clone()))
+ if (part_info && !(part_info= part_info->get_clone()))
{
res= -1;
goto end_with_restore_list;
@@ -2850,8 +2850,8 @@ end_with_restore_list:
/* mysql_update return 2 if we need to switch to multi-update */
if (up_result != 2)
break;
- /* Fall through */
}
+ /* fall through */
case SQLCOM_UPDATE_MULTI:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -2961,6 +2961,7 @@ end_with_restore_list:
DBUG_PRINT("debug", ("Just after generate_incident()"));
}
#endif
+ /* fall through */
case SQLCOM_INSERT:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -3698,6 +3699,7 @@ end_with_restore_list:
initialize this variable because RESET shares the same code as FLUSH
*/
lex->no_write_to_binlog= 1;
+ /* fall through */
case SQLCOM_FLUSH:
{
int write_to_binlog;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 0d9f6e6a1f5..bf34d328dc5 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4640,7 +4640,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
thd->work_part_info= thd->lex->part_info;
if (thd->work_part_info &&
- !(thd->work_part_info= thd->lex->part_info->get_clone()))
+ !(thd->work_part_info= thd->work_part_info->get_clone()))
DBUG_RETURN(TRUE);
/* ALTER_ADMIN_PARTITION is handled in mysql_admin_table */
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 9eecd6a1345..d1e855e272e 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1078,42 +1078,42 @@ static bool plugin_add(MEM_ROOT *tmp_root,
if (!name->str && plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN))
continue; // already installed
- struct st_plugin_int *tmp_plugin_ptr;
- if (*(int*)plugin->info <
- min_plugin_info_interface_version[plugin->type] ||
- ((*(int*)plugin->info) >> 8) >
- (cur_plugin_info_interface_version[plugin->type] >> 8))
- {
- char buf[256];
- strxnmov(buf, sizeof(buf) - 1, "API version for ",
- plugin_type_names[plugin->type].str,
- " plugin ", tmp.name.str,
- " not supported by this version of the server", NullS);
- report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf);
- goto err;
- }
- if (plugin_maturity_map[plugin->maturity] < plugin_maturity)
- {
- char buf[256];
- strxnmov(buf, sizeof(buf) - 1, "Loading of ",
- plugin_maturity_names[plugin->maturity],
- " plugin ", tmp.name.str,
- " is prohibited by --plugin-maturity=",
- plugin_maturity_names[plugin_maturity],
- NullS);
- report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf);
- goto err;
- }
- tmp.plugin= plugin;
- tmp.ref_count= 0;
- tmp.state= PLUGIN_IS_UNINITIALIZED;
- tmp.load_option= PLUGIN_ON;
+ struct st_plugin_int *tmp_plugin_ptr;
+ if (*(int*)plugin->info <
+ min_plugin_info_interface_version[plugin->type] ||
+ ((*(int*)plugin->info) >> 8) >
+ (cur_plugin_info_interface_version[plugin->type] >> 8))
+ {
+ char buf[256];
+ strxnmov(buf, sizeof(buf) - 1, "API version for ",
+ plugin_type_names[plugin->type].str,
+ " plugin ", tmp.name.str,
+ " not supported by this version of the server", NullS);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf);
+ goto err;
+ }
+ if (plugin_maturity_map[plugin->maturity] < plugin_maturity)
+ {
+ char buf[256];
+ strxnmov(buf, sizeof(buf) - 1, "Loading of ",
+ plugin_maturity_names[plugin->maturity],
+ " plugin ", tmp.name.str,
+ " is prohibited by --plugin-maturity=",
+ plugin_maturity_names[plugin_maturity],
+ NullS);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf);
+ goto err;
+ }
+ tmp.plugin= plugin;
+ tmp.ref_count= 0;
+ tmp.state= PLUGIN_IS_UNINITIALIZED;
+ tmp.load_option= PLUGIN_ON;
- if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp)))
- goto err;
- if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr))
- tmp_plugin_ptr->state= PLUGIN_IS_FREED;
- init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096);
+ if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp)))
+ goto err;
+ if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr))
+ tmp_plugin_ptr->state= PLUGIN_IS_FREED;
+ init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096);
if (name->str)
DBUG_RETURN(FALSE); // all done
@@ -1822,10 +1822,10 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
case '\0':
list= NULL; /* terminate the loop */
/* fall through */
+ case ';':
#ifndef __WIN__
case ':': /* can't use this as delimiter as it may be drive letter */
#endif
- case ';':
str->str[str->length]= '\0';
if (str == &name) // load all plugins in named module
{
@@ -1863,6 +1863,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
str->str= p;
continue;
}
+ /* fall through */
default:
str->length++;
continue;
@@ -3947,4 +3948,3 @@ void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root)
insert_dynamic(options, (uchar*) opt);
}
}
-
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 851e4f7b8ab..faaeaf51573 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2075,6 +2075,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
if (res != 2)
break;
+ /* fall through */
case SQLCOM_UPDATE_MULTI:
res= mysql_test_multiupdate(stmt, tables, res == 2);
break;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 871cb27f0d0..ca6e8d15e7a 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1139,6 +1139,7 @@ impossible position";
loop_breaker = (flags & BINLOG_DUMP_NON_BLOCK);
break;
}
+ /* fall through */
default:
errmsg = "could not find next log";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 512548b1d51..8789f0c9f24 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -931,6 +931,7 @@ public:
is_handled= FALSE;
break;
}
+ /* fall through */
case ER_COLUMNACCESS_DENIED_ERROR:
case ER_VIEW_NO_EXPLAIN: /* Error was anonymized, ignore all the same. */
case ER_PROCACCESS_DENIED_ERROR:
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6ab39d7f8c6..e6490876352 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5504,7 +5504,7 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
case LEAVE_AS_IS:
if (!indexes_were_disabled)
break;
- /* fall-through: disabled indexes */
+ /* fall-through */
case DISABLE:
error= table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 35c7203ca0d..4805cd4c66a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4212,15 +4212,11 @@ size_number:
switch (end_ptr[0])
{
case 'g':
- case 'G':
- text_shift_number+=10;
+ case 'G': text_shift_number+=30; break;
case 'm':
- case 'M':
- text_shift_number+=10;
+ case 'M': text_shift_number+=20; break;
case 'k':
- case 'K':
- text_shift_number+=10;
- break;
+ case 'K': text_shift_number+=10; break;
default:
{
my_error(ER_WRONG_SIZE_NUMBER, MYF(0));