Commit 8338bff3 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Fixed compiler warnings on various platforms

parent 3e4480f5
...@@ -18,15 +18,16 @@ Created 1/20/1994 Heikki Tuuri ...@@ -18,15 +18,16 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t; typedef time_t ib_time_t;
#ifdef HAVE_PAUSE_INSTRUCTION #ifdef HAVE_PAUSE_INSTRUCTION
#define PAUSE_INSTRUCTION(volatile_var) {__asm__ __volatile__ ("pause");} #define PAUSE_INSTRUCTION() {__asm__ __volatile__ ("pause");}
#else #else
#ifdef UNIV_SYNC_ATOMIC #ifdef UNIV_SYNC_ATOMIC
#define PAUSE_INSTRUCTION(volatile_var) \ #define PAUSE_INSTRUCTION() \
{ \ { \
volatile lint volatile_var;
os_compare_and_swap(volatile_var, 0, 1); \ os_compare_and_swap(volatile_var, 0, 1); \
} }
#else #else
#define PAUSE_INSTRUCTION(volatile_var) #define PAUSE_INSTRUCTION()
#endif #endif
#endif #endif
......
...@@ -1063,6 +1063,7 @@ ulong srv_max_purge_lag = 0; ...@@ -1063,6 +1063,7 @@ ulong srv_max_purge_lag = 0;
Puts an OS thread to wait if there are too many concurrent threads Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
#ifdef UNIV_SYNC_ATOMIC
static void static void
inc_srv_conc_n_threads(lint *n_threads) inc_srv_conc_n_threads(lint *n_threads)
{ {
...@@ -1074,6 +1075,7 @@ dec_srv_conc_n_threads() ...@@ -1074,6 +1075,7 @@ dec_srv_conc_n_threads()
{ {
os_atomic_increment(&srv_conc_n_threads, -1); os_atomic_increment(&srv_conc_n_threads, -1);
} }
#endif
static void static void
print_already_in_error(trx_t* trx) print_already_in_error(trx_t* trx)
...@@ -1087,6 +1089,7 @@ print_already_in_error(trx_t* trx) ...@@ -1087,6 +1089,7 @@ print_already_in_error(trx_t* trx)
return; return;
} }
#ifdef UNIV_SYNC_ATOMIC
static void static void
enter_innodb_with_tickets(trx_t* trx) enter_innodb_with_tickets(trx_t* trx)
{ {
...@@ -1108,7 +1111,7 @@ srv_conc_enter_innodb_timer_based(trx_t* trx) ...@@ -1108,7 +1111,7 @@ srv_conc_enter_innodb_timer_based(trx_t* trx)
retry: retry:
if (srv_conc_n_threads < (lint) srv_thread_concurrency) { if (srv_conc_n_threads < (lint) srv_thread_concurrency) {
inc_srv_conc_n_threads(&conc_n_threads); inc_srv_conc_n_threads(&conc_n_threads);
if (conc_n_threads <= srv_thread_concurrency) { if (conc_n_threads <= (lint) srv_thread_concurrency) {
enter_innodb_with_tickets(trx); enter_innodb_with_tickets(trx);
return; return;
} }
...@@ -1147,6 +1150,7 @@ srv_conc_exit_innodb_timer_based(trx_t* trx) ...@@ -1147,6 +1150,7 @@ srv_conc_exit_innodb_timer_based(trx_t* trx)
trx->n_tickets_to_enter_innodb = 0; trx->n_tickets_to_enter_innodb = 0;
return; return;
} }
#endif
void void
srv_conc_enter_innodb( srv_conc_enter_innodb(
...@@ -1315,7 +1319,6 @@ srv_conc_force_enter_innodb( ...@@ -1315,7 +1319,6 @@ srv_conc_force_enter_innodb(
trx_t* trx) /* in: transaction object associated with the trx_t* trx) /* in: transaction object associated with the
thread */ thread */
{ {
lint conc_n_threads;
if (UNIV_LIKELY(!srv_thread_concurrency)) { if (UNIV_LIKELY(!srv_thread_concurrency)) {
...@@ -1324,6 +1327,8 @@ srv_conc_force_enter_innodb( ...@@ -1324,6 +1327,8 @@ srv_conc_force_enter_innodb(
#ifdef UNIV_SYNC_ATOMIC #ifdef UNIV_SYNC_ATOMIC
if (srv_thread_concurrency_timer_based) { if (srv_thread_concurrency_timer_based) {
lint conc_n_threads;
inc_srv_conc_n_threads(&conc_n_threads); inc_srv_conc_n_threads(&conc_n_threads);
trx->declared_to_be_inside_innodb = TRUE; trx->declared_to_be_inside_innodb = TRUE;
trx->n_tickets_to_enter_innodb = 1; trx->n_tickets_to_enter_innodb = 1;
......
...@@ -336,13 +336,12 @@ ut_delay( ...@@ -336,13 +336,12 @@ ut_delay(
ulint delay) /* in: delay in microseconds on 100 MHz Pentium */ ulint delay) /* in: delay in microseconds on 100 MHz Pentium */
{ {
ulint i, j; ulint i, j;
volatile lint volatile_var;
j = 0; j = 0;
for (i = 0; i < delay * 50; i++) { for (i = 0; i < delay * 50; i++) {
PAUSE_INSTRUCTION();
j += i; j += i;
PAUSE_INSTRUCTION(&volatile_var);
} }
if (ut_always_false) { if (ut_always_false) {
......
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