[MDEV-12824] GCC 7 warning: this statement may fall through [-Wimplicit-fallthrough=] Created: 2017-05-17  Updated: 2017-07-20  Resolved: 2017-07-20

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.0
Fix Version/s: 10.0.32

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-12358 GCC 7 issues Closed

 Description   

GCC 7 is reporting the following -Wimplicit-fallthrough warnings for 10.0 after my fix. Many of these look like genuine bugs.

mysys/ma_dyncol.c: In function 'mariadb_dyncol_val_double':
mysys/ma_dyncol.c:4033:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c: In function 'get_one_option':
extra/my_print_defaults.c:131:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c:136:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In function 'char* GetListOption(PGLOBAL, const char*, const char*, const char*)':
storage/connect/ha_connect.cc:2550:35: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2806:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2922:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2934:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2941:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:4313:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:4338:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In function 'int connect_assisted_discovery(handlerton*, THD*, TABLE_SHARE*, HA_CREATE_INFO*)':
storage/connect/ha_connect.cc:5515:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:6074:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc:1403:38: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc:1436:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc:1322:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc:1355:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/heap/hp_extra.c: In function 'heap_extra':
storage/heap/hp_extra.c:36:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/plugutil.c: In function 'PlugInit':
storage/connect/filamap.cpp:350:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/filamgz.cpp:1020:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/json.cpp: In function 'JSON* ParseJson(PGLOBAL, char*, int, int*, bool*)':
storage/connect/json.cpp:152:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(char*, char*)':
storage/connect/myutil.cpp:67:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(int, char*)':
storage/connect/myutil.cpp:236:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp:224:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp:297:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp:339:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp:171:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp:177:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql-common/client.c: In function 'mysql_read_default_options':
sql-common/client.c:1150:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/maria/ma_key_recover.c: In function '_ma_apply_redo_index':
storage/maria/ma_key_recover.c:1171:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
client/mysql.cc: In function 'my_bool get_one_option(int, const my_option*, char*)':
client/mysql.cc:1893:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql-common/client.c: In function 'mysql_read_default_options':
sql-common/client.c:1150:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/item_func.cc:863:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/log.cc:9402:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/sql_repl.cc: In function 'void mysql_binlog_send(THD*, char*, my_off_t, ushort)':
sql/sql_repl.cc:2663:9: warning: this statement may fall through [-Wimplicit-fallthrough=]



 Comments   
Comment by Marko Mäkelä [ 2017-05-18 ]

Here are the warnings for 10.1 after a tentative merge from 10.0:

mysys/ma_dyncol.c: In function 'mariadb_dyncol_val_double':
mysys/ma_dyncol.c:4032:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c: In function 'get_one_option':
extra/my_print_defaults.c:133:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c:136:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c:141:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'FILTER* ha_connect::CondFilter(PGLOBAL, Item*)':
storage/connect/ha_connect.cc:2550:35: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'CONDFIL* ha_connect::CheckCond(PGLOBAL, PCFIL, const Item*)':
storage/connect/ha_connect.cc:2806:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2922:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2934:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2941:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'MODE ha_connect::CheckMode(PGLOBAL, THD*, MODE, bool*, bool*)':
storage/connect/ha_connect.cc:4313:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:4338:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'virtual int ha_connect::create(const char*, TABLE*, HA_CREATE_INFO*)':
storage/connect/ha_connect.cc:6074:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In function 'int connect_assisted_discovery(handlerton*, THD*, TABLE_SHARE*, HA_CREATE_INFO*)':
storage/connect/ha_connect.cc:5515:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc: In member function 'bool ha_federated::create_where_from_key(String*, KEY*, const key_range*, const key_range*, bool, bool)':
storage/federated/ha_federated.cc:1403:38: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc:1436:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc: In member function 'bool ha_federatedx::create_where_from_key(String*, KEY*, const key_range*, const key_range*, bool, bool)':
storage/federatedx/ha_federatedx.cc:1322:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc:1355:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/heap/hp_extra.c: In function 'heap_extra':
storage/heap/hp_extra.c:36:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/filamap.cpp: In member function 'virtual int MAPFAM::ReadBuffer(PGLOBAL)':
storage/connect/filamap.cpp:350:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/filamgz.cpp: In member function 'virtual bool ZLBFAM::AllocateBuffer(PGLOBAL)':
storage/connect/filamgz.cpp:1020:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/json.cpp: In function 'JSON* ParseJson(PGLOBAL, char*, int, int*, bool*)':
storage/connect/json.cpp:152:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(char*, char*)':
storage/connect/myutil.cpp:67:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(int, char*)':
storage/connect/myutil.cpp:236:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp:224:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp: In member function 'int TABDEF::GetColCatInfo(PGLOBAL)':
storage/connect/reldef.cpp:297:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp:339:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp: In member function 'int TDBVIR::TestFilter(PFIL, bool)':
storage/connect/tabvir.cpp:171:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp:177:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql-common/client.c: In function 'mysql_read_default_options':
sql-common/client.c:1150:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/maria/ma_key_recover.c: In function '_ma_apply_redo_index':
storage/maria/ma_key_recover.c:1171:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
client/mysql.cc: In function 'my_bool get_one_option(int, const my_option*, char*)':
client/mysql.cc:1891:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql-common/client.c: In function 'mysql_read_default_options':
sql-common/client.c:1150:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/log.cc: In member function 'int MYSQL_BIN_LOG::recover(LOG_INFO*, const char*, IO_CACHE*, Format_description_log_event*, bool)':
sql/log.cc:9766:9: warning: this statement may fall through [-Wimplicit-fallthrough=]

Comment by Marko Mäkelä [ 2017-05-18 ]

Here is the list of warnings for 10.2 after a tentative merge of the above:

libmariadb/libmariadb/mariadb_lib.c: In function 'mariadb_get_infov':
libmariadb/libmariadb/mariadb_lib.c:3821:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
libmariadb/plugins/connection/aurora.c: In function 'aurora_command':
libmariadb/plugins/connection/aurora.c:761:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
libmariadb/libmariadb/ma_dtoa.c: In function 'dtoa':
libmariadb/libmariadb/ma_dtoa.c:1465:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
libmariadb/libmariadb/ma_dtoa.c:1473:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
libmariadb/libmariadb/mariadb_dyncol.c: In function 'mariadb_dyncol_val_double':
libmariadb/libmariadb/mariadb_dyncol.c:4044:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
strings/json_lib.c: In function 'json_path_setup':
strings/json_lib.c:1141:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
strings/json_lib.c:1148:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
strings/json_lib.c:1155:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
strings/json_lib.c: In function 'json_get_path_next':
strings/json_lib.c:1704:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
mysys/ma_dyncol.c: In function 'mariadb_dyncol_val_double':
mysys/ma_dyncol.c:4032:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c: In function 'get_one_option':
extra/my_print_defaults.c:133:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c:136:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
extra/my_print_defaults.c:141:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'FILTER* ha_connect::CondFilter(PGLOBAL, Item*)':
storage/connect/ha_connect.cc:2549:35: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'CONDFIL* ha_connect::CheckCond(PGLOBAL, PCFIL, const Item*)':
storage/connect/ha_connect.cc:2805:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2921:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2933:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:2940:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'MODE ha_connect::CheckMode(PGLOBAL, THD*, MODE, bool*, bool*)':
storage/connect/ha_connect.cc:4312:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc:4337:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In member function 'virtual int ha_connect::create(const char*, TABLE*, HA_CREATE_INFO*)':
storage/connect/ha_connect.cc:6073:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/ha_connect.cc: In function 'int connect_assisted_discovery(handlerton*, THD*, TABLE_SHARE*, HA_CREATE_INFO*)':
storage/connect/ha_connect.cc:5514:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc: In member function 'bool ha_federated::create_where_from_key(String*, KEY*, const key_range*, const key_range*, bool, bool)':
storage/federated/ha_federated.cc:1401:38: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federated/ha_federated.cc:1434:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc: In member function 'bool ha_federatedx::create_where_from_key(String*, KEY*, const key_range*, const key_range*, bool, bool)':
storage/federatedx/ha_federatedx.cc:1320:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/federatedx/ha_federatedx.cc:1353:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/heap/hp_extra.c: In function 'heap_extra':
storage/heap/hp_extra.c:36:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/innobase/include/buf0buf.ic: In function 'void buf_page_release_zip(buf_page_t*)':
storage/innobase/include/buf0buf.ic:1287:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/filamap.cpp: In member function 'virtual int MAPFAM::ReadBuffer(PGLOBAL)':
storage/connect/filamap.cpp:350:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/filamgz.cpp: In member function 'virtual bool ZLBFAM::AllocateBuffer(PGLOBAL)':
storage/connect/filamgz.cpp:1020:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/json.cpp: In function 'JSON* ParseJson(PGLOBAL, char*, int, int*, bool*)':
storage/connect/json.cpp:152:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(char*, char*)':
storage/connect/myutil.cpp:67:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp: In function 'int MYSQLtoPLG(int, char*)':
storage/connect/myutil.cpp:236:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/myutil.cpp:224:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp: In member function 'int TABDEF::GetColCatInfo(PGLOBAL)':
storage/connect/reldef.cpp:297:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/reldef.cpp:339:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/innobase/buf/buf0rea.cc: In function 'ulint buf_read_ahead_linear(const page_id_t&, const page_size_t&, ulint)':
storage/innobase/buf/buf0rea.cc:758:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp: In member function 'int TDBVIR::TestFilter(PFIL, bool)':
storage/connect/tabvir.cpp:171:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/connect/tabvir.cpp:177:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/innobase/data/data0type.cc: In function 'void dtype_print(const dtype_t*)':
storage/innobase/data/data0type.cc:201:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/innobase/fts/fts0plugin.cc: In function 'int fts_query_add_word_for_parser(MYSQL_FTPARSER_PARAM*, const char*, int, MYSQL_FTPARSER_BOOLEAN_INFO*)':
storage/innobase/fts/fts0plugin.cc:130:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
client/mysql.cc: In function 'my_bool get_one_option(int, const my_option*, char*)':
client/mysql.cc:1893:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/maria/ma_key_recover.c: In function '_ma_apply_redo_index':
storage/maria/ma_key_recover.c:1171:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
storage/innobase/srv/srv0srv.cc: In function 'bool srv_purge_should_exit(THD*, ulint)':
storage/innobase/srv/srv0srv.cc:2598:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql-common/client.c: In function 'mysql_read_default_options':
sql-common/client.c:1152:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/log.cc: In member function 'int MYSQL_BIN_LOG::recover(LOG_INFO*, const char*, IO_CACHE*, Format_description_log_event*, bool)':
sql/log.cc:9761:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
sql/sql_table.cc: In function 'int prepare_create_field(Column_definition*, uint*, ulonglong)':
sql/sql_table.cc:3015:5: warning: this statement may fall through [-Wimplicit-fallthrough=]

Comment by Sergei Golubchik [ 2017-07-20 ]

Real bugs fixed. Some false positives fixed too.
Connect issues forwarded over to bertrandop.

Generated at Thu Feb 08 08:00:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.