diff options
author | unknown <knielsen@knielsen-hq.org> | 2010-03-10 11:32:14 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2010-03-10 11:32:14 +0100 |
commit | 3e32ba3ff1068c19dbf0c69de991da426cf7f327 (patch) | |
tree | c5a1bd229e311b409f92b9865198f21f91f0b5db | |
parent | 4d7b6a6ea157bfa193376fb6367b64dd23e0d058 (diff) | |
download | mariadb-git-3e32ba3ff1068c19dbf0c69de991da426cf7f327.tar.gz |
Fix some compiler warnings seen in Buildbot.
Add some extra error output and code cleanup in an attempt to fix/debug
a rare random testsuite problem in check_warnings, where the exit code
from mysqltest is somehow corrupted inside mysql-test-run.pl.
include/my_global.h:
Fix compiler warnings on some platforms.
mysql-test/lib/My/SafeProcess.pm:
Move dereference of $? subprocess exit code closer to where it is generated,
to make the code more robust and on the chance that this will fix the
occasional problems in check_warnings we see in Buildbot.
mysql-test/mysql-test-run.pl:
When check_warnings failed, also log the mysqld server for which it failed.
sql/sql_lex.cc:
Fix compiler warning about possibly uninitialised value, by rewriting a for()
loop that is always executed at least once into a do .. while() loop with an
assert.
sql/table.cc:
Fix compiler warning about uninitialised value.
storage/federatedx/ha_federatedx.cc:
Fix uninitialised variable.
storage/maria/ma_delete.c:
Fix compiler warning about uninitialised value.
storage/maria/ma_loghandler.c:
Fix compiler warning about uninitialised value.
storage/myisam/ft_stopwords.c:
Fix compiler warning.
storage/myisam/mi_write.c:
Fix compiler warning about possibly uninitialised value, by rewriting a while()
loop that is always executed at least once into a do .. while() loop with an
assert.
storage/xtradb/btr/btr0cur.c:
Fix compiler warning about possibly uninitialised value.
support-files/compiler_warnings.supp:
Fix warning suppression to cover all cases in yassl.
vio/viossl.c:
Fix compiler warning.
-rw-r--r-- | include/my_global.h | 6 | ||||
-rw-r--r-- | mysql-test/lib/My/SafeProcess.pm | 14 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 7 | ||||
-rw-r--r-- | sql/sql_lex.cc | 11 | ||||
-rw-r--r-- | sql/table.cc | 2 | ||||
-rw-r--r-- | storage/federatedx/ha_federatedx.cc | 2 | ||||
-rw-r--r-- | storage/maria/ma_delete.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 1 | ||||
-rw-r--r-- | storage/myisam/ft_stopwords.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_write.c | 7 | ||||
-rw-r--r-- | storage/xtradb/btr/btr0cur.c | 2 | ||||
-rw-r--r-- | support-files/compiler_warnings.supp | 2 | ||||
-rw-r--r-- | vio/viossl.c | 2 |
13 files changed, 40 insertions, 20 deletions
diff --git a/include/my_global.h b/include/my_global.h index 01bd6a9ba9e..6c11a4b461a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1260,9 +1260,9 @@ do { doubleget_union _tmp; \ } while (0) #define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0) #define float8get(V,M) doubleget((V),(M)) -#define float4store(V,M) memcpy((uchar*) V,(const uchar*) (&M),sizeof(float)) -#define floatstore(T,V) memcpy((uchar*)(T), (const uchar*)(&V),sizeof(float)) -#define floatget(V,M) memcpy((uchar*) &V,(const uchar*) (M),sizeof(float)) +#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float)) +#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float)) +#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float)) #define float8store(V,M) doublestore((V),(M)) #else diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index 7e102b628ca..301392a4d88 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -384,9 +384,9 @@ sub kill { sub _collect { - my ($self)= @_; + my ($self, $exit_code)= @_; - $self->{EXIT_STATUS}= $?; + $self->{EXIT_STATUS}= $exit_code; _verbose("_collect: $self"); # Take the process out of running list @@ -453,6 +453,7 @@ sub wait_one { #_verbose("blocking: $blocking, use_alarm: $use_alarm"); my $retpid; + my $exit_code; eval { # alarm should break the wait @@ -461,6 +462,7 @@ sub wait_one { alarm($timeout) if $use_alarm; $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG); + $exit_code= $?; alarm(0) if $use_alarm; }; @@ -492,7 +494,7 @@ sub wait_one { #warn "wait_one: expected pid $pid but got $retpid" # unless( $retpid == $pid ); - $self->_collect(); + $self->_collect($exit_code); return 0; } @@ -505,6 +507,8 @@ sub wait_one { # sub wait_any { my $ret_pid; + my $exit_code; + if (IS_WIN32PERL) { # Can't wait for -1 => use a polling loop do { @@ -514,6 +518,7 @@ sub wait_any { last if $pid == $ret_pid; } } while ($ret_pid == 0); + $exit_code= $?; } else { @@ -523,6 +528,7 @@ sub wait_any { print STDERR "wait_any, got invalid pid: $ret_pid\n"; return undef; } + $exit_code= $?; } # Look it up in "running" table @@ -532,7 +538,7 @@ sub wait_any { print STDERR "running: ". join(", ", keys(%running)). "\n"; return undef; } - $proc->_collect; + $proc->_collect($exit_code); return $proc; } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 45b65b15211..a06b29815a0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4102,7 +4102,7 @@ sub start_check_warnings ($$) { error => $errfile, output => $errfile, args => \$args, - user_data => $errfile, + user_data => [$errfile, $mysqld], verbose => $opt_verbose, ); mtr_verbose("Started $proc"); @@ -4148,7 +4148,7 @@ sub check_warnings ($) { if ( delete $started{$proc->pid()} ) { # One check warning process returned my $res= $proc->exit_status(); - my $err_file= $proc->user_data(); + my ($err_file, $mysqld)= @{$proc->user_data()}; if ( $res == 0 or $res == 62 ){ @@ -4184,7 +4184,8 @@ sub check_warnings ($) { my $report= mtr_grab_file($err_file); $tinfo->{comment}.= "Could not execute 'check-warnings' for ". - "testcase '$tname' (res: $res):\n"; + "testcase '$tname' (res: $res) server: '". + $mysqld->name() .":\n"; $tinfo->{comment}.= $report; $result= 2; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6d047197992..5a3907d0f7f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1842,13 +1842,15 @@ void st_select_lex_unit::exclude_tree() void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) { SELECT_LEX *next_to_last; + + DBUG_ASSERT(this != last); + /* Mark all selects from resolved to 1 before select where was found table as depended (of select where was found table) */ - for (SELECT_LEX *s= this; - s && s != last; - s= s->outer_select()) + SELECT_LEX *s= this; + do { if (!(s->uncacheable & UNCACHEABLE_DEPENDENT)) { @@ -1866,7 +1868,8 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) } } next_to_last= s; - } + } while ((s= s->outer_select()) != last && s != 0); + is_correlated= TRUE; this->master_unit()->item->is_correlated= TRUE; if (dependency) diff --git a/sql/table.cc b/sql/table.cc index ef33aef20d5..733aa3e6887 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2053,6 +2053,8 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) ulong ret_value=0; DBUG_ENTER("get_form_pos"); + LINT_INIT(buf); + names=uint2korr(head+8); a_length=(names+2)*sizeof(char *); /* Room for two extra */ diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index e06f39c073f..2c74b2f6675 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1783,7 +1783,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked) int ha_federatedx::close(void) { - int retval, error; + int retval= 0, error; THD *thd= current_thd; DBUG_ENTER("ha_federatedx::close"); diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c index 5b0a2ac8884..0e9e5caafbf 100644 --- a/storage/maria/ma_delete.c +++ b/storage/maria/ma_delete.c @@ -169,6 +169,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key) MARIA_KEY org_key; DBUG_ENTER("_ma_ck_delete"); + LINT_INIT_STRUCT(org_key); + save_key_data= key->data; if (share->now_transactional) { diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 536336d795d..aff2b638e4e 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1394,6 +1394,7 @@ LSN translog_get_file_max_lsn_stored(uint32 file) { LOGHANDLER_FILE_INFO info; + LINT_INIT_STRUCT(info); File fd= open_logfile_by_number_no_cache(file); if ((fd < 0) || (translog_read_file_header(&info, fd) | my_close(fd, MYF(MY_WME)))) diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 5e550b9dff5..aa209e082e0 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -45,7 +45,7 @@ static int ft_add_stopword(const char *w) { FT_STOPWORD sw; return !w || - (((sw.len= (uint) strlen(sw.pos=w)) >= ft_min_word_len) && + (((sw.len= (uint) strlen(sw.pos=(const uchar *)w)) >= ft_min_word_len) && (tree_insert(stopwords3, &sw, 0, stopwords3->custom_arg)==NULL)); } diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index f2528f2ec60..6ad23154b45 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -735,10 +735,12 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, } end=page+length-key_ref_length; + DBUG_ASSERT(page < end); *key='\0'; length=0; lastpos=page; - while (page < end) + + do { prevpos=lastpos; lastpos=page; last_length=length; @@ -749,7 +751,8 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); } - } + } while (page < end); + *return_key_length=last_length; *after_key=lastpos; DBUG_PRINT("exit",("returns: 0x%lx page: 0x%lx end: 0x%lx", diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c index 601e5af3572..55d3e1e8e6b 100644 --- a/storage/xtradb/btr/btr0cur.c +++ b/storage/xtradb/btr/btr0cur.c @@ -3233,7 +3233,7 @@ btr_estimate_number_of_different_key_vals( ulint matched_bytes; ib_int64_t n_recs = 0; ib_int64_t* n_diff; - ib_int64_t* n_not_nulls; + ib_int64_t* n_not_nulls= 0; ullint n_sample_pages; /* number of pages to sample */ ulint not_empty_flag = 0; ulint total_external_size = 0; diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 7911d91928b..d3806f42b94 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -108,7 +108,7 @@ 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/.*: 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 diff --git a/vio/viossl.c b/vio/viossl.c index c7449c7feb2..61e4d9406a7 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -75,9 +75,11 @@ report_errors(SSL* ssl) if (ssl) { +#ifndef DBUG_OFF int error= SSL_get_error(ssl, l); DBUG_PRINT("error", ("error: %s (%d)", ERR_error_string(error, buf), error)); +#endif } DBUG_PRINT("info", ("socket_errno: %d", socket_errno)); |