Commit 3e32ba3f authored by unknown's avatar unknown

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.
parent 4d7b6a6e
...@@ -1260,9 +1260,9 @@ do { doubleget_union _tmp; \ ...@@ -1260,9 +1260,9 @@ do { doubleget_union _tmp; \
} while (0) } while (0)
#define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0) #define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M)) #define float8get(V,M) doubleget((V),(M))
#define float4store(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), (const uchar*)(&V),sizeof(float)) #define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
#define floatget(V,M) memcpy((uchar*) &V,(const uchar*) (M),sizeof(float)) #define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
#define float8store(V,M) doublestore((V),(M)) #define float8store(V,M) doublestore((V),(M))
#else #else
......
...@@ -384,9 +384,9 @@ sub kill { ...@@ -384,9 +384,9 @@ sub kill {
sub _collect { sub _collect {
my ($self)= @_; my ($self, $exit_code)= @_;
$self->{EXIT_STATUS}= $?; $self->{EXIT_STATUS}= $exit_code;
_verbose("_collect: $self"); _verbose("_collect: $self");
# Take the process out of running list # Take the process out of running list
...@@ -453,6 +453,7 @@ sub wait_one { ...@@ -453,6 +453,7 @@ sub wait_one {
#_verbose("blocking: $blocking, use_alarm: $use_alarm"); #_verbose("blocking: $blocking, use_alarm: $use_alarm");
my $retpid; my $retpid;
my $exit_code;
eval eval
{ {
# alarm should break the wait # alarm should break the wait
...@@ -461,6 +462,7 @@ sub wait_one { ...@@ -461,6 +462,7 @@ sub wait_one {
alarm($timeout) if $use_alarm; alarm($timeout) if $use_alarm;
$retpid= waitpid($pid, $blocking ? 0 : &WNOHANG); $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG);
$exit_code= $?;
alarm(0) if $use_alarm; alarm(0) if $use_alarm;
}; };
...@@ -492,7 +494,7 @@ sub wait_one { ...@@ -492,7 +494,7 @@ sub wait_one {
#warn "wait_one: expected pid $pid but got $retpid" #warn "wait_one: expected pid $pid but got $retpid"
# unless( $retpid == $pid ); # unless( $retpid == $pid );
$self->_collect(); $self->_collect($exit_code);
return 0; return 0;
} }
...@@ -505,6 +507,8 @@ sub wait_one { ...@@ -505,6 +507,8 @@ sub wait_one {
# #
sub wait_any { sub wait_any {
my $ret_pid; my $ret_pid;
my $exit_code;
if (IS_WIN32PERL) { if (IS_WIN32PERL) {
# Can't wait for -1 => use a polling loop # Can't wait for -1 => use a polling loop
do { do {
...@@ -514,6 +518,7 @@ sub wait_any { ...@@ -514,6 +518,7 @@ sub wait_any {
last if $pid == $ret_pid; last if $pid == $ret_pid;
} }
} while ($ret_pid == 0); } while ($ret_pid == 0);
$exit_code= $?;
} }
else else
{ {
...@@ -523,6 +528,7 @@ sub wait_any { ...@@ -523,6 +528,7 @@ sub wait_any {
print STDERR "wait_any, got invalid pid: $ret_pid\n"; print STDERR "wait_any, got invalid pid: $ret_pid\n";
return undef; return undef;
} }
$exit_code= $?;
} }
# Look it up in "running" table # Look it up in "running" table
...@@ -532,7 +538,7 @@ sub wait_any { ...@@ -532,7 +538,7 @@ sub wait_any {
print STDERR "running: ". join(", ", keys(%running)). "\n"; print STDERR "running: ". join(", ", keys(%running)). "\n";
return undef; return undef;
} }
$proc->_collect; $proc->_collect($exit_code);
return $proc; return $proc;
} }
......
...@@ -4102,7 +4102,7 @@ sub start_check_warnings ($$) { ...@@ -4102,7 +4102,7 @@ sub start_check_warnings ($$) {
error => $errfile, error => $errfile,
output => $errfile, output => $errfile,
args => \$args, args => \$args,
user_data => $errfile, user_data => [$errfile, $mysqld],
verbose => $opt_verbose, verbose => $opt_verbose,
); );
mtr_verbose("Started $proc"); mtr_verbose("Started $proc");
...@@ -4148,7 +4148,7 @@ sub check_warnings ($) { ...@@ -4148,7 +4148,7 @@ sub check_warnings ($) {
if ( delete $started{$proc->pid()} ) { if ( delete $started{$proc->pid()} ) {
# One check warning process returned # One check warning process returned
my $res= $proc->exit_status(); my $res= $proc->exit_status();
my $err_file= $proc->user_data(); my ($err_file, $mysqld)= @{$proc->user_data()};
if ( $res == 0 or $res == 62 ){ if ( $res == 0 or $res == 62 ){
...@@ -4184,7 +4184,8 @@ sub check_warnings ($) { ...@@ -4184,7 +4184,8 @@ sub check_warnings ($) {
my $report= mtr_grab_file($err_file); my $report= mtr_grab_file($err_file);
$tinfo->{comment}.= $tinfo->{comment}.=
"Could not execute 'check-warnings' for ". "Could not execute 'check-warnings' for ".
"testcase '$tname' (res: $res):\n"; "testcase '$tname' (res: $res) server: '".
$mysqld->name() .":\n";
$tinfo->{comment}.= $report; $tinfo->{comment}.= $report;
$result= 2; $result= 2;
......
...@@ -1842,13 +1842,15 @@ void st_select_lex_unit::exclude_tree() ...@@ -1842,13 +1842,15 @@ void st_select_lex_unit::exclude_tree()
void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
{ {
SELECT_LEX *next_to_last; SELECT_LEX *next_to_last;
DBUG_ASSERT(this != last);
/* /*
Mark all selects from resolved to 1 before select where was Mark all selects from resolved to 1 before select where was
found table as depended (of select where was found table) found table as depended (of select where was found table)
*/ */
for (SELECT_LEX *s= this; SELECT_LEX *s= this;
s && s != last; do
s= s->outer_select())
{ {
if (!(s->uncacheable & UNCACHEABLE_DEPENDENT)) if (!(s->uncacheable & UNCACHEABLE_DEPENDENT))
{ {
...@@ -1866,7 +1868,8 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency) ...@@ -1866,7 +1868,8 @@ void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
} }
} }
next_to_last= s; next_to_last= s;
} } while ((s= s->outer_select()) != last && s != 0);
is_correlated= TRUE; is_correlated= TRUE;
this->master_unit()->item->is_correlated= TRUE; this->master_unit()->item->is_correlated= TRUE;
if (dependency) if (dependency)
......
...@@ -2053,6 +2053,8 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) ...@@ -2053,6 +2053,8 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
ulong ret_value=0; ulong ret_value=0;
DBUG_ENTER("get_form_pos"); DBUG_ENTER("get_form_pos");
LINT_INIT(buf);
names=uint2korr(head+8); names=uint2korr(head+8);
a_length=(names+2)*sizeof(char *); /* Room for two extra */ a_length=(names+2)*sizeof(char *); /* Room for two extra */
......
...@@ -1783,7 +1783,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked) ...@@ -1783,7 +1783,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
int ha_federatedx::close(void) int ha_federatedx::close(void)
{ {
int retval, error; int retval= 0, error;
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ENTER("ha_federatedx::close"); DBUG_ENTER("ha_federatedx::close");
......
...@@ -169,6 +169,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key) ...@@ -169,6 +169,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key)
MARIA_KEY org_key; MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_delete"); DBUG_ENTER("_ma_ck_delete");
LINT_INIT_STRUCT(org_key);
save_key_data= key->data; save_key_data= key->data;
if (share->now_transactional) if (share->now_transactional)
{ {
......
...@@ -1394,6 +1394,7 @@ LSN translog_get_file_max_lsn_stored(uint32 file) ...@@ -1394,6 +1394,7 @@ LSN translog_get_file_max_lsn_stored(uint32 file)
{ {
LOGHANDLER_FILE_INFO info; LOGHANDLER_FILE_INFO info;
LINT_INIT_STRUCT(info);
File fd= open_logfile_by_number_no_cache(file); File fd= open_logfile_by_number_no_cache(file);
if ((fd < 0) || if ((fd < 0) ||
(translog_read_file_header(&info, fd) | my_close(fd, MYF(MY_WME)))) (translog_read_file_header(&info, fd) | my_close(fd, MYF(MY_WME))))
......
...@@ -45,7 +45,7 @@ static int ft_add_stopword(const char *w) ...@@ -45,7 +45,7 @@ static int ft_add_stopword(const char *w)
{ {
FT_STOPWORD sw; FT_STOPWORD sw;
return !w || 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)); (tree_insert(stopwords3, &sw, 0, stopwords3->custom_arg)==NULL));
} }
......
...@@ -735,10 +735,12 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, ...@@ -735,10 +735,12 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
} }
end=page+length-key_ref_length; end=page+length-key_ref_length;
DBUG_ASSERT(page < end);
*key='\0'; *key='\0';
length=0; length=0;
lastpos=page; lastpos=page;
while (page < end)
do
{ {
prevpos=lastpos; lastpos=page; prevpos=lastpos; lastpos=page;
last_length=length; last_length=length;
...@@ -749,7 +751,8 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, ...@@ -749,7 +751,8 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} } while (page < end);
*return_key_length=last_length; *return_key_length=last_length;
*after_key=lastpos; *after_key=lastpos;
DBUG_PRINT("exit",("returns: 0x%lx page: 0x%lx end: 0x%lx", DBUG_PRINT("exit",("returns: 0x%lx page: 0x%lx end: 0x%lx",
......
...@@ -3233,7 +3233,7 @@ btr_estimate_number_of_different_key_vals( ...@@ -3233,7 +3233,7 @@ btr_estimate_number_of_different_key_vals(
ulint matched_bytes; ulint matched_bytes;
ib_int64_t n_recs = 0; ib_int64_t n_recs = 0;
ib_int64_t* n_diff; 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 */ ullint n_sample_pages; /* number of pages to sample */
ulint not_empty_flag = 0; ulint not_empty_flag = 0;
ulint total_external_size = 0; ulint total_external_size = 0;
......
...@@ -108,7 +108,7 @@ ha_pbxt\.cc : variable.*might be clobbered by.*longjmp ...@@ -108,7 +108,7 @@ ha_pbxt\.cc : variable.*might be clobbered by.*longjmp
# #
# Yassl # Yassl
include/runtime.hpp: .*pure_error.* 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/blowfish\.cpp: array subscript is above array bounds
.*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value .*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value
.*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function .*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function
......
...@@ -75,9 +75,11 @@ report_errors(SSL* ssl) ...@@ -75,9 +75,11 @@ report_errors(SSL* ssl)
if (ssl) if (ssl)
{ {
#ifndef DBUG_OFF
int error= SSL_get_error(ssl, l); int error= SSL_get_error(ssl, l);
DBUG_PRINT("error", ("error: %s (%d)", DBUG_PRINT("error", ("error: %s (%d)",
ERR_error_string(error, buf), error)); ERR_error_string(error, buf), error));
#endif
} }
DBUG_PRINT("info", ("socket_errno: %d", socket_errno)); DBUG_PRINT("info", ("socket_errno: %d", socket_errno));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment