From 838205f0bb3a818e05e34c25d55053a9a2a1487e Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 19 Jun 2016 15:06:10 +0300 Subject: [PATCH] Fixed compiler warnings and test failures found by buildbot --- .../r/show_status_stop_slave_race-7126.result | 1 + .../t/show_status_stop_slave_race-7126.test | 4 +++- plugin/user_variables/user_variables.cc | 24 +++++++++---------- sql/sql_acl.cc | 18 +++++++------- storage/connect/jsonudf.cpp | 10 ++++---- storage/connect/odbconn.cpp | 2 +- storage/innobase/dict/dict0boot.cc | 2 +- storage/innobase/fsp/fsp0fsp.cc | 2 +- .../tokudb/r/rows-32m-rand-insert.result | 3 +++ .../tokudb/r/rows-32m-seq-insert.result | 3 +++ support-files/compiler_warnings.supp | 9 +++++-- 11 files changed, 46 insertions(+), 32 deletions(-) diff --git a/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result index 277b3e74696..de89fbaf67c 100644 --- a/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result +++ b/mysql-test/suite/rpl/r/show_status_stop_slave_race-7126.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] connection slave; +call mtr.add_suppression("Master is configured to log replication events"); connection slave; start slave; connection master; diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test index 38759c9b16a..80282b33e77 100644 --- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test +++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test @@ -5,6 +5,9 @@ --connection slave +call mtr.add_suppression("Master is configured to log replication events"); + + # If everything is okay, the test will end in several seconds; maybe a minute. # If the problem shows up, it will hang until testcase timeout is exceeded. --exec $MYSQL_SLAP --silent --socket=$SLAVE_MYSOCK -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test @@ -16,4 +19,3 @@ start slave; --connection master --source include/rpl_end.inc - diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc index c6c48d09303..981c39cdb86 100644 --- a/plugin/user_variables/user_variables.cc +++ b/plugin/user_variables/user_variables.cc @@ -21,23 +21,23 @@ static const LEX_CSTRING result_types[]= { - STRING_WITH_LEN("VARCHAR"), - STRING_WITH_LEN("DOUBLE"), - STRING_WITH_LEN("INT"), - STRING_WITH_LEN(""), // ROW_RESULT - STRING_WITH_LEN("DECIMAL"), - STRING_WITH_LEN("") // TIME_RESULT + { STRING_WITH_LEN("VARCHAR") }, + { STRING_WITH_LEN("DOUBLE") }, + { STRING_WITH_LEN("INT") }, + { STRING_WITH_LEN("") }, // ROW_RESULT + { STRING_WITH_LEN("DECIMAL") }, + { STRING_WITH_LEN("")} // TIME_RESULT }; static const LEX_CSTRING unsigned_result_types[]= { - STRING_WITH_LEN(""), // UNSIGNED STRING_RESULT - STRING_WITH_LEN("DOUBLE UNSIGNED"), - STRING_WITH_LEN("INT UNSIGNED"), - STRING_WITH_LEN(""), // UNSIGNED ROW_RESULT - STRING_WITH_LEN("DECIMAL UNSIGNED"), - STRING_WITH_LEN("") // UNSIGNED TIME_RESULT + { STRING_WITH_LEN("") }, // UNSIGNED STRING_RESULT + { STRING_WITH_LEN("DOUBLE UNSIGNED") }, + { STRING_WITH_LEN("INT UNSIGNED") }, + { STRING_WITH_LEN("") }, // UNSIGNED ROW_RESULT + { STRING_WITH_LEN("DECIMAL UNSIGNED") }, + { STRING_WITH_LEN("") } // UNSIGNED TIME_RESULT }; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c0a865c39f6..91f337fa713 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2910,6 +2910,15 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, safe_str(rolename), safe_str(user), safe_str(host)); } + /* + This statement will be replicated as a statement, even when using + row-based replication. The flag will be reset at the end of the + statement. + This has to be handled here as it's called by set_var.cc, which is + not automaticly handled by sql_parse.cc + */ + save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); + if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0)) { thd->set_query_inner(buff, query_length, system_charset_info); @@ -2922,15 +2931,6 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, table= tables[USER_TABLE].table; result= 1; - /* - This statement will be replicated as a statement, even when using - row-based replication. The flag will be reset at the end of the - statement. - This has to be handled here as it's called by set_var.cc, which is - not automaticly handled by sql_parse.cc - */ - save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); - mysql_mutex_lock(&acl_cache->lock); ACL_USER *acl_user; if (!(acl_user= find_user_exact(host, user))) diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 25c77cea534..6987230121a 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -533,7 +533,7 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) /*********************************************************************************/ my_bool JSNX::CheckPath(PGLOBAL g) { - PJVAL val; + PJVAL val= NULL; PJSON row = Row; for (int i = 0; i < Nod && row; i++) { @@ -1370,7 +1370,7 @@ static my_bool CalcLen(UDF_ARGS *args, my_bool obj, memlen += (k + sizeof(JOBJECT) + sizeof(JPAIR)); } else memlen += sizeof(JARRAY); - + fl= 0; switch (args->arg_type[i]) { case STRING_RESULT: if (n == 2 && args->args[i]) { @@ -2087,7 +2087,7 @@ my_bool json_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *json_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *res_length, char *, char *) { - char *str; + char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; if (!g->Xchk) { @@ -2621,7 +2621,7 @@ char *json_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - PJSON top; + PJSON top= 0; PJVAL jvp; PJSON jsp[2] = {NULL, NULL}; @@ -4721,7 +4721,7 @@ char *jbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, my_bool b = true; PJSON jsp; PJSNX jsx; - PJVAL jvp; + PJVAL jvp= 0; PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; PGLOBAL gb = GetMemPtr(g, args, 0); diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 55ccbdbada1..b5ba3bc67da 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -1752,7 +1752,7 @@ bool ODBConn::BindParam(ODBCCOL *colp) void *buf; int buftype = colp->GetResultType(); SQLUSMALLINT n = colp->GetRank(); - SQLSMALLINT ct, sqlt, dec, nul; + SQLSMALLINT ct, sqlt, dec, nul __attribute__((unused)); SQLULEN colsize; SQLLEN len; SQLLEN *strlen = colp->GetStrLen(); diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index 0dff05567d7..80724372f27 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -468,7 +468,7 @@ dict_boot(void) } else { ib_logf(IB_LOG_LEVEL_WARN, "Change buffer not empty when --innodb-read-only " - "is set! but srv_force_recovery = %d, ignoring.", + "is set! but srv_force_recovery = %lu, ignoring.", srv_force_recovery); } } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index bbd7ee1b650..96df08acdec 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -2736,7 +2736,7 @@ fsp_reserve_free_extents( ulint zip_size; ulint n_free; ulint n_free_up; - ulint reserve; + ulint reserve= 0; ibool success; ulint n_pages_added; size_t total_reserved = 0; diff --git a/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result b/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result index b287c70469e..894de50f863 100644 --- a/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result +++ b/storage/tokudb/mysql-test/tokudb/r/rows-32m-rand-insert.result @@ -3,6 +3,7 @@ drop table if exists t; create table t (id int not null primary key, v longblob not null); select @@max_allowed_packet into @my_max_allowed_packet; set global max_allowed_packet=100000000; +connect conn1,localhost,root,,; insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); @@ -1003,6 +1004,8 @@ insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024- insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); insert ignore into t (id,v) values (floor(rand()*1000),repeat('a',(32*1024*1024-4)*rand())); +connection default; +disconnect conn1; set global max_allowed_packet=@my_max_allowed_packet; check table t; Table Op Msg_type Msg_text diff --git a/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result b/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result index a242cac98c2..ddd5b908231 100644 --- a/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result +++ b/storage/tokudb/mysql-test/tokudb/r/rows-32m-seq-insert.result @@ -3,6 +3,7 @@ drop table if exists t; create table t (id int not null auto_increment primary key, v longblob not null); select @@max_allowed_packet into @my_max_allowed_packet; set global max_allowed_packet=100000000; +connect conn1,localhost,root,,; insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); @@ -1003,6 +1004,8 @@ insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); insert into t (v) values (repeat('a',(32*1024*1024-4)*rand())); +connection default; +disconnect conn1; set global max_allowed_packet=@my_max_allowed_packet; check table t; Table Op Msg_type Msg_text diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 61c6b483aa9..727c2f2818a 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -178,12 +178,13 @@ jemalloc/src/jemalloc\.c: set but not used # # Connect engine # -storage/connect/ha_connect\.cc: might be clobbered by ~longjmp~ -storage/connect/connect\.cc: might be clobbered by ~longjmp~ +storage/connect/ha_connect\.cc: might be clobbered by.*longjmp +storage/connect/connect\.cc: might be clobbered by.*longjmp storage/connect/filamvct\.cpp: ignoring return value of storage/connect/filamvct\.cpp: might be clobbered by storage/connect/xindex\.cpp: ignoring return value of storage/connect/value\.cpp: always false +storage/connect/json\.cpp: might be clobbered by # # mroonga @@ -239,6 +240,10 @@ storage/.*/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifi storage/.*/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300 storage/.*/btr/btr0sea\.c : passing argument 2 of .*btr_cur_position.* discards qualifiers from pointer +# Fixed wrong warning in GCC due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61520 + +strings/decimal.c: array subscript is below array bounds + # # Strange things from autoconf that is probably safe to ignore #