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; \
} 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
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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)
......
......@@ -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 */
......
......@@ -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");
......
......@@ -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)
{
......
......@@ -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))))
......
......@@ -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));
}
......
......@@ -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",
......
......@@ -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;
......
......@@ -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
......
......@@ -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));
......
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