mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
fix or suppress errors due to -Wmaybe-uninitialized in GCC 4.8
closes #13
This commit is contained in:
parent
b7365688d1
commit
88def6a5cb
8 changed files with 38 additions and 21 deletions
|
@ -783,7 +783,8 @@ move_leafentries(
|
|||
*num_bytes_moved = 0;
|
||||
for (i = lbi; i < ube; i++) {
|
||||
OMTVALUE lev;
|
||||
toku_omt_fetch(src_bn->buffer, i, &lev);
|
||||
int r = toku_omt_fetch(src_bn->buffer, i, &lev);
|
||||
assert_zero(r);
|
||||
LEAFENTRY CAST_FROM_VOIDP(curr_le, lev);
|
||||
size_t le_size = leafentry_memsize(curr_le);
|
||||
*num_bytes_moved += leafentry_disksize(curr_le);
|
||||
|
@ -851,7 +852,7 @@ ftleaf_split(
|
|||
}
|
||||
|
||||
|
||||
FTNODE B;
|
||||
FTNODE B = nullptr;
|
||||
uint32_t fullhash;
|
||||
BLOCKNUM name;
|
||||
|
||||
|
@ -875,6 +876,9 @@ ftleaf_split(
|
|||
&fullhash,
|
||||
&B
|
||||
);
|
||||
// GCC 4.8 seems to get confused and think B is maybe uninitialized at link time.
|
||||
// TODO(leif): figure out why it thinks this and actually fix it.
|
||||
invariant_notnull(B);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1245,7 +1249,8 @@ merge_leaf_nodes(FTNODE a, FTNODE b)
|
|||
// fill in pivot for what used to be max of node 'a', if it is needed
|
||||
if (a_has_tail) {
|
||||
OMTVALUE lev;
|
||||
toku_omt_fetch(a_last_buffer, toku_omt_size(a_last_buffer) - 1, &lev);
|
||||
int r = toku_omt_fetch(a_last_buffer, toku_omt_size(a_last_buffer) - 1, &lev);
|
||||
assert_zero(r);
|
||||
LEAFENTRY CAST_FROM_VOIDP(le, lev);
|
||||
uint32_t keylen;
|
||||
void *key = le_key_and_len(le, &keylen);
|
||||
|
|
|
@ -4050,13 +4050,14 @@ ft_cursor_extract_key_and_val(LEAFENTRY le,
|
|||
*val = le;
|
||||
*vallen = leafentry_memsize(le);
|
||||
} else if (cursor->is_snapshot_read) {
|
||||
le_iterate_val(
|
||||
int r = le_iterate_val(
|
||||
le,
|
||||
does_txn_read_entry,
|
||||
val,
|
||||
vallen,
|
||||
cursor->ttxn
|
||||
);
|
||||
lazy_assert_zero(r);
|
||||
*key = le_key_and_len(le, keylen);
|
||||
} else {
|
||||
*key = le_key_and_len(le, keylen);
|
||||
|
|
4
ft/ft.cc
4
ft/ft.cc
|
@ -474,7 +474,7 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_ac
|
|||
}
|
||||
}
|
||||
*was_open = false;
|
||||
FT h;
|
||||
FT h = nullptr;
|
||||
int r;
|
||||
{
|
||||
int fd = toku_cachefile_get_fd(cf);
|
||||
|
@ -485,6 +485,8 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_ac
|
|||
}
|
||||
}
|
||||
if (r!=0) return r;
|
||||
// GCC 4.8 seems to get confused by the gotos in the deserialize code and think h is maybe uninitialized.
|
||||
invariant_notnull(h);
|
||||
h->cf = cf;
|
||||
h->compare_fun = brt->options.compare_fun;
|
||||
h->update_fun = brt->options.update_fun;
|
||||
|
|
|
@ -1014,8 +1014,9 @@ int toku_fread_TXNID (FILE *f, TXNID *txnid, struct x1764 *checksum, uint32_t
|
|||
int toku_fread_TXNID_PAIR (FILE *f, TXNID_PAIR *txnid, struct x1764 *checksum, uint32_t *len) {
|
||||
TXNID parent;
|
||||
TXNID child;
|
||||
toku_fread_TXNID(f, &parent, checksum, len);
|
||||
toku_fread_TXNID(f, &child, checksum, len);
|
||||
int r;
|
||||
r = toku_fread_TXNID(f, &parent, checksum, len); if (r != 0) { return r; }
|
||||
r = toku_fread_TXNID(f, &child, checksum, len); if (r != 0) { return r; }
|
||||
txnid->parent_id64 = parent;
|
||||
txnid->child_id64 = child;
|
||||
return 0;
|
||||
|
|
|
@ -8,16 +8,6 @@ if(BUILD_TESTING)
|
|||
|
||||
file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.cc)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-Wno-unused-result HAVE_WNO_UNUSED_RESULT)
|
||||
if (HAVE_WNO_UNUSED_RESULT)
|
||||
add_space_separated_property(SOURCE try-leak-lost COMPILE_FLAGS -Wno-unused-result)
|
||||
endif ()
|
||||
check_c_compiler_flag(-Wno-maybe-uninitialized HAVE_WNO_MAYBE_UNINITIALIZED)
|
||||
if (HAVE_WNO_MAYBE_UNINITIALIZED)
|
||||
add_space_separated_property(SOURCE try-uninit COMPILE_FLAGS -Wno-maybe-uninitialized)
|
||||
endif ()
|
||||
|
||||
foreach(src ${srcs})
|
||||
get_filename_component(test ${src} NAME_WE)
|
||||
add_executable(${test} ${test})
|
||||
|
@ -27,6 +17,17 @@ if(BUILD_TESTING)
|
|||
list(APPEND tests ${test})
|
||||
endforeach(src)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-Wno-unused-result HAVE_WNO_UNUSED_RESULT)
|
||||
if (HAVE_WNO_UNUSED_RESULT)
|
||||
add_space_separated_property(SOURCE try-leak-lost COMPILE_FLAGS -Wno-unused-result)
|
||||
endif ()
|
||||
check_c_compiler_flag(-Wno-maybe-uninitialized HAVE_WNO_MAYBE_UNINITIALIZED)
|
||||
if (HAVE_WNO_MAYBE_UNINITIALIZED)
|
||||
add_space_separated_property(SOURCE try-uninit COMPILE_FLAGS -Wno-maybe-uninitialized)
|
||||
add_space_separated_property(TARGET try-uninit LINK_FLAGS -Wno-maybe-uninitialized)
|
||||
endif ()
|
||||
|
||||
configure_file(ensure_memcheck_fails.sh . COPYONLY)
|
||||
foreach(test try-leak-lost try-leak-reachable try-uninit)
|
||||
list(REMOVE_ITEM tests ${test})
|
||||
|
|
|
@ -151,6 +151,9 @@ test_cursor_sticky (int n, int dup_mode) {
|
|||
DBC *cursor;
|
||||
r = db->cursor(db, 0, &cursor, 0); assert(r == 0);
|
||||
for (i=0; i<n; i++) {
|
||||
// GCC 4.8 complains about these being maybe uninitialized.
|
||||
// TODO(leif): figure out why and fix it.
|
||||
k = 0; v = 0;
|
||||
r = cursor_get(cursor, &k, &v, DB_NEXT); assert(r == 0);
|
||||
assert(k == htonl(i)); assert(v == htonl(i));
|
||||
}
|
||||
|
|
|
@ -358,8 +358,10 @@ futz_with_stack:
|
|||
if (min_allowed_branch_level >= nest_level) {
|
||||
//start new subtree
|
||||
int max = nest_level + 4;
|
||||
if (MAX_NEST - 1 < max) max = MAX_NEST - 1;
|
||||
assert(max > nest_level);
|
||||
if (MAX_NEST - 1 < max) {
|
||||
max = MAX_NEST - 1;
|
||||
assert(max > nest_level);
|
||||
}
|
||||
int branch_level;
|
||||
for (branch_level = nest_level + 1; branch_level <= max; branch_level++) {
|
||||
start_txn_and_maybe_insert_or_delete(branch_level);
|
||||
|
|
|
@ -377,8 +377,10 @@ futz_with_stack:
|
|||
if (min_allowed_branch_level >= nest_level) {
|
||||
//start new subtree
|
||||
int max = nest_level + 4;
|
||||
if (MAX_NEST - 1 < max) max = MAX_NEST - 1;
|
||||
assert(max > nest_level);
|
||||
if (MAX_NEST - 1 < max) {
|
||||
max = MAX_NEST - 1;
|
||||
assert(max > nest_level);
|
||||
}
|
||||
int branch_level;
|
||||
for (branch_level = nest_level + 1; branch_level <= max; branch_level++) {
|
||||
start_txn_and_maybe_insert_or_delete(branch_level);
|
||||
|
|
Loading…
Add table
Reference in a new issue