Commit d904739c authored by Michael Widenius's avatar Michael Widenius

Removed compiler warning

Disable pbxt for test cases not using pbxt (speeds up test suite)

extra/comp_err.c:
  Added cast to get rid of compiler warning
extra/libevent/kqueue.c:
  Added cast to get rid of compiler warning
mysql-test/lib/mtr_cases.pm:
  Use --skip-pbxt for test cases that doesn't need pbxt
  Collect default-storage-engine from suite.opt file (should actually be my.cnf file, but that wasn't easy to do)
mysql-test/suite/pbxt/t/suite.opt:
  Added marker for mysql-test-run.pl that this suite require pbxt
mysys/mf_keycache.c:
  Use LINT_INIT() to remove compiler warnings
mysys/my_gethostbyname.c:
  Remove compiler warnings
sql/handler.cc:
  Reset variable that may be used uninitialized
sql/item.h:
  Remove compiler warning
sql/mysqld.cc:
  Use LINT_INIT() to remove compiler warnings
sql/sql_class.h:
  Remove compiler warning
sql/sql_table.cc:
  Ensure variable is always set (to remove compiler warning)
sql/sql_view.cc:
  Use LINT_INIT() to remove compiler warnings
storage/maria/ma_loghandler.c:
  Use LINT_INIT() to remove compiler warnings
storage/myisammrg/ha_myisammrg.cc:
  Fixed wrong type to printf
storage/myisammrg/myrg_open.c:
  Use LINT_INIT() to remove compiler warnings
storage/xtradb/include/ut0lst.h:
  Trivial change of macro to remove compiler warning
strings/ctype-ucs2.c:
  Use LINT_INIT() to remove compiler warnings
strings/ctype-utf8.c:
  Use LINT_INIT() to remove compiler warnings
support-files/compiler_warnings.supp:
  Suppress some not relevant warnings
unittest/mysys/waiting_threads-t.c:
  Don't use ftruncate() as this gives warning about ignored return value
parent 639bdb28
......@@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'u':
case 'x':
case 's':
chksum= my_checksum(chksum, start, (uint) (p + 1 - start));
chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start));
start= 0; /* Not in format specifier anymore */
break;
......
......@@ -144,7 +144,7 @@ kq_init(struct event_base *base)
*/
if (kevent(kq,
kqueueop->changes, 1, kqueueop->events, NEVENT, NULL) != 1 ||
kqueueop->events[0].ident != -1 ||
((int) kqueueop->events[0].ident) != -1 ||
kqueueop->events[0].flags != EV_ERROR) {
event_warn("%s: detected broken kqueue; not using.", __func__);
free(kqueueop->changes);
......
......@@ -681,6 +681,8 @@ sub optimize_cases {
if ( $default_engine =~ /^ndb/i );
$tinfo->{'innodb_test'}= 1
if ( $default_engine =~ /^innodb/i );
$tinfo->{'pbxt_test'}= 1
if ( $default_engine =~ /^pbxt/i );
}
}
......@@ -778,6 +780,8 @@ sub collect_one_test_case {
my $disabled= shift;
my $suite_opts= shift;
my $local_default_storage_engine= $default_storage_engine;
#print "collect_one_test_case\n";
#print " suitedir: $suitedir\n";
#print " testdir: $testdir\n";
......@@ -932,15 +936,26 @@ sub collect_one_test_case {
tags_from_test_file($tinfo,"$testdir/${tname}.test");
if ( defined $default_storage_engine )
# Get default storage engine from suite.opt file
if (defined $suite_opts &&
"@$suite_opts" =~ "default-storage-engine=\s*([^\s]*)")
{
$local_default_storage_engine= $1;
}
if ( defined $local_default_storage_engine )
{
# Different default engine is used
# tag test to require that engine
$tinfo->{'ndb_test'}= 1
if ( $default_storage_engine =~ /^ndb/i );
if ( $local_default_storage_engine =~ /^ndb/i );
$tinfo->{'innodb_test'}= 1
if ( $default_storage_engine =~ /^innodb/i );
if ( $local_default_storage_engine =~ /^innodb/i );
$tinfo->{'pbxt_test'}= 1
if ( $local_default_storage_engine =~ /^pbxt/i );
}
......@@ -1103,6 +1118,28 @@ sub collect_one_test_case {
$tinfo->{template_path}= $config;
}
if ( $tinfo->{'pbxt_test'} )
{
# This is a test that needs pbxt
if ( $::mysqld_variables{'pbxt'} eq "OFF" ||
! exists $::mysqld_variables{'pbxt'} )
{
# Engine is not supported, skip it
$tinfo->{'skip'}= 1;
return $tinfo;
}
}
else
{
# Only disable engine if it's on by default (to avoid warnings about
# not existing loose options
if ( $::mysqld_variables{'pbxt'} eq "ON")
{
push(@{$tinfo->{'master_opt'}}, "--loose-skip-pbxt");
push(@{$tinfo->{'slave_opt'}}, "--loose-skip-pbxt");
}
}
if ( $tinfo->{'example_plugin_test'} )
{
if ( !$ENV{'EXAMPLE_PLUGIN'} )
......@@ -1156,6 +1193,7 @@ my @tags=
["include/have_log_bin.inc", "need_binlog", 1],
["include/have_innodb.inc", "innodb_test", 1],
["include/have_pbxt.inc", "pbxt_test", 1],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
......
--default-storage-engine=pbxt
......@@ -3924,6 +3924,12 @@ restart:
uint next_status;
uint hash_requests;
LINT_INIT(next_hash_link);
LINT_INIT(next_diskpos);
LINT_INIT(next_file);
LINT_INIT(next_status);
LINT_INIT(hash_requests);
total_found++;
found++;
KEYCACHE_DBUG_ASSERT(found <= keycache->blocks_used);
......
......@@ -91,9 +91,12 @@ extern pthread_mutex_t LOCK_gethostbyname_r;
is finished with the structure.
*/
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop)
struct hostent *
my_gethostbyname_r(const char *name,
struct hostent *result __attribute__((unused)),
char *buffer __attribute__((unused)),
int buflen__attribute__((unused)),
int *h_errnop)
{
struct hostent *hp;
pthread_mutex_lock(&LOCK_gethostbyname_r);
......
......@@ -4129,7 +4129,7 @@ int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
*/
int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
{
int result;
int result= 0;
DBUG_ENTER("handler::read_multi_range_next");
/* We should not be called after the last call returned EOF. */
......
......@@ -1077,7 +1077,8 @@ class Field_enumerator
{
public:
virtual void visit_field(Field *field)= 0;
virtual ~Field_enumerator() {}; /* purecov: inspected */
virtual ~Field_enumerator() {}; /* purecov: inspected */
Field_enumerator() {} /* Remove gcc warning */
};
......
......@@ -8323,6 +8323,8 @@ mysqld_get_one_option(int optid,
case (int) OPT_INIT_RPL_ROLE:
{
int role;
LINT_INIT(role);
if (!find_opt_type(argument, &rpl_role_typelib, opt->name, &role))
{
rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE;
......@@ -8378,6 +8380,8 @@ mysqld_get_one_option(int optid,
case OPT_BINLOG_FORMAT:
{
int id;
LINT_INIT(id);
if (!find_opt_type(argument, &binlog_format_typelib, opt->name, &id))
{
global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
......@@ -8628,6 +8632,8 @@ mysqld_get_one_option(int optid,
else
{
int type;
LINT_INIT(type);
if (!find_opt_type(argument, &delay_key_write_typelib, opt->name, &type))
delay_key_write_options= (uint) type-1;
}
......@@ -8639,6 +8645,8 @@ mysqld_get_one_option(int optid,
case OPT_TX_ISOLATION:
{
int type;
LINT_INIT(type);
if (!find_opt_type(argument, &tx_isolation_typelib, opt->name, &type))
global_system_variables.tx_isolation= (type-1);
break;
......@@ -8726,6 +8734,7 @@ mysqld_get_one_option(int optid,
ulong method_conv;
int method;
LINT_INIT(method_conv);
LINT_INIT(method);
myisam_stats_method_str= argument;
if (!find_opt_type(argument, &myisam_stats_method_typelib,
......@@ -8788,6 +8797,7 @@ mysqld_get_one_option(int optid,
case OPT_THREAD_HANDLING:
{
int id;
LINT_INIT(id);
if (!find_opt_type(argument, &thread_handling_typelib, opt->name, &id))
global_system_variables.thread_handling= id - 1;
opt_thread_handling= thread_handling_typelib.type_names[global_system_variables.thread_handling];
......
......@@ -63,6 +63,7 @@ public:
bool report_error(THD *thd);
bool is_invalidated() const { return m_invalidated; }
void reset_reprepare_observer() { m_invalidated= FALSE; }
Reprepare_observer() {} /* Remove gcc warning */
private:
bool m_invalidated;
};
......@@ -1107,6 +1108,7 @@ public:
/* Ignore error */
return TRUE;
}
Dummy_error_handler() {} /* Remove gcc warning */
};
......
......@@ -5668,6 +5668,10 @@ compare_tables(TABLE *table,
*/
Alter_info tmp_alter_info(*alter_info, thd->mem_root);
uint db_options= 0; /* not used */
/* Set default value for return value (to ensure it's always set) */
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
/* Create the prepared information. */
if (mysql_prepare_create_table(thd, create_info,
&tmp_alter_info,
......@@ -5726,7 +5730,6 @@ compare_tables(TABLE *table,
(table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar))
{
DBUG_PRINT("info", ("Basic checks -> ALTER_TABLE_DATA_CHANGED"));
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
DBUG_RETURN(0);
}
......@@ -5756,7 +5759,6 @@ compare_tables(TABLE *table,
{
DBUG_PRINT("info", ("NULL behaviour difference in field '%s' -> "
"ALTER_TABLE_DATA_CHANGED", new_field->field_name));
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
DBUG_RETURN(0);
}
......@@ -5779,7 +5781,6 @@ compare_tables(TABLE *table,
{
DBUG_PRINT("info", ("!field_is_equal('%s') -> ALTER_TABLE_DATA_CHANGED",
new_field->field_name));
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
DBUG_RETURN(0);
}
// Clear indexed marker
......@@ -5914,7 +5915,6 @@ compare_tables(TABLE *table,
{
DBUG_PRINT("info", ("check_if_incompatible_data() -> "
"ALTER_TABLE_DATA_CHANGED"));
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
DBUG_RETURN(0);
}
......
......@@ -1034,10 +1034,12 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
bool parse_status;
bool result, view_is_mergeable;
TABLE_LIST *UNINIT_VAR(view_main_select_tables);
DBUG_ENTER("mysql_make_view");
DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
LINT_INIT(parse_status);
LINT_INIT(view_select);
if (table->view)
{
/*
......
......@@ -1211,6 +1211,8 @@ static my_bool translog_set_lsn_for_files(uint32 from_file, uint32 to_file,
for (file= from_file; file <= to_file; file++)
{
LOGHANDLER_FILE_INFO info;
LINT_INIT(info.max_lsn);
File fd= open_logfile_by_number_no_cache(file);
if ((fd < 0) ||
((translog_read_file_header(&info, fd) ||
......@@ -3845,6 +3847,8 @@ my_bool translog_init_with_table(const char *directory,
if (!old_log_was_recovered && old_flags == flags)
{
LOGHANDLER_FILE_INFO info;
LINT_INIT(info.maria_version);
/*
Accessing &log_descriptor.open_files without mutex is safe
because it is initialization
......
......@@ -382,7 +382,7 @@ static MI_INFO *myisammrg_attach_children_callback(void *callback_param)
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
}
DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx my_errno: %d",
my_errno ? NULL : (long) myisam, my_errno));
my_errno ? 0L : (long) myisam, my_errno));
err:
DBUG_RETURN(my_errno ? NULL : myisam);
......
......@@ -239,6 +239,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
rc= 1;
errpos= 0;
bzero((char*) &file_cache, sizeof(file_cache));
LINT_INIT(m_info);
/* Open MERGE meta file. */
if ((fd= my_open(fn_format(parent_name_buff, parent_name, "", MYRG_NAME_EXT,
......
......@@ -158,7 +158,7 @@ Inserts a NODE2 after NODE1 in a list.
/** Invalidate the pointers in a list node.
@param NAME list name
@param N pointer to the node that was removed */
# define UT_LIST_REMOVE_CLEAR(NAME, N) while (0)
# define UT_LIST_REMOVE_CLEAR(NAME, N) {} while (0)
#endif
/*******************************************************************//**
......
......@@ -203,7 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
my_wc_t UNINIT_VAR(s_wc),t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
......@@ -317,7 +317,7 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
const char *s, const char *t, size_t len)
{
int s_res,t_res;
my_wc_t UNINIT_VAR(s_wc),t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const char *se=s+len;
const char *te=t+len;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
......@@ -1384,7 +1384,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
my_wc_t UNINIT_VAR(s_wc),t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
......
......@@ -2310,7 +2310,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
my_bool t_is_prefix)
{
int s_res,t_res;
my_wc_t UNINIT_VAR(s_wc), t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
......@@ -2380,7 +2380,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
my_bool diff_if_only_endspace_difference)
{
int s_res, t_res, res;
my_wc_t UNINIT_VAR(s_wc),t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se= s+slen, *te= t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
......
......@@ -71,6 +71,11 @@ db_vrfy.c : .*comparison is always false due to limited range of data type.*
#
.*: break strict-aliasing rules
#
# Ignore not important declaration warnings
#
.*: only defines private constructors and has no friends
#
# Ignore all conversion warnings on windows 64
# (Is safe as we are not yet supporting strings >= 2G)
......@@ -105,6 +110,11 @@ db_vrfy.c : .*comparison is always false due to limited range of data type.*
#
storage/maria/ma_pagecache.c: .*'info_check_pin' defined but not used
#
# Pbxt
#
xaction_xt\.cc: may be used uninitialized in this function
#
# I think these are due to mix of C and C++.
#
......@@ -118,6 +128,7 @@ include/runtime.hpp: .*pure_error.*
.*/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
mySTL/algorithm\.hpp: is used uninitialized in this function
#
# Groff warnings on OpenSUSE.
......
......@@ -258,7 +258,7 @@ void do_tests()
#define test_kill_strategy(X) \
diag("kill strategy: " #X); \
DBUG_EXECUTE("reset_file", \
{ rewind(DBUG_FILE); (void) ftruncate(fileno(DBUG_FILE), 0); }); \
{ rewind(DBUG_FILE); my_chsize(fileno(DBUG_FILE), 0, 0, MYF(MY_WME)); }); \
DBUG_PRINT("info", ("kill strategy: " #X)); \
kill_strategy=X; \
do_one_test();
......
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