Fix gcc 6.3.x compiler warnings.

These are caused by fact that functions are declared with
__attribute__((nonnull)) or left shit like ~0 << macro
when ~0U << macro should be used.
This commit is contained in:
Jan Lindström 2017-02-16 12:02:31 +02:00
commit 108b211ee2
56 changed files with 43 additions and 198 deletions

View file

@ -2932,7 +2932,6 @@ btr_level_list_remove_func(
ulint prev_page_no;
ulint next_page_no;
ut_ad(page && mtr);
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(space == page_get_space_id(page));
/* Get the previous and next page numbers of page */

View file

@ -1877,7 +1877,6 @@ btr_cur_update_alloc_zip(
mtr_t* mtr) /*!< in: mini-transaction */
{
ut_a(page_zip == buf_block_get_page_zip(block));
ut_ad(page_zip);
ut_ad(!dict_index_is_ibuf(index));
if (page_zip_available(page_zip, dict_index_is_clust(index),
@ -2837,7 +2836,7 @@ btr_cur_del_mark_set_clust_rec(
ut_ad(page_is_leaf(page_align(rec)));
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops && thr) {
if (btr_cur_print_record_ops) {
btr_cur_trx_report(thr_get_trx(thr), index, "del mark ");
rec_print_new(stderr, rec, offsets);
}
@ -4128,7 +4127,6 @@ btr_cur_disown_inherited_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
ut_ad(rec_offs_any_extern(offsets));
ut_ad(mtr);
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
if (rec_offs_nth_extern(offsets, i)
@ -4191,9 +4189,6 @@ btr_push_update_extern_fields(
ulint n;
const upd_field_t* uf;
ut_ad(tuple);
ut_ad(update);
uf = update->fields;
n = upd_get_n_fields(update);
@ -4366,7 +4361,6 @@ btr_store_big_rec_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_any_extern(offsets));
ut_ad(btr_mtr);
ut_ad(mtr_memo_contains(btr_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(btr_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));

View file

@ -276,7 +276,6 @@ buf_buddy_alloc_low(
{
buf_block_t* block;
ut_ad(lru);
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(i >= buf_buddy_get_slot(PAGE_ZIP_MIN_SIZE));

View file

@ -112,13 +112,13 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 3/*TYPE*/);
ptr = mem_heap_alloc(heap, 4);
if (table->flags & (~DICT_TF_COMPACT & ~(~0 << DICT_TF_BITS))) {
if (table->flags & (~DICT_TF_COMPACT & ~(~0U << DICT_TF_BITS))) {
ut_a(table->flags & DICT_TF_COMPACT);
ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
ut_a((table->flags & DICT_TF_ZSSIZE_MASK)
<= (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT));
ut_a(!(table->flags & (~0 << DICT_TF2_BITS)));
mach_write_to_4(ptr, table->flags & ~(~0 << DICT_TF_BITS));
ut_a(!(table->flags & (~0U << DICT_TF2_BITS)));
mach_write_to_4(ptr, table->flags & ~(~0U << DICT_TF_BITS));
} else {
mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
}
@ -306,7 +306,7 @@ dict_build_table_def_step(
ut_ad(!dict_table_zip_size(table)
|| dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
flags = table->flags & ~(~0 << DICT_TF_BITS);
flags = table->flags & ~(~0U << DICT_TF_BITS);
error = fil_create_new_single_table_tablespace(
space, path_or_name, is_path,
flags == DICT_TF_COMPACT ? 0 : flags,
@ -325,7 +325,7 @@ dict_build_table_def_step(
mtr_commit(&mtr);
} else {
/* Create in the system tablespace: disallow new features */
table->flags &= (~0 << DICT_TF_BITS) | DICT_TF_COMPACT;
table->flags &= (~0U << DICT_TF_BITS) | DICT_TF_COMPACT;
}
row = dict_create_sys_tables_tuple(table, node->heap);

View file

@ -5848,7 +5848,6 @@ dict_set_corrupted(
const char* status;
btr_cur_t cursor;
ut_ad(index);
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));

View file

@ -643,7 +643,7 @@ dict_sys_tables_get_flags(
return(ULINT_UNDEFINED);
}
if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) {
if (UNIV_UNLIKELY(flags & (~0U << DICT_TF_BITS))) {
/* Some unused bits are set. */
return(ULINT_UNDEFINED);
}
@ -1332,7 +1332,7 @@ err_len:
goto err_len;
}
type = mach_read_from_4(field);
if (UNIV_UNLIKELY(type & (~0 << DICT_IT_BITS))) {
if (UNIV_UNLIKELY(type & (~0U << DICT_IT_BITS))) {
return("unknown SYS_INDEXES.TYPE bits");
}
@ -1696,7 +1696,7 @@ err_len:
flags2 = mach_read_from_4(field);
if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
if (flags2 & (~0U << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: table ", stderr);
ut_print_filename(stderr, name);
@ -1705,7 +1705,7 @@ err_len:
" has unknown flags %lx.\n",
(ulong) flags2);
flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT));
flags2 &= ~(~0U << (DICT_TF2_BITS - DICT_TF2_SHIFT));
}
flags |= flags2 << DICT_TF2_SHIFT;

View file

@ -69,7 +69,7 @@ dict_mem_table_create(
DBUG_ENTER("dict_mem_table_create");
ut_ad(name);
ut_a(!(flags & (~0 << DICT_TF2_BITS)));
ut_a(!(flags & (~0U << DICT_TF2_BITS)));
heap = mem_heap_create(DICT_HEAP_SIZE);

View file

@ -40,7 +40,6 @@ dyn_array_add_block(
mem_heap_t* heap;
dyn_block_t* block;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
if (arr->heap == NULL) {

View file

@ -3308,7 +3308,7 @@ fil_open_single_table_tablespace(
}
if (space_id != id
|| space_flags != (flags & ~(~0 << DICT_TF_BITS))) {
|| space_flags != (flags & ~(~0U << DICT_TF_BITS))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: tablespace id and flags in file ",

View file

@ -1285,7 +1285,6 @@ fsp_fill_free_list(
ulint i;
mtr_t ibuf_mtr;
ut_ad(header && mtr);
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
/* Check if we can fill free list from above the free list limit */
@ -1584,9 +1583,6 @@ fsp_alloc_free_page(
ulint page_no;
ulint space_size;
ut_ad(mtr);
ut_ad(init_mtr);
header = fsp_get_space_header(space, zip_size, mtr);
/* Get the hinted descriptor */
@ -2602,7 +2598,6 @@ fseg_alloc_free_page_low(
ibool success;
ulint n;
ut_ad(mtr);
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);

View file

@ -247,7 +247,6 @@ dict_index_is_clust(
/*================*/
const dict_index_t* index) /*!< in: index */
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(UNIV_UNLIKELY(index->type & DICT_CLUSTERED));
@ -261,7 +260,6 @@ dict_index_is_unique(
/*=================*/
const dict_index_t* index) /*!< in: index */
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(UNIV_UNLIKELY(index->type & DICT_UNIQUE));
@ -276,7 +274,6 @@ dict_index_is_ibuf(
/*===============*/
const dict_index_t* index) /*!< in: index */
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(UNIV_UNLIKELY(index->type & DICT_IBUF));
@ -293,7 +290,6 @@ dict_index_is_sec_or_ibuf(
{
ulint type;
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
type = index->type;
@ -311,7 +307,6 @@ dict_table_get_n_user_cols(
/*=======================*/
const dict_table_t* table) /*!< in: table */
{
ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols - DATA_N_SYS_COLS);
@ -343,7 +338,6 @@ dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
{
ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
return(table->n_cols);
@ -937,7 +931,6 @@ dict_index_is_corrupted(
/*====================*/
const dict_index_t* index) /*!< in: index */
{
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
return(UNIV_UNLIKELY((index->type & DICT_CORRUPT)

View file

@ -85,9 +85,14 @@ combination of types */
/** File format */
/* @{ */
#define DICT_TF_BITS 6 /*!< number of flag bits */
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
#endif
#define DICT_TF_FORMAT_SHIFT 5 /* file format */
#define DICT_TF_FORMAT_MASK \
((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
((~(~0U << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
#define DICT_TF_FORMAT_51 0 /*!< InnoDB/MySQL up to 5.1 */
#define DICT_TF_FORMAT_ZIP 1 /*!< InnoDB plugin for 5.1:
compressed tables,
@ -98,11 +103,6 @@ combination of types */
/** Minimum supported file format */
#define DICT_TF_FORMAT_MIN DICT_TF_FORMAT_51
/* @} */
#define DICT_TF_BITS 6 /*!< number of flag bits */
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
#endif
/* @} */
/** @brief Additional table flags.

View file

@ -47,8 +47,6 @@ dyn_block_get_used(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
{
ut_ad(block);
return((block->used) & ~DYN_BLOCK_FULL_FLAG);
}
@ -61,8 +59,6 @@ dyn_block_get_data(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
{
ut_ad(block);
return((byte*) block->data);
}
@ -76,7 +72,6 @@ dyn_array_create(
dyn_array_t* arr) /*!< in/out: memory buffer of
size sizeof(dyn_array_t) */
{
ut_ad(arr);
#if DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG
# error "DYN_ARRAY_DATA_SIZE >= DYN_BLOCK_FULL_FLAG"
#endif
@ -119,7 +114,6 @@ dyn_array_push(
dyn_block_t* block;
ulint used;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
ut_ad(size <= DYN_ARRAY_DATA_SIZE);
ut_ad(size);
@ -159,7 +153,6 @@ dyn_array_open(
{
dyn_block_t* block;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
ut_ad(size <= DYN_ARRAY_DATA_SIZE);
ut_ad(size);
@ -195,7 +188,6 @@ dyn_array_close(
{
dyn_block_t* block;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
block = dyn_array_get_last_block(arr);
@ -222,7 +214,6 @@ dyn_array_get_element(
{
const dyn_block_t* block;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
/* Get the first array block */
@ -260,7 +251,6 @@ dyn_array_get_data_size(
const dyn_block_t* block;
ulint sum = 0;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
if (arr->heap == NULL) {

View file

@ -42,7 +42,7 @@ Created 12/18/1995 Heikki Tuuri
#define FSP_FLAGS_POS_PAGE_SSIZE 6
/** Bit mask of the PAGE_SSIZE field */
#define FSP_FLAGS_MASK_PAGE_SSIZE \
((~(~0 << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
<< FSP_FLAGS_POS_PAGE_SSIZE)
/** Return the value of the PAGE_SSIZE field */
#define FSP_FLAGS_GET_PAGE_SSIZE(flags) \

View file

@ -50,7 +50,6 @@ mach_read_from_1(
/*=============*/
const byte* b) /*!< in: pointer to byte */
{
ut_ad(b);
return((ulint)(b[0]));
}
@ -143,7 +142,6 @@ mach_read_from_3(
/*=============*/
const byte* b) /*!< in: pointer to 3 bytes */
{
ut_ad(b);
return( ((ulint)(b[0]) << 16)
| ((ulint)(b[1]) << 8)
| (ulint)(b[2])
@ -178,7 +176,6 @@ mach_read_from_4(
/*=============*/
const byte* b) /*!< in: pointer to four bytes */
{
ut_ad(b);
return( ((ulint)(b[0]) << 24)
| ((ulint)(b[1]) << 16)
| ((ulint)(b[2]) << 8)
@ -255,8 +252,6 @@ mach_read_compressed(
{
ulint flag;
ut_ad(b);
flag = mach_read_from_1(b);
if (flag < 0x80UL) {
@ -333,8 +328,6 @@ mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
{
ut_ad(b);
return(ut_ull_create(mach_read_from_3(b), mach_read_from_4(b + 3)));
}
@ -364,8 +357,6 @@ mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
{
ut_ad(b);
return(ut_ull_create(mach_read_from_2(b), mach_read_from_4(b + 2)));
}
@ -413,8 +404,6 @@ mach_ull_read_compressed(
ib_uint64_t n;
ulint size;
ut_ad(b);
n = (ib_uint64_t) mach_read_compressed(b);
size = mach_get_compressed_size((ulint) n);
@ -480,8 +469,6 @@ mach_ull_read_much_compressed(
ib_uint64_t n;
ulint size;
ut_ad(b);
if (*b != (byte)0xFF) {
n = 0;
size = 0;

View file

@ -149,7 +149,6 @@ mtr_memo_contains(
dyn_array_t* memo;
ulint offset;
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE || mtr->state == MTR_COMMITTING);

View file

@ -154,7 +154,6 @@ page_header_get_offs(
{
ulint offs;
ut_ad(page);
ut_ad((field == PAGE_FREE)
|| (field == PAGE_LAST_INSERT)
|| (field == PAGE_HEAP_TOP));

View file

@ -1545,7 +1545,6 @@ rec_copy(
ulint extra_len;
ulint data_len;
ut_ad(rec && buf);
ut_ad(rec_offs_validate((rec_t*) rec, NULL, offsets));
ut_ad(rec_validate(rec, offsets));

View file

@ -88,7 +88,6 @@ Adds the node as the first element in a two-way linked list.
*/
#define UT_LIST_ADD_FIRST(NAME, BASE, N)\
{\
ut_ad(N);\
((BASE).count)++;\
((N)->NAME).next = (BASE).start;\
((N)->NAME).prev = NULL;\
@ -134,7 +133,6 @@ Inserts a NODE2 after NODE1 in a list.
#define UT_LIST_INSERT_AFTER(NAME, BASE, NODE1, NODE2)\
{\
ut_ad(NODE1);\
ut_ad(NODE2);\
ut_ad((NODE1) != (NODE2));\
((BASE).count)++;\
((NODE2)->NAME).prev = (NODE1);\
@ -169,7 +167,6 @@ Removes a node from a two-way linked list.
*/
#define UT_LIST_REMOVE(NAME, BASE, N) \
do { \
ut_ad(N); \
ut_a((BASE).count > 0); \
((BASE).count)--; \
if (((N)->NAME).next != NULL) { \

View file

@ -257,7 +257,6 @@ mtr_commit(
/*=======*/
mtr_t* mtr) /*!< in: mini-transaction */
{
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(!mtr->inside_ibuf);

View file

@ -1345,7 +1345,6 @@ page_dir_split_slot(
ulint i;
ulint n_owned;
ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);
@ -1407,7 +1406,6 @@ page_dir_balance_slot(
rec_t* old_rec;
rec_t* new_rec;
ut_ad(page);
ut_ad(!page_zip || page_is_comp(page));
ut_ad(slot_no > 0);

View file

@ -4739,7 +4739,6 @@ page_zip_parse_compress(
ulint size;
ulint trailer_size;
ut_ad(ptr && end_ptr);
ut_ad(!page == !page_zip);
if (UNIV_UNLIKELY(ptr + (2 + 2) > end_ptr)) {

View file

@ -791,8 +791,7 @@ rec_get_converted_size_comp_prefix_low(
ulint extra_size;
ulint data_size;
ulint i;
ut_ad(index);
ut_ad(fields);
ut_ad(n_fields > 0);
ut_ad(n_fields <= dict_index_get_n_fields(index));
ut_ad(!temp || extra);

View file

@ -807,14 +807,8 @@ row_merge_read_rec(
ulint data_size;
ulint avail_size;
ut_ad(block);
ut_ad(buf);
ut_ad(b >= block[0]);
ut_ad(b < block[1]);
ut_ad(index);
ut_ad(foffs);
ut_ad(mrec);
ut_ad(offsets);
ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
@ -1175,12 +1169,6 @@ row_merge_read_clustered_index(
trx->op_info = "reading clustered index";
ut_ad(trx);
ut_ad(old_table);
ut_ad(new_table);
ut_ad(index);
ut_ad(files);
/* Create and initialize memory for record buffers */
merge_buf = mem_alloc(n_index * sizeof *merge_buf);

View file

@ -751,9 +751,6 @@ row_purge(
{
ibool updated_extern;
ut_ad(node);
ut_ad(thr);
node->undo_rec = trx_purge_fetch_next_rec(&node->roll_ptr,
&node->reservation,
node->heap);

View file

@ -1066,8 +1066,6 @@ row_upd_index_replace_new_col_vals_index_pos(
ulint n_fields;
const ulint zip_size = dict_table_zip_size(index->table);
ut_ad(index);
dtuple_set_info_bits(entry, update->info_bits);
if (order_only) {
@ -1250,8 +1248,6 @@ row_upd_changes_ord_field_binary_func(
ulint i;
const dict_index_t* clust_index;
ut_ad(index);
ut_ad(update);
ut_ad(thr);
ut_ad(thr->graph);
ut_ad(thr->graph->trx);

View file

@ -97,7 +97,6 @@ trx_create(
trx_t* trx;
ut_ad(mutex_own(&kernel_mutex));
ut_ad(sess);
trx = mem_alloc(sizeof(trx_t));