diff options
-rw-r--r-- | include/lf.h | 23 | ||||
-rw-r--r-- | mysys/lf_alloc-pin.c | 2 | ||||
-rw-r--r-- | mysys/lf_hash.c | 2 | ||||
-rw-r--r-- | mysys/waiting_threads.c | 4 | ||||
-rw-r--r-- | storage/maria/lockman.c | 2 | ||||
-rw-r--r-- | storage/maria/trnman.c | 2 |
6 files changed, 5 insertions, 30 deletions
diff --git a/include/lf.h b/include/lf.h index 07769d10943..21cf65941ff 100644 --- a/include/lf.h +++ b/include/lf.h @@ -131,25 +131,12 @@ typedef struct { #define lf_rwunlock_by_pins(PINS) \ my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinarray.lock) -/* - compile-time assert, to require "no less than N" pins - it's enough if it'll fail on at least one compiler, so - we'll enable it on GCC only, which supports zero-length arrays. -*/ -#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG) -#define LF_REQUIRE_PINS(N) \ - static const char require_pins[LF_PINBOX_PINS-N] \ - __attribute__ ((unused)); \ - static const int LF_NUM_PINS_IN_THIS_FILE= N; +/* compile-time assert to make sure we have enough pins. */ #define _lf_pin(PINS, PIN, ADDR) \ - ( \ - assert(PIN < LF_NUM_PINS_IN_THIS_FILE), \ - my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) \ - ) -#else -#define LF_REQUIRE_PINS(N) -#define _lf_pin(PINS, PIN, ADDR) my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) -#endif + do { \ + compile_time_assert(PIN < LF_PINBOX_PINS); \ + my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)); \ + } while(0) #define _lf_unpin(PINS, PIN) _lf_pin(PINS, PIN, NULL) #define lf_pin(PINS, PIN, ADDR) \ diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 6ab6ba3aae0..88d5382947f 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -412,8 +412,6 @@ found: /* lock-free memory allocator for fixed-size objects */ -LF_REQUIRE_PINS(1) - /* callback for _lf_pinbox_real_free to free a list of unpinned objects - add it back to the allocator stack diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c index 38b212c65f0..aa96ca94198 100644 --- a/mysys/lf_hash.c +++ b/mysys/lf_hash.c @@ -27,8 +27,6 @@ #include <my_bit.h> #include <lf.h> -LF_REQUIRE_PINS(3) - /* An element of the list */ typedef struct { intptr volatile link; /* a pointer to the next element in a listand a flag */ diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c index caeba9cfa12..56125f8951e 100644 --- a/mysys/waiting_threads.c +++ b/mysys/waiting_threads.c @@ -604,8 +604,6 @@ static int deadlock_search(struct deadlock_arg *arg, WT_THD *blocker, DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, depth=%u", arg->thd->name, blocker->name, depth)); - LF_REQUIRE_PINS(1); - arg->last_locked_rc= 0; if (depth > arg->max_depth) @@ -923,8 +921,6 @@ int wt_thd_will_wait_for(WT_THD *thd, WT_THD *blocker, WT_RESOURCE *rc; DBUG_ENTER("wt_thd_will_wait_for"); - LF_REQUIRE_PINS(3); - DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, resid=%lu", thd->name, blocker->name, (ulong)resid->value)); diff --git a/storage/maria/lockman.c b/storage/maria/lockman.c index ae9e83e982a..aa030b6f57a 100644 --- a/storage/maria/lockman.c +++ b/storage/maria/lockman.c @@ -211,8 +211,6 @@ static enum lockman_getlock_result getlock_result[10][10]= #undef A #undef x -LF_REQUIRE_PINS(4) - typedef struct lockman_lock { uint64 resource; struct lockman_lock *lonext; diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 2e27d8a4dc5..ebb59677fc0 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -577,7 +577,6 @@ int trnman_can_read_from(TRN *trn, TrID trid) { TRN **found; my_bool can; - LF_REQUIRE_PINS(3); if (trid < trn->min_read_from) return 1; /* Row is visible by all transactions in the system */ @@ -618,7 +617,6 @@ int trnman_can_read_from(TRN *trn, TrID trid) TRN *trnman_trid_to_trn(TRN *trn, TrID trid) { TRN **found; - LF_REQUIRE_PINS(3); if (trid < trn->min_read_from) return 0; /* it's committed eons ago */ |