Commit 08debc00 authored by osku's avatar osku

Add (void*) casts when using the %p printf format specifier.

When using GCC, use __inline__ instead of inline.

Add disabled-by-default logic to configure.in to switch GCC to a strict
C89-mode.
parent 33961d88
......@@ -881,10 +881,10 @@ buf_LRU_block_remove_hashed_page(
if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n",
buf_page_hash_get(block->space, block->offset),
(void*) buf_page_hash_get(block->space, block->offset),
(ulong) buf_page_hash_get(block->space, block->offset)->space,
(ulong) buf_page_hash_get(block->space, block->offset)->offset,
block);
(void*) block);
}
#ifdef UNIV_DEBUG
......
......@@ -89,6 +89,19 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS -DDEBUG_OFF"
fi
# NOTE: The flags below are disabled by default since we can't easily get
# rid of the "string over 509 characters in length" warnings, and thus can't
# add -Werror. But it's a good idea to enable these for a test compile
# before shipping a new snapshot to MySQL to catch errors that could make
# the compile fail on non-C99 compilers.
# If using gcc, disallow usage of C99 features to avoid accidentally
# introducing problems on compilers that only implement C89.
#if test "$ac_cv_prog_gcc" = "yes"
#then
# CFLAGS="$CFLAGS -std=c89 -ansi -pedantic -Wno-long-long"
#fi
case "$target_os" in
lin*)
CFLAGS="$CFLAGS -DUNIV_LINUX";;
......
......@@ -122,7 +122,7 @@ by one. */
#ifdef __WIN__
#define UNIV_INLINE __inline
#else
#define UNIV_INLINE static inline
#define UNIV_INLINE static __inline__
#endif
#else
......
......@@ -445,7 +445,7 @@ mem_heap_validate_or_print(
&& (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
fprintf(stderr,
"InnoDB: Error: mem block %p length %lu > UNIV_PAGE_SIZE\n", block,
"InnoDB: Error: mem block %p length %lu > UNIV_PAGE_SIZE\n", (void*) block,
(ulong) mem_block_get_len(block));
/* error */
......
......@@ -641,7 +641,7 @@ os_fast_mutex_free(
" InnoDB: error: return value %lu when calling\n"
"InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
fprintf(stderr,
"InnoDB: Byte contents of the pthread mutex at %p:\n", fast_mutex);
"InnoDB: Byte contents of the pthread mutex at %p:\n", (void*) fast_mutex);
ut_print_buf(stderr, fast_mutex, sizeof(os_fast_mutex_t));
fprintf(stderr, "\n");
}
......
......@@ -524,7 +524,7 @@ sync_array_cell_print(
"Last time reserved in file %s line %lu, "
#endif /* UNIV_SYNC_DEBUG */
"waiters flag %lu\n",
mutex, mutex->cfile_name, (ulong) mutex->cline,
(void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
(ulong) mutex->lock_word,
#ifdef UNIV_SYNC_DEBUG
mutex->file_name, (ulong) mutex->line,
......@@ -539,7 +539,7 @@ sync_array_cell_print(
fprintf(file,
" RW-latch at %p created in file %s line %lu\n",
rwlock, rwlock->cfile_name,
(void*) rwlock, rwlock->cfile_name,
(ulong) rwlock->cline);
if (rwlock->writer != RW_LOCK_NOT_LOCKED) {
fprintf(file,
......@@ -703,7 +703,7 @@ sync_array_detect_deadlock(
if (ret) {
fprintf(stderr,
"Mutex %p owned by thread %lu file %s line %lu\n",
mutex,
(void*) mutex,
(ulong) os_thread_pf(mutex->thread_id),
mutex->file_name, (ulong) mutex->line);
sync_array_cell_print(stderr, cell);
......@@ -740,7 +740,8 @@ sync_array_detect_deadlock(
thread, debug->pass, depth);
if (ret) {
print:
fprintf(stderr, "rw-lock %p ", lock);
fprintf(stderr, "rw-lock %p ",
(void*) lock);
sync_array_cell_print(stderr, cell);
rw_lock_debug_print(debug);
return(TRUE);
......
......@@ -246,7 +246,7 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
"Thread %lu spin wait rw-s-lock at %p cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), lock,
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
......@@ -277,7 +277,8 @@ lock_loop:
fprintf(stderr,
"Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()),
lock, lock->cfile_name, (ulong) lock->cline);
(void*) lock, lock->cfile_name,
(ulong) lock->cline);
}
rw_s_system_call_count++;
......@@ -495,7 +496,7 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
"Thread %lu spin wait rw-x-lock at %p cfile %s cline %lu rnds %lu\n",
os_thread_pf(os_thread_get_curr_id()), lock,
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
......@@ -528,7 +529,7 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
"Thread %lu OS wait for rw-x-lock at %p cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()), lock,
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline);
}
......@@ -787,7 +788,7 @@ rw_lock_list_print_info(void)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
fprintf(stderr, "RW-LOCK: %p ", lock);
fprintf(stderr, "RW-LOCK: %p ", (void*) lock);
if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", stderr);
......@@ -823,7 +824,7 @@ rw_lock_print(
fprintf(stderr,
"-------------\n"
"RW-LATCH INFO\n"
"RW-LATCH: %p ", lock);
"RW-LATCH: %p ", (void*) lock);
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)
......
......@@ -423,7 +423,7 @@ spin_loop:
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
"Thread %lu spin wait mutex at %p cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), mutex,
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
#endif
......@@ -485,7 +485,7 @@ spin_loop:
fprintf(stderr, "Thread %lu spin wait succeeds at 2:"
" mutex at %p\n",
(ulong) os_thread_pf(os_thread_get_curr_id()),
mutex);
(void*) mutex);
#endif
goto finish_timing;
......@@ -503,7 +503,7 @@ spin_loop:
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
"Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), mutex,
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
#endif
......@@ -666,7 +666,7 @@ mutex_list_print_info(void)
&thread_id);
fprintf(stderr,
"Locked mutex: addr %p thread %ld file %s line %ld\n",
mutex, os_thread_pf(thread_id),
(void*) mutex, os_thread_pf(thread_id),
file_name, line);
}
......@@ -852,10 +852,10 @@ sync_thread_levels_g(
fprintf(stderr,
"InnoDB: Locked mutex: addr %p thread %ld file %s line %ld\n",
mutex, os_thread_pf(thread_id), file_name, (ulong) line);
(void*) mutex, os_thread_pf(thread_id), file_name, (ulong) line);
#else /* UNIV_SYNC_DEBUG */
fprintf(stderr,
"InnoDB: Locked mutex: addr %p\n", mutex);
"InnoDB: Locked mutex: addr %p\n", (void*) mutex);
#endif /* UNIV_SYNC_DEBUG */
} else {
fputs("Not locked\n", stderr);
......
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