Commit 3dc3f2a8 authored by marko's avatar marko

Replace assertions on constant conditions with preprocessor conditions.

parent 9ba96ba0
......@@ -563,7 +563,9 @@ dtuple_convert_big_rec(
/* We do not store externally fields which are smaller than
DICT_MAX_INDEX_COL_LEN */
ut_a(DICT_MAX_INDEX_COL_LEN > REC_1BYTE_OFFS_LIMIT);
#if DICT_MAX_INDEX_COL_LEN <= REC_1BYTE_OFFS_LIMIT
# error "DICT_MAX_INDEX_COL_LEN <= REC_1BYTE_OFFS_LIMIT"
#endif
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
+ DICT_MAX_INDEX_COL_LEN) {
......
......@@ -1790,9 +1790,15 @@ dict_index_build_internal_clust(
trx_id_pos = new_index->n_def;
ut_ad(DATA_ROW_ID == 0);
ut_ad(DATA_TRX_ID == 1);
ut_ad(DATA_ROLL_PTR == 2);
#if DATA_ROW_ID != 0
# error "DATA_ROW_ID != 0"
#endif
#if DATA_TRX_ID != 1
# error "DATA_TRX_ID != 1"
#endif
#if DATA_ROLL_PTR != 2
# error "DATA_ROLL_PTR != 2"
#endif
if (!(index->type & DICT_UNIQUE)) {
dict_index_add_col(new_index,
......
......@@ -610,8 +610,10 @@ xdes_calc_descriptor_page(
/* out: descriptor page offset */
ulint offset) /* in: page offset */
{
ut_ad(UNIV_PAGE_SIZE > XDES_ARR_OFFSET
+ (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE) * XDES_SIZE);
#if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
+ (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE) * XDES_SIZE
# error
#endif
return(ut_2pow_round(offset, XDES_DESCRIBED_PER_PAGE));
}
......@@ -1279,7 +1281,9 @@ fsp_fill_free_list(
mtr);
xdes_init(descr, mtr);
ut_ad(XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE == 0);
#if XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE
# error "XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE != 0"
#endif
if (0 == i % XDES_DESCRIBED_PER_PAGE) {
......
......@@ -630,7 +630,9 @@ ibuf_bitmap_page_get_bits(
ulint value;
ut_ad(bit < IBUF_BITS_PER_PAGE);
ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
#if IBUF_BITS_PER_PAGE % 2
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
......@@ -672,7 +674,9 @@ ibuf_bitmap_page_set_bits(
ulint map_byte;
ut_ad(bit < IBUF_BITS_PER_PAGE);
ut_ad(IBUF_BITS_PER_PAGE % 2 == 0);
#if IBUF_BITS_PER_PAGE % 2
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_IBUF_DEBUG
......
......@@ -50,7 +50,9 @@ dict_sys_read_row_id(
/* out: row id */
byte* field) /* in: record field */
{
ut_ad(DATA_ROW_ID_LEN == 6);
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
#endif
return(mach_read_from_6(field));
}
......@@ -64,7 +66,9 @@ dict_sys_write_row_id(
byte* field, /* in: record field */
dulint row_id) /* in: row id */
{
ut_ad(DATA_ROW_ID_LEN == 6);
#if DATA_ROW_ID_LEN != 6
# error "DATA_ROW_ID_LEN != 6"
#endif
mach_write_to_6(field, row_id);
}
......
......@@ -106,7 +106,9 @@ dyn_array_create(
size sizeof(dyn_array_t) */
{
ut_ad(arr);
ut_ad(DYN_ARRAY_DATA_SIZE < DYN_BLOCK_FULL_FLAG);
#if DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG
# error "DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG"
#endif
arr->heap = NULL;
arr->used = 0;
......
......@@ -206,8 +206,9 @@ ibuf_update_free_bits_if_full(
before = ibuf_index_page_calc_free_bits(max_ins_size);
if (max_ins_size >= increase) {
ut_ad(ULINT_UNDEFINED > UNIV_PAGE_SIZE);
#if ULINT32_UNDEFINED <= UNIV_PAGE_SIZE
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(max_ins_size
- increase);
#ifdef UNIV_IBUF_DEBUG
......
......@@ -73,10 +73,18 @@ mlog_catenate_ulint(
mlog = &(mtr->log);
ut_ad(MLOG_1BYTE == 1);
ut_ad(MLOG_2BYTES == 2);
ut_ad(MLOG_4BYTES == 4);
#if MLOG_1BYTE != 1
# error "MLOG_1BYTE != 1"
#endif
#if MLOG_2BYTES != 2
# error "MLOG_2BYTES != 2"
#endif
#if MLOG_4BYTES != 4
# error "MLOG_4BYTES != 4"
#endif
#if MLOG_8BYTES != 8
# error "MLOG_8BYTES != 8"
#endif
ptr = dyn_array_push(mlog, type);
if (type == MLOG_4BYTES) {
......
......@@ -47,10 +47,10 @@ flag value must give the length also! */
has been called only once,
this flag is ORed to the type
of that first log record */
#define MLOG_1BYTE ((byte)1) /* one byte is written */
#define MLOG_2BYTES ((byte)2) /* 2 bytes ... */
#define MLOG_4BYTES ((byte)4) /* 4 bytes ... */
#define MLOG_8BYTES ((byte)8) /* 8 bytes ... */
#define MLOG_1BYTE (1) /* one byte is written */
#define MLOG_2BYTES (2) /* 2 bytes ... */
#define MLOG_4BYTES (4) /* 4 bytes ... */
#define MLOG_8BYTES (8) /* 8 bytes ... */
#define MLOG_REC_INSERT ((byte)9) /* record insert */
#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /* mark clustered index record
deleted */
......
......@@ -268,9 +268,12 @@ rec_get_next_offs(
ulint comp) /* in: nonzero=compact page format */
{
ulint field_value;
ut_ad(REC_NEXT_MASK == 0xFFFFUL);
ut_ad(REC_NEXT_SHIFT == 0);
#if REC_NEXT_MASK != 0xFFFFUL
# error "REC_NEXT_MASK != 0xFFFFUL"
#endif
#if REC_NEXT_SHIFT
# error "REC_NEXT_SHIFT != 0"
#endif
field_value = mach_read_from_2(rec - REC_NEXT);
......@@ -317,8 +320,12 @@ rec_set_next_offs(
{
ut_ad(rec);
ut_ad(UNIV_PAGE_SIZE > next);
ut_ad(REC_NEXT_MASK == 0xFFFFUL);
ut_ad(REC_NEXT_SHIFT == 0);
#if REC_NEXT_MASK != 0xFFFFUL
# error "REC_NEXT_MASK != 0xFFFFUL"
#endif
#if REC_NEXT_SHIFT
# error "REC_NEXT_SHIFT != 0"
#endif
if (comp) {
ulint field_value;
......
......@@ -20,7 +20,9 @@ trx_undo_build_roll_ptr(
ulint page_no, /* in: page number */
ulint offset) /* in: offset of the undo entry within page */
{
ut_ad(DATA_ROLL_PTR_LEN == 7);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
ut_ad(rseg_id < 128);
return(ut_dulint_create(is_insert * 128 * 256 * 256
......@@ -44,10 +46,12 @@ trx_undo_decode_roll_ptr(
{
ulint low;
ulint high;
ut_ad(DATA_ROLL_PTR_LEN == 7);
ut_ad(TRUE == 1);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
high = ut_dulint_get_high(roll_ptr);
low = ut_dulint_get_low(roll_ptr);
......@@ -70,10 +74,12 @@ trx_undo_roll_ptr_is_insert(
dulint roll_ptr) /* in: roll pointer */
{
ulint high;
ut_ad(DATA_ROLL_PTR_LEN == 7);
ut_ad(TRUE == 1);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
#if TRUE != 1
# error "TRUE != 1"
#endif
high = ut_dulint_get_high(roll_ptr);
return(high / (256 * 256 * 128));
......@@ -106,8 +112,9 @@ trx_read_roll_ptr(
/* out: roll ptr */
byte* ptr) /* in: pointer to memory from where to read */
{
ut_ad(DATA_ROLL_PTR_LEN == 7);
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
#endif
return(mach_read_from_7(ptr));
}
......
......@@ -368,8 +368,9 @@ ut_bit_get_nth(
ulint n) /* in: nth bit requested */
{
ut_ad(n < 8 * sizeof(ulint));
ut_ad(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
return(1 & (a >> n));
}
......@@ -385,8 +386,9 @@ ut_bit_set_nth(
ibool val) /* in: value for the bit to set */
{
ut_ad(n < 8 * sizeof(ulint));
ut_ad(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
if (val) {
return((1 << n) | a);
} else {
......
......@@ -1699,7 +1699,9 @@ log_group_checkpoint(
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE);
#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE
# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE"
#endif
buf = group->checkpoint_buf;
......
......@@ -3219,7 +3219,9 @@ log_group_recover_from_archive_file(
fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,
group->archive_space_id, FALSE);
ut_a(RECV_SCAN_SIZE >= LOG_FILE_HDR_SIZE);
#if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE
# error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE"
#endif
/* Read the archive file header */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0, 0,
......
......@@ -157,8 +157,9 @@ mem_area_get_free(
/* out: TRUE if free */
mem_area_t* area) /* in: area */
{
ut_ad(TRUE == MEM_AREA_FREE);
#if TRUE != MEM_AREA_FREE
# error "TRUE != MEM_AREA_FREE"
#endif
return(area->size_and_free & MEM_AREA_FREE);
}
......@@ -171,8 +172,9 @@ mem_area_set_free(
mem_area_t* area, /* in: area */
ibool free) /* in: free bit value */
{
ut_ad(TRUE == MEM_AREA_FREE);
#if TRUE != MEM_AREA_FREE
# error "TRUE != MEM_AREA_FREE"
#endif
area->size_and_free = (area->size_and_free & ~MEM_AREA_FREE)
| free;
}
......
......@@ -630,7 +630,9 @@ os_process_set_priority_boost(
no_boost = TRUE;
}
ut_a(TRUE == 1);
#if TRUE != 1
# error "TRUE != 1"
#endif
/* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
......
......@@ -1397,7 +1397,9 @@ page_cur_delete_rec(
prev_rec is owned by the same slot, i.e., PAGE_DIR_SLOT_MIN_N_OWNED
>= 2. */
ut_ad(PAGE_DIR_SLOT_MIN_N_OWNED >= 2);
#if PAGE_DIR_SLOT_MIN_N_OWNED < 2
# error "PAGE_DIR_SLOT_MIN_N_OWNED < 2"
#endif
ut_ad(cur_n_owned > 1);
if (current_rec == page_dir_slot_get_rec(cur_dir_slot)) {
......
......@@ -351,10 +351,12 @@ page_create(
index = comp ? srv_sys->dummy_ind2 : srv_sys->dummy_ind1;
ut_ad(frame && mtr);
ut_ad(PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE
<= PAGE_DATA);
ut_ad(PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE
<= PAGE_DATA);
#if PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA
# error "PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA"
#endif
#if PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE > PAGE_DATA
# error "PAGE_BTR_IBUF_FREE_LIST_NODE + FLST_NODE_SIZE > PAGE_DATA"
#endif
/* 1. INCREMENT MODIFY CLOCK */
buf_frame_modify_clock_inc(frame);
......
......@@ -550,7 +550,9 @@ row_upd_index_write_log(
for (i = 0; i < n_fields; i++) {
ut_ad(MLOG_BUF_MARGIN > 30);
#if MLOG_BUF_MARGIN <= 30
# error "MLOG_BUF_MARGIN <= 30"
#endif
if (log_ptr + 30 > buf_end) {
mlog_close(mtr, log_ptr);
......
......@@ -1093,7 +1093,6 @@ sync_thread_add_level(
ut_a(sync_thread_levels_contain(array, SYNC_FSP)
|| sync_thread_levels_g(array, SYNC_FSP));
} else if (level == SYNC_EXTERN_STORAGE) {
ut_a(TRUE);
} else if (level == SYNC_TRX_UNDO_PAGE) {
ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO)
|| sync_thread_levels_contain(array, SYNC_RSEG)
......@@ -1116,7 +1115,6 @@ sync_thread_add_level(
ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE)
|| sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
} else if (level == SYNC_TREE_NODE_FROM_HASH) {
ut_a(1);
} else if (level == SYNC_TREE_NODE_NEW) {
ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE)
|| sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
......
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