Commit 69fe020f authored by Michael Widenius's avatar Michael Widenius

Fixed bugs found by buildbot:

- Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables.
- Fixed compiler warnings
- Added a name for each thr_lock to get better error messages (This is needed to find out why 'archive.test' sometimes fails)


BUILD/SETUP.sh:
  Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables.
BUILD/build_mccge.sh:
  Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables.
client/mysqltest.cc:
  Fixed bug in remove_files_wildcards (the orignal code never removed anything)
extra/libevent/devpoll.c:
  Fixed compiler warning
include/thr_lock.h:
  Added a name for each thr_lock to get better error messages.
mysql-test/suite/maria/t/maria3.test:
  Speed up test.
mysys/thr_lock.c:
  Added a name for each thr_lock to get better error messages.
  Added a second 'check_locks' to find if something goes wrong in 'wake_up_waiters'.
sql/lock.cc:
  Added a name for each thr_lock to get better error messages.
storage/xtradb/fil/fil0fil.c:
  Fixed compiler warning
parent 26565ae1
......@@ -98,7 +98,7 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings
warnings="-Wall -Wextra -Wunused -Wwrite-strings"
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized"
# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"
......@@ -112,7 +112,7 @@ if [ "x$warning_mode" != "xpedantic" ]; then
# Added unless --with-debug=full
debug_extra_cflags="-O0 -g3 -gdwarf-2"
else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -Wno-uninitialized -D_POSIX_SOURCE"
c_warnings="$warnings"
cxx_warnings="$warnings -std=c++98"
# NOTE: warning mode should not influence optimize/debug mode.
......@@ -127,12 +127,14 @@ fi
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
valgrind_flags="-DHAVE_valgrind -USAFEMALLOC"
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind"
#
# Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG"
debug_cflags="$debug_cflags -DFORCE_INIT_OF_VARS -Wuninitialized"
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
error_inject="--with-error-inject "
#
......
......@@ -1063,7 +1063,7 @@ set_warning_flags()
warnings="$warnings -Wcomment -W"
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label"
warnings="$warnings -Wunused-value -Wunused-variable"
warnings="$warnings -Wunused-value -Wunused-variable -Wno-uninitialized"
if test "x$warning_mode" = "extra" ; then
warnings="$warnings -Wshadow"
......@@ -1094,7 +1094,8 @@ set_with_debug_flags()
{
if test "x$with_debug_flag" = "xyes" ; then
if test "x$developer_flag" = "xyes" ; then
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG"
loc_debug_flags="$loc_debug_flags -Wuninitialized -DFORCE_INIT_OF_VARS"
loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
compiler_flags="$compiler_flags $loc_debug_flags"
fi
......
......@@ -3071,8 +3071,7 @@ void do_remove_files_wildcard(struct st_command *command)
if (ds_wild.length &&
wild_compare(file->name, ds_wild.str, 0))
continue;
ds_file_to_remove.length= ds_directory.length + 1;
ds_file_to_remove.str[ds_directory.length + 1]= 0;
ds_file_to_remove.length= ds_directory.length;
dynstr_append(&ds_file_to_remove, file->name);
DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str));
if ((error= (my_delete(ds_file_to_remove.str, MYF(MY_WME)) != 0)))
......
......@@ -185,7 +185,7 @@ devpoll_init(struct event_base *base)
}
static int
devpoll_recalc(struct event_base *base, void *arg, int max)
devpoll_recalc(struct event_base *base __attribute__((unused)), void *arg, int max)
{
struct devpollop *devpollop = arg;
......
......@@ -123,7 +123,7 @@ typedef struct st_thr_lock_data {
struct st_thr_lock *lock;
pthread_cond_t *cond;
void *status_param; /* Param to status functions */
void *debug_print_param;
void *debug_print_param; /* Used by MariaDB for TABLE ref */
enum thr_lock_type type;
uint priority;
} THR_LOCK_DATA;
......@@ -149,6 +149,7 @@ typedef struct st_thr_lock {
my_bool (*start_trans)(void*); /* When all locks are taken */
my_bool (*check_status)(void *);
void (*fix_status)(void *, void *);/* For thr_merge_locks() */
const char *name; /* Used for error reporting */
my_bool allow_multiple_concurrent_insert;
} THR_LOCK;
......
......@@ -172,11 +172,13 @@ create table t1 (a bigint auto_increment, primary key(a), b char(255), c varchar
let $1=1000;
--disable_query_log
--disable_warnings
lock tables t1 write;
while ($1)
{
insert into t1 () values();
dec $1;
}
unlock tables;
--enable_query_log
update t1 set b=repeat('a',100) where a between 1 and 100;
check table t1;
......
......@@ -488,6 +488,21 @@
fun:_ZL13plugin_dl_delPK19st_mysql_lex_string
}
{
dlsym memory loss from plugin on SuSE 11.1 x64
Memcheck:Leak
fun:*alloc
obj:/lib*/ld-*.so
obj:/lib*/ld-*.so
obj:/lib*/ld-*.so
obj:/lib*/libc-*.so
obj:/lib*/libdl-*.so
obj:/lib*/ld-*.so
obj:/lib*/libdl-*.so
fun:dlsym
fun:*plugin_dl_add*
}
{
dlopen / ptread_cancel_init memory loss on Suse Linux 10.3 32/64 bit ver 1
Memcheck:Leak
......
......@@ -182,8 +182,10 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
last_lock_type != TL_WRITE_CONCURRENT_INSERT)
{
fprintf(stderr,
"Warning: Found locks from different threads in %s at '%s'. org_lock_type: %d last_lock_type: %d new_lock_type: %d\n",
lock_type, where, list->data->type, last_lock_type, data->type);
"Warning: Found locks from different threads for lock '%s' in '%s' at '%s'. org_lock_type: %d last_lock_type: %d new_lock_type: %d\n",
data->lock->name ? data->lock->name : "",
lock_type, where, list->data->type, last_lock_type,
data->type);
return 1;
}
if (no_cond && data->cond)
......@@ -405,6 +407,7 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, void *param)
data->status_param=param;
data->cond=0;
data->priority= 0;
data->debug_print_param= 0;
}
......@@ -879,6 +882,7 @@ void thr_unlock(THR_LOCK_DATA *data, uint unlock_flags)
data->type=TL_UNLOCK; /* Mark unlocked */
check_locks(lock,"after releasing lock",1);
wake_up_waiters(lock);
check_locks(lock,"end of thr_unlock",1);
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
}
......
......@@ -923,7 +923,10 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*to++= table;
if (locks)
for ( ; org_locks != locks ; org_locks++)
{
(*org_locks)->debug_print_param= (void *) table;
(*org_locks)->lock->name= table->alias;
}
}
/*
We do not use 'tables', because there are cases where store_lock()
......
......@@ -3313,7 +3313,7 @@ skip_info:
}
if (page_is_corrupt) {
fprintf(stderr, " [errp:%lld]", offset / UNIV_PAGE_SIZE);
fprintf(stderr, " [errp:%ld]", (long) (offset / UNIV_PAGE_SIZE));
/* cannot treat corrupt page */
goto skip_write;
......
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