Commit 04a6b957 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 2a574b90
...@@ -881,10 +881,10 @@ buf_LRU_block_remove_hashed_page( ...@@ -881,10 +881,10 @@ buf_LRU_block_remove_hashed_page(
if (buf_page_hash_get(block->space, block->offset)) { if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n", "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)->space,
(ulong) buf_page_hash_get(block->space, block->offset)->offset, (ulong) buf_page_hash_get(block->space, block->offset)->offset,
block); (void*) block);
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
......
...@@ -89,6 +89,19 @@ else ...@@ -89,6 +89,19 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS -DDEBUG_OFF" CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS -DDEBUG_OFF"
fi 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 case "$target_os" in
lin*) lin*)
CFLAGS="$CFLAGS -DUNIV_LINUX";; CFLAGS="$CFLAGS -DUNIV_LINUX";;
......
...@@ -122,7 +122,7 @@ by one. */ ...@@ -122,7 +122,7 @@ by one. */
#ifdef __WIN__ #ifdef __WIN__
#define UNIV_INLINE __inline #define UNIV_INLINE __inline
#else #else
#define UNIV_INLINE static inline #define UNIV_INLINE static __inline__
#endif #endif
#else #else
......
...@@ -445,7 +445,7 @@ mem_heap_validate_or_print( ...@@ -445,7 +445,7 @@ mem_heap_validate_or_print(
&& (mem_block_get_len(block) > UNIV_PAGE_SIZE)) { && (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
fprintf(stderr, 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)); (ulong) mem_block_get_len(block));
/* error */ /* error */
......
...@@ -641,7 +641,7 @@ os_fast_mutex_free( ...@@ -641,7 +641,7 @@ os_fast_mutex_free(
" InnoDB: error: return value %lu when calling\n" " InnoDB: error: return value %lu when calling\n"
"InnoDB: pthread_mutex_destroy().\n", (ulint)ret); "InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
fprintf(stderr, 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)); ut_print_buf(stderr, fast_mutex, sizeof(os_fast_mutex_t));
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
......
...@@ -524,7 +524,7 @@ sync_array_cell_print( ...@@ -524,7 +524,7 @@ sync_array_cell_print(
"Last time reserved in file %s line %lu, " "Last time reserved in file %s line %lu, "
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
"waiters flag %lu\n", "waiters flag %lu\n",
mutex, mutex->cfile_name, (ulong) mutex->cline, (void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
(ulong) mutex->lock_word, (ulong) mutex->lock_word,
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
mutex->file_name, (ulong) mutex->line, mutex->file_name, (ulong) mutex->line,
...@@ -539,7 +539,7 @@ sync_array_cell_print( ...@@ -539,7 +539,7 @@ sync_array_cell_print(
fprintf(file, fprintf(file,
" RW-latch at %p created in file %s line %lu\n", " RW-latch at %p created in file %s line %lu\n",
rwlock, rwlock->cfile_name, (void*) rwlock, rwlock->cfile_name,
(ulong) rwlock->cline); (ulong) rwlock->cline);
if (rwlock->writer != RW_LOCK_NOT_LOCKED) { if (rwlock->writer != RW_LOCK_NOT_LOCKED) {
fprintf(file, fprintf(file,
...@@ -703,7 +703,7 @@ sync_array_detect_deadlock( ...@@ -703,7 +703,7 @@ sync_array_detect_deadlock(
if (ret) { if (ret) {
fprintf(stderr, fprintf(stderr,
"Mutex %p owned by thread %lu file %s line %lu\n", "Mutex %p owned by thread %lu file %s line %lu\n",
mutex, (void*) mutex,
(ulong) os_thread_pf(mutex->thread_id), (ulong) os_thread_pf(mutex->thread_id),
mutex->file_name, (ulong) mutex->line); mutex->file_name, (ulong) mutex->line);
sync_array_cell_print(stderr, cell); sync_array_cell_print(stderr, cell);
...@@ -740,7 +740,8 @@ sync_array_detect_deadlock( ...@@ -740,7 +740,8 @@ sync_array_detect_deadlock(
thread, debug->pass, depth); thread, debug->pass, depth);
if (ret) { if (ret) {
print: print:
fprintf(stderr, "rw-lock %p ", lock); fprintf(stderr, "rw-lock %p ",
(void*) lock);
sync_array_cell_print(stderr, cell); sync_array_cell_print(stderr, cell);
rw_lock_debug_print(debug); rw_lock_debug_print(debug);
return(TRUE); return(TRUE);
......
...@@ -246,7 +246,7 @@ lock_loop: ...@@ -246,7 +246,7 @@ lock_loop:
if (srv_print_latch_waits) { if (srv_print_latch_waits) {
fprintf(stderr, fprintf(stderr,
"Thread %lu spin wait rw-s-lock at %p cfile %s cline %lu rnds %lu\n", "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); lock->cfile_name, (ulong) lock->cline, (ulong) i);
} }
...@@ -277,7 +277,8 @@ lock_loop: ...@@ -277,7 +277,8 @@ lock_loop:
fprintf(stderr, fprintf(stderr,
"Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n", "Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()), 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++; rw_s_system_call_count++;
...@@ -495,8 +496,8 @@ lock_loop: ...@@ -495,8 +496,8 @@ lock_loop:
if (srv_print_latch_waits) { if (srv_print_latch_waits) {
fprintf(stderr, fprintf(stderr,
"Thread %lu spin wait rw-x-lock at %p cfile %s cline %lu rnds %lu\n", "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); lock->cfile_name, (ulong) lock->cline, (ulong) i);
} }
rw_x_spin_wait_count++; rw_x_spin_wait_count++;
...@@ -528,8 +529,8 @@ lock_loop: ...@@ -528,8 +529,8 @@ lock_loop:
if (srv_print_latch_waits) { if (srv_print_latch_waits) {
fprintf(stderr, fprintf(stderr,
"Thread %lu OS wait for rw-x-lock at %p cfile %s cline %lu\n", "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); lock->cfile_name, (ulong) lock->cline);
} }
rw_x_system_call_count++; rw_x_system_call_count++;
...@@ -787,7 +788,7 @@ rw_lock_list_print_info(void) ...@@ -787,7 +788,7 @@ rw_lock_list_print_info(void)
|| (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(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)) { if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", stderr); fputs(" Waiters for the lock exist\n", stderr);
...@@ -823,7 +824,7 @@ rw_lock_print( ...@@ -823,7 +824,7 @@ rw_lock_print(
fprintf(stderr, fprintf(stderr,
"-------------\n" "-------------\n"
"RW-LATCH INFO\n" "RW-LATCH INFO\n"
"RW-LATCH: %p ", lock); "RW-LATCH: %p ", (void*) lock);
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED) if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0) || (rw_lock_get_reader_count(lock) != 0)
......
...@@ -423,7 +423,7 @@ spin_loop: ...@@ -423,7 +423,7 @@ spin_loop:
#ifdef UNIV_SRV_PRINT_LATCH_WAITS #ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr, fprintf(stderr,
"Thread %lu spin wait mutex at %p cfile %s cline %lu rnds %lu\n", "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); mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
#endif #endif
...@@ -485,7 +485,7 @@ spin_loop: ...@@ -485,7 +485,7 @@ spin_loop:
fprintf(stderr, "Thread %lu spin wait succeeds at 2:" fprintf(stderr, "Thread %lu spin wait succeeds at 2:"
" mutex at %p\n", " mutex at %p\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) os_thread_pf(os_thread_get_curr_id()),
mutex); (void*) mutex);
#endif #endif
goto finish_timing; goto finish_timing;
...@@ -503,7 +503,7 @@ spin_loop: ...@@ -503,7 +503,7 @@ spin_loop:
#ifdef UNIV_SRV_PRINT_LATCH_WAITS #ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr, fprintf(stderr,
"Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n", "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); mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
#endif #endif
...@@ -666,7 +666,7 @@ mutex_list_print_info(void) ...@@ -666,7 +666,7 @@ mutex_list_print_info(void)
&thread_id); &thread_id);
fprintf(stderr, fprintf(stderr,
"Locked mutex: addr %p thread %ld file %s line %ld\n", "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); file_name, line);
} }
...@@ -852,10 +852,10 @@ sync_thread_levels_g( ...@@ -852,10 +852,10 @@ sync_thread_levels_g(
fprintf(stderr, fprintf(stderr,
"InnoDB: Locked mutex: addr %p thread %ld file %s line %ld\n", "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 */ #else /* UNIV_SYNC_DEBUG */
fprintf(stderr, fprintf(stderr,
"InnoDB: Locked mutex: addr %p\n", mutex); "InnoDB: Locked mutex: addr %p\n", (void*) mutex);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
} else { } else {
fputs("Not locked\n", stderr); 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