#At lp:maria based on revid:monty@askmonty.org-20100128113510-bmn8nf14b76l3mof 2806 Michael Widenius 2010-01-28 Fixed compiler warnings & failing test cases When compiling with debug, don't clear buffer in 'net_clear()' - This allows us to easier find bugs in the protocol and also get repeatable test failures in test cases where someone forgot to do --reap modified: client/mysqltest.cc mysql-test/t/partition_innodb_semi_consistent.test sql/net_serv.cc storage/myisam/ft_boolean_search.c storage/myisam/ft_parser.c storage/myisam/ft_stopwords.c support-files/compiler_warnings.supp unittest/mysys/waiting_threads-t.c per-file messages: client/mysqltest.cc Fixed compiler warning mysql-test/t/partition_innodb_semi_consistent.test Added missing --reap (fixes random failure) sql/net_serv.cc When compiling with debug, don't clear buffer in 'net_clear()' - This allows us to easier find bugs in the protocol and also get repeatable test failures in test cases where someone forgot to do --reap storage/myisam/ft_boolean_search.c Fixed compiler warnings storage/myisam/ft_parser.c Fixed compiler warnings storage/myisam/ft_stopwords.c Fixed compiler warnings support-files/compiler_warnings.supp Added a lot of new suppression of not relevant warnings and warnings in systems we are not in charge of unittest/mysys/waiting_threads-t.c Fixed compiler warnings === modified file 'client/mysqltest.cc' --- a/client/mysqltest.cc 2010-01-15 15:27:55 +0000 +++ b/client/mysqltest.cc 2010-01-28 14:49:14 +0000 @@ -657,7 +657,9 @@ public: } while ((bytes= fread(buf, 1, sizeof(buf), m_file)) > 0) - fwrite(buf, 1, bytes, stderr); + if (fwrite(buf, 1, bytes, stderr)) + die("Failed to write to '%s', errno: %d", + m_file_name, errno); if (!lines) { === modified file 'mysql-test/t/partition_innodb_semi_consistent.test' --- a/mysql-test/t/partition_innodb_semi_consistent.test 2009-01-13 22:12:16 +0000 +++ b/mysql-test/t/partition_innodb_semi_consistent.test 2010-01-28 14:49:14 +0000 @@ -187,6 +187,7 @@ SELECT * FROM t1; --echo # Switch to connection con2 connection con2; +--reap SELECT * FROM t1; connection default; === modified file 'sql/net_serv.cc' --- a/sql/net_serv.cc 2009-09-07 20:50:10 +0000 +++ b/sql/net_serv.cc 2010-01-28 14:49:14 +0000 @@ -286,7 +286,12 @@ void net_clear(NET *net, my_bool clear_b #endif DBUG_ENTER("net_clear"); -#if !defined(EMBEDDED_LIBRARY) +/* + We don't do a clear in case of DBUG_OFF to catch bugs + in the protocol handling +*/ + +#if !defined(EMBEDDED_LIBRARY) && defined(DBUG_OFF) if (clear_buffer) { while ((ready= net_data_is_ready(net->vio->sd)) > 0) === modified file 'storage/myisam/ft_boolean_search.c' --- a/storage/myisam/ft_boolean_search.c 2010-01-27 21:53:08 +0000 +++ b/storage/myisam/ft_boolean_search.c 2010-01-28 14:49:14 +0000 @@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uc param->mysql_add_word= ftb_query_add_word; param->mysql_ftparam= (void *)&ftb_param; param->cs= ftb->charset; - param->doc= (char*) query; + param->doc= query; param->length= len; param->flags= 0; param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO; @@ -702,7 +702,7 @@ static int _ftb_check_phrase(FTB *ftb, c param->mysql_add_word= ftb_phrase_add_word; param->mysql_ftparam= (void *)&ftb_param; param->cs= ftb->charset; - param->doc= (char *) document; + param->doc= document; param->length= len; param->flags= 0; param->mode= MYSQL_FTPARSER_WITH_STOPWORDS; @@ -1000,7 +1000,7 @@ float ft_boolean_find_relevance(FT_INFO { if (!ftsi.pos) continue; - param->doc= (char *)ftsi.pos; + param->doc= ftsi.pos; param->length= ftsi.len; if (unlikely(parser->parse(param))) return 0; === modified file 'storage/myisam/ft_parser.c' --- a/storage/myisam/ft_parser.c 2010-01-27 21:53:08 +0000 +++ b/storage/myisam/ft_parser.c 2010-01-28 14:49:14 +0000 @@ -175,7 +175,7 @@ uchar ft_get_word(CHARSET_INFO *cs, cons if ((param->trunc=(doc<end && *doc == FTB_TRUNC))) doc++; - if (((length >= ft_min_word_len && !is_stopword((char*) word->pos, + if (((length >= ft_min_word_len && !is_stopword(word->pos, word->len)) || param->trunc) && length < ft_max_word_len) { @@ -298,7 +298,7 @@ static int ft_parse_internal(MYSQL_FTPAR DBUG_ENTER("ft_parse_internal"); while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE)) - if (param->mysql_add_word(param, (char*) w.pos, w.len, 0)) + if (param->mysql_add_word(param, w.pos, w.len, 0)) DBUG_RETURN(1); DBUG_RETURN(0); } @@ -319,7 +319,7 @@ int ft_parse(TREE *wtree, const uchar *d param->mysql_add_word= ft_add_word; param->mysql_ftparam= &my_param; param->cs= wtree->custom_arg; - param->doc= (char*) doc; + param->doc= doc; param->length= doclen; param->mode= MYSQL_FTPARSER_SIMPLE_MODE; DBUG_RETURN(parser->parse(param)); === modified file 'storage/myisam/ft_stopwords.c' --- a/storage/myisam/ft_stopwords.c 2010-01-27 21:53:08 +0000 +++ b/storage/myisam/ft_stopwords.c 2010-01-28 14:49:14 +0000 @@ -20,7 +20,7 @@ typedef struct st_ft_stopwords { - const char * pos; + const uchar* pos; size_t len; } FT_STOPWORD; @@ -30,15 +30,15 @@ static int FT_STOPWORD_cmp(void* cmp_arg FT_STOPWORD *w1, FT_STOPWORD *w2) { return ha_compare_text(default_charset_info, - (uchar *)w1->pos,w1->len, - (uchar *)w2->pos,w2->len,0,0); + w1->pos, w1->len, + w2->pos, w2->len, 0, 0); } static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, void *arg __attribute__((unused))) { if (action == free_free) - my_free((uchar*) w->pos, MYF(0)); + my_free((void*) w->pos, MYF(0)); } static int ft_add_stopword(const char *w) === modified file 'support-files/compiler_warnings.supp' --- a/support-files/compiler_warnings.supp 2010-01-28 11:35:10 +0000 +++ b/support-files/compiler_warnings.supp 2010-01-28 14:49:14 +0000 @@ -4,6 +4,7 @@ # integer.cpp: .*control reaches end of non-void function.*: 1288-1427 +integer.cpp: .*no return statement in function returning non-void.*: 1288-1427 DictTabInfo.cpp : .*invalid access to non-static.* DictTabInfo.cpp : .*macro was used incorrectly.* DbdihMain.cpp : .*unused variable.* : 6666-7013 @@ -27,13 +28,17 @@ _flex_tmp.c: .*not enough actual paramet pars0lex.l: .*conversion from 'ulint' to 'int', possible loss of data.* btr/btr0cur\.c: .*value computed is not used.*: 3175-3375 include/buf0buf\.ic: unused parameter ���mtr��� +fil/fil0fil\.c: pointer targets in passing argument.*differ in signedness fil/fil0fil\.c: comparison between signed and unsigned : 3100-3199 fil/fil0fil\.c: unused parameter log/log0recv\.c: unused variable os/os0file\.c: unused parameter +os/os0file\.c: pointer targets in assignment differ in signedness handler/i_s\.cc: unused variable sync/sync0rw\.c: unused parameter sync/sync0sync\.c: unused parameter +sync/sync0sync\.c: unused variable +ut/ut0ut\.c: ignoring return value of # # bdb is not critical to keep up to date @@ -98,10 +103,15 @@ storage/maria/ma_pagecache.c: .*'info_ch # I think these are due to mix of C and C++. # storage/pbxt/ : typedef.*was ignored in this declaration +ha_pbxt\.cc : variable.*might be clobbered by.*longjmp # # Yassl include/runtime.hpp: .*pure_error.* +.*/extra/yassl/taocrypt/.*: comparison with string literal +.*/extra/yassl/taocrypt/src/blowfish\.cpp: array subscript is above array bounds +.*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value +.*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function # # Groff warnings on OpenSUSE. === modified file 'unittest/mysys/waiting_threads-t.c' --- a/unittest/mysys/waiting_threads-t.c 2009-09-15 10:46:35 +0000 +++ b/unittest/mysys/waiting_threads-t.c 2010-01-28 14:49:14 +0000 @@ -258,7 +258,7 @@ void do_tests() #define test_kill_strategy(X) \ diag("kill strategy: " #X); \ DBUG_EXECUTE("reset_file", \ - { rewind(DBUG_FILE); ftruncate(fileno(DBUG_FILE), 0); }); \ + { rewind(DBUG_FILE); (void) ftruncate(fileno(DBUG_FILE), 0); }); \ DBUG_PRINT("info", ("kill strategy: " #X)); \ kill_strategy=X; \ do_one_test();