summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/async/async_worker.c5
-rw-r--r--src/block/block_ckpt.c5
-rw-r--r--src/block/block_compact.c4
-rw-r--r--src/block/block_open.c2
-rw-r--r--src/block/block_vrfy.c6
-rw-r--r--src/btree/bt_cursor.c11
-rw-r--r--src/btree/bt_debug.c15
-rw-r--r--src/btree/bt_discard.c2
-rw-r--r--src/btree/bt_handle.c2
-rw-r--r--src/btree/bt_io.c2
-rw-r--r--src/btree/bt_sync.c13
-rw-r--r--src/checksum/checksum.c2
-rw-r--r--src/checksum/power8/crc32_wrapper.c5
-rw-r--r--src/cursor/cur_bulk.c1
-rw-r--r--src/evict/evict_file.c3
-rw-r--r--src/evict/evict_lru.c3
-rw-r--r--src/include/btree_cmp.i20
-rw-r--r--src/include/cell.i26
-rw-r--r--src/include/extern.h9
-rw-r--r--src/include/misc.h6
-rw-r--r--src/include/packing.i2
-rw-r--r--src/meta/meta_track.c2
-rw-r--r--src/reconcile/rec_write.c10
-rw-r--r--src/schema/schema_list.c2
-rw-r--r--src/support/err.c19
-rw-r--r--src/support/hash_city.c2
-rw-r--r--src/support/hazard.c14
-rw-r--r--src/support/huffman.c23
-rw-r--r--src/txn/txn.c2
-rw-r--r--src/txn/txn_log.c20
30 files changed, 140 insertions, 98 deletions
diff --git a/src/async/async_worker.c b/src/async/async_worker.c
index e692bc619a9..90dac557e36 100644
--- a/src/async/async_worker.c
+++ b/src/async/async_worker.c
@@ -216,9 +216,8 @@ __async_worker_execop(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op,
__wt_cursor_set_raw_value(&asyncop->c, &val);
break;
case WT_AOP_NONE:
- default:
- WT_RET_MSG(session, EINVAL, "Unknown async optype %d\n",
- op->optype);
+ WT_RET_MSG(session, EINVAL,
+ "Unknown async optype %d\n", op->optype);
}
return (0);
}
diff --git a/src/block/block_ckpt.c b/src/block/block_ckpt.c
index 716121faa06..b9f0ec25d53 100644
--- a/src/block/block_ckpt.c
+++ b/src/block/block_ckpt.c
@@ -63,6 +63,7 @@ __wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block,
*/
*root_addr_sizep = 0;
+#ifdef HAVE_VERBOSE
if (WT_VERBOSE_ISSET(session, WT_VERB_CHECKPOINT)) {
if (addr != NULL) {
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
@@ -72,6 +73,7 @@ __wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block,
"%s: load-checkpoint: %s", block->name,
addr == NULL ? "[Empty]" : (const char *)tmp->data));
}
+#endif
/*
* There's a single checkpoint in the file that can be written, all of
@@ -507,6 +509,7 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
!F_ISSET(ckpt, WT_CKPT_DELETE))
continue;
+#ifdef HAVE_VERBOSE
if (WT_VERBOSE_ISSET(session, WT_VERB_CHECKPOINT)) {
if (tmp == NULL)
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
@@ -516,7 +519,7 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
"%s: delete-checkpoint: %s: %s",
block->name, ckpt->name, (const char *)tmp->data));
}
-
+#endif
/*
* Find the checkpoint into which we'll roll this checkpoint's
* blocks: it's the next real checkpoint in the list, and it
diff --git a/src/block/block_compact.c b/src/block/block_compact.c
index 24ca6632311..02862ea842f 100644
--- a/src/block/block_compact.c
+++ b/src/block/block_compact.c
@@ -39,12 +39,14 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
/* Restore the original allocation plan. */
__wt_block_configure_first_fit(block, false);
+#ifdef HAVE_VERBOSE
/* Dump the results of the compaction pass. */
if (WT_VERBOSE_ISSET(session, WT_VERB_COMPACT)) {
__wt_spin_lock(session, &block->live_lock);
ret = __block_dump_avail(session, block, false);
__wt_spin_unlock(session, &block->live_lock);
}
+#endif
return (ret);
}
@@ -188,6 +190,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
}
__wt_spin_unlock(session, &block->live_lock);
+#ifdef HAVE_VERBOSE
if (WT_VERBOSE_ISSET(session, WT_VERB_COMPACT)) {
++block->compact_pages_reviewed;
if (*skipp)
@@ -195,6 +198,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
else
++block->compact_pages_written;
}
+#endif
return (ret);
}
diff --git a/src/block/block_open.c b/src/block/block_open.c
index e58bef30a6d..1603b1574e7 100644
--- a/src/block/block_open.c
+++ b/src/block/block_open.c
@@ -59,7 +59,7 @@ __wt_block_manager_create(
session, filename, tmp->data));
WT_ERR(__wt_msg(session,
"unexpected file %s found, renamed to %s",
- filename, (char *)tmp->data));
+ filename, (const char *)tmp->data));
break;
}
}
diff --git a/src/block/block_vrfy.c b/src/block/block_vrfy.c
index a8e59ad0af7..36a73fac761 100644
--- a/src/block/block_vrfy.c
+++ b/src/block/block_vrfy.c
@@ -20,8 +20,10 @@ static int __verify_set_file_size(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *);
/* The bit list ignores the first block: convert to/from a frag/offset. */
#define WT_wt_off_TO_FRAG(block, off) \
((off) / (block)->allocsize - 1)
+#ifdef HAVE_VERBOSE
#define WT_FRAG_TO_OFF(block, frag) \
(((wt_off_t)(frag + 1)) * (block)->allocsize)
+#endif
/*
* __wt_block_verify_start --
@@ -443,6 +445,7 @@ __verify_filefrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
__bit_set(block->fragfile, last);
}
+#ifdef HAVE_VERBOSE
if (!WT_VERBOSE_ISSET(session, WT_VERB_VERIFY))
continue;
@@ -450,6 +453,7 @@ __verify_filefrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
"file range %" PRIuMAX "-%" PRIuMAX " never verified",
(uintmax_t)WT_FRAG_TO_OFF(block, first),
(uintmax_t)WT_FRAG_TO_OFF(block, last));
+#endif
}
if (count == 0)
return (0);
@@ -534,6 +538,7 @@ __verify_ckptfrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
__bit_clear(block->fragckpt, last);
}
+#ifdef HAVE_VERBOSE
if (!WT_VERBOSE_ISSET(session, WT_VERB_VERIFY))
continue;
@@ -541,6 +546,7 @@ __verify_ckptfrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
"checkpoint range %" PRIuMAX "-%" PRIuMAX " never verified",
(uintmax_t)WT_FRAG_TO_OFF(block, first),
(uintmax_t)WT_FRAG_TO_OFF(block, last));
+#endif
}
if (count == 0)
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c
index 4b73b76c8c8..ab9e43fbf39 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -559,7 +559,6 @@ retry: WT_RET(__cursor_func_init(cbt, true));
ret = __cursor_row_modify(session, cbt, false);
break;
- WT_ILLEGAL_VALUE_ERR(session);
}
err: if (ret == WT_RESTART) {
@@ -640,7 +639,8 @@ retry: WT_RET(__cursor_func_init(cbt, true));
break;
case BTREE_COL_FIX:
case BTREE_COL_VAR:
- WT_ILLEGAL_VALUE_ERR(session);
+ WT_ERR(__wt_illegal_value(session, NULL));
+ break;
}
err: if (ret == WT_RESTART) {
@@ -718,7 +718,6 @@ retry: WT_RET(__cursor_func_init(cbt, true));
ret = __cursor_row_modify(session, cbt, true);
break;
- WT_ILLEGAL_VALUE_ERR(session);
}
err: if (ret == WT_RESTART) {
@@ -809,7 +808,6 @@ retry: WT_RET(__cursor_func_init(cbt, true));
}
ret = __cursor_row_modify(session, cbt, false);
break;
- WT_ILLEGAL_VALUE_ERR(session);
}
err: if (ret == WT_RESTART) {
@@ -976,7 +974,6 @@ __wt_btcur_compare(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp)
WT_RET(__wt_compare(
session, a_arg->btree->collator, &a->key, &b->key, cmpp));
break;
- WT_ILLEGAL_VALUE(session);
}
return (0);
}
@@ -1114,7 +1111,7 @@ __cursor_truncate_fix(WT_SESSION_IMPL *session,
int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool))
{
WT_DECL_RET;
- uint8_t *value;
+ const uint8_t *value;
/*
* Handle fixed-length column-store objects separately: for row-store
@@ -1143,7 +1140,7 @@ retry: WT_RET(__wt_btcur_remove(start));
if ((ret = __wt_btcur_next(start, true)) != 0)
break;
start->compare = 0; /* Exact match */
- value = (uint8_t *)start->iface.value.data;
+ value = (const uint8_t *)start->iface.value.data;
if (*value != 0 &&
(ret = rmfunc(session, start, 1)) != 0)
break;
diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c
index bd5970ecf86..a0832fc4cf8 100644
--- a/src/btree/bt_debug.c
+++ b/src/btree/bt_debug.c
@@ -431,12 +431,12 @@ __debug_tree_shape_info(WT_PAGE *page)
v = page->memory_footprint;
if (v >= WT_GIGABYTE)
snprintf(buf, sizeof(buf),
- "(%p %" PRIu64 "G)", page, v / WT_GIGABYTE);
+ "(%p %" PRIu64 "G)", (void *)page, v / WT_GIGABYTE);
else if (v >= WT_MEGABYTE)
snprintf(buf, sizeof(buf),
- "(%p %" PRIu64 "M)", page, v / WT_MEGABYTE);
+ "(%p %" PRIu64 "M)", (void *)page, v / WT_MEGABYTE);
else
- snprintf(buf, sizeof(buf), "(%p %" PRIu64 ")", page, v);
+ snprintf(buf, sizeof(buf), "(%p %" PRIu64 ")", (void *)page, v);
return (buf);
}
@@ -636,7 +636,7 @@ __debug_page_metadata(WT_DBG *ds, WT_REF *ref)
page = ref->page;
mod = page->modify;
- __dmsg(ds, "%p", page);
+ __dmsg(ds, "%p", (void *)page);
switch (page->type) {
case WT_PAGE_COL_INT:
@@ -663,7 +663,8 @@ __debug_page_metadata(WT_DBG *ds, WT_REF *ref)
}
__dmsg(ds, ": %s\n", __wt_page_type_string(page->type));
- __dmsg(ds, "\t" "disk %p, entries %" PRIu32, page->dsk, entries);
+ __dmsg(ds,
+ "\t" "disk %p, entries %" PRIu32, (void *)page->dsk, entries);
__dmsg(ds, ", %s", __wt_page_is_modified(page) ? "dirty" : "clean");
__dmsg(ds, ", %s", __wt_fair_islocked(
session, &page->page_lock) ? "locked" : "unlocked");
@@ -990,10 +991,10 @@ __debug_ref(WT_DBG *ds, WT_REF *ref)
__dmsg(ds, "deleted");
break;
case WT_REF_LOCKED:
- __dmsg(ds, "locked %p", ref->page);
+ __dmsg(ds, "locked %p", (void *)ref->page);
break;
case WT_REF_MEM:
- __dmsg(ds, "memory %p", ref->page);
+ __dmsg(ds, "memory %p", (void *)ref->page);
break;
case WT_REF_READING:
__dmsg(ds, "reading");
diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c
index 9807d5bc88f..a00bb7dc2b5 100644
--- a/src/btree/bt_discard.c
+++ b/src/btree/bt_discard.c
@@ -82,7 +82,7 @@ __wt_page_out(WT_SESSION_IMPL *session, WT_PAGE **pagep)
if (hp != NULL)
__wt_errx(session,
"discarded page has hazard pointer: (%p: %s, line %d)",
- hp->page, hp->file, hp->line);
+ (void *)hp->page, hp->file, hp->line);
WT_ASSERT(session, hp == NULL);
}
#endif
diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c
index 11d3aafae72..c97e05d74a7 100644
--- a/src/btree/bt_handle.c
+++ b/src/btree/bt_handle.c
@@ -519,7 +519,6 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, bool creation)
ref->state = WT_REF_DELETED;
WT_ERR(__wt_row_ikey_incr(session, root, 0, "", 1, ref));
break;
- WT_ILLEGAL_VALUE_ERR(session);
}
/* Bulk loads require a leaf page for reconciliation: create it now. */
@@ -567,7 +566,6 @@ __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep)
WT_RET(__wt_page_alloc(
session, WT_PAGE_ROW_LEAF, 0, false, pagep));
break;
- WT_ILLEGAL_VALUE(session);
}
return (0);
}
diff --git a/src/btree/bt_io.c b/src/btree/bt_io.c
index aaf906ca785..4339de6f25c 100644
--- a/src/btree/bt_io.c
+++ b/src/btree/bt_io.c
@@ -343,6 +343,7 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
* Checksum the data if the buffer isn't compressed or checksums are
* configured.
*/
+ data_cksum = true; /* -Werror=maybe-uninitialized */
switch (btree->checksum) {
case CKSUM_ON:
data_cksum = true;
@@ -351,7 +352,6 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
data_cksum = false;
break;
case CKSUM_UNCOMPRESSED:
- default:
data_cksum = !compressed;
break;
}
diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c
index 4404069e507..da6c53aa316 100644
--- a/src/btree/bt_sync.c
+++ b/src/btree/bt_sync.c
@@ -188,7 +188,8 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
break;
case WT_SYNC_CLOSE:
case WT_SYNC_DISCARD:
- WT_ILLEGAL_VALUE_ERR(session);
+ WT_ERR(__wt_illegal_value(session, NULL));
+ break;
}
if (WT_VERBOSE_ISSET(session, WT_VERB_CHECKPOINT)) {
@@ -273,6 +274,8 @@ err: /* On error, clear any left-over tree walk. */
int
__wt_cache_op(WT_SESSION_IMPL *session, WT_CACHE_OP op)
{
+ WT_DECL_RET;
+
switch (op) {
case WT_SYNC_CHECKPOINT:
case WT_SYNC_CLOSE:
@@ -292,10 +295,12 @@ __wt_cache_op(WT_SESSION_IMPL *session, WT_CACHE_OP op)
switch (op) {
case WT_SYNC_CHECKPOINT:
case WT_SYNC_WRITE_LEAVES:
- return (__sync_file(session, op));
+ ret = __sync_file(session, op);
+ break;
case WT_SYNC_CLOSE:
case WT_SYNC_DISCARD:
- return (__wt_evict_file(session, op));
- WT_ILLEGAL_VALUE(session);
+ ret = __wt_evict_file(session, op);
+ break;
}
+ return (ret);
}
diff --git a/src/checksum/checksum.c b/src/checksum/checksum.c
index 0b086753406..b6a76dacfd8 100644
--- a/src/checksum/checksum.c
+++ b/src/checksum/checksum.c
@@ -1103,6 +1103,7 @@ static const uint32_t g_crc_slicing[8][256] = {
#endif
};
+#if !defined(__powerpc64__)
/*
* __wt_cksum_sw --
* Return a checksum for a chunk of memory, computed in software.
@@ -1171,6 +1172,7 @@ __wt_cksum_sw(const void *chunk, size_t len)
#endif
return (~crc);
}
+#endif
#if (defined(__amd64) || defined(__x86_64))
/*
diff --git a/src/checksum/power8/crc32_wrapper.c b/src/checksum/power8/crc32_wrapper.c
index 34ac4150338..62bd3e64f5c 100644
--- a/src/checksum/power8/crc32_wrapper.c
+++ b/src/checksum/power8/crc32_wrapper.c
@@ -2,7 +2,7 @@
#define CRC_TABLE
#include "crc32_constants.h"
-#define VMX_ALIGN 16
+#define VMX_ALIGN 16U
#define VMX_ALIGN_MASK (VMX_ALIGN-1)
#ifdef REFLECT
@@ -26,6 +26,9 @@ static unsigned int crc32_align(unsigned int crc, unsigned char *p,
unsigned int __crc32_vpmsum(unsigned int crc, unsigned char *p,
unsigned long len);
+/* -Werror=missing-prototypes */
+unsigned int crc32_vpmsum(unsigned int crc, unsigned char *p,
+ unsigned long len);
unsigned int crc32_vpmsum(unsigned int crc, unsigned char *p,
unsigned long len)
{
diff --git a/src/cursor/cur_bulk.c b/src/cursor/cur_bulk.c
index c013383fa61..d1a53057650 100644
--- a/src/cursor/cur_bulk.c
+++ b/src/cursor/cur_bulk.c
@@ -328,7 +328,6 @@ __wt_curbulk_init(WT_SESSION_IMPL *session,
c->insert = skip_sort_check ?
__curbulk_insert_row_skip_check : __curbulk_insert_row;
break;
- WT_ILLEGAL_VALUE(session);
}
cbulk->first_insert = true;
diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c
index ffd48afd1a7..e9f113fdcb2 100644
--- a/src/evict/evict_file.c
+++ b/src/evict/evict_file.c
@@ -88,7 +88,8 @@ __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
break;
case WT_SYNC_CHECKPOINT:
case WT_SYNC_WRITE_LEAVES:
- WT_ILLEGAL_VALUE_ERR(session);
+ WT_ERR(__wt_illegal_value(session, NULL));
+ break;
}
}
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index 0c453c9856c..382d6ee1653 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -152,6 +152,7 @@ __wt_evict_server_wake(WT_SESSION_IMPL *session)
conn = S2C(session);
cache = conn->cache;
+#ifdef HAVE_VERBOSE
if (WT_VERBOSE_ISSET(session, WT_VERB_EVICTSERVER)) {
uint64_t bytes_inuse, bytes_max;
@@ -165,6 +166,7 @@ __wt_evict_server_wake(WT_SESSION_IMPL *session)
bytes_inuse <= bytes_max ? "<=" : ">",
bytes_max / WT_MEGABYTE));
}
+#endif
return (__wt_cond_auto_signal(session, cache->evict_cond));
}
@@ -328,6 +330,7 @@ __evict_workers_resize(WT_SESSION_IMPL *session)
uint32_t i, session_flags;
conn = S2C(session);
+ workers = NULL; /* -Wconditional-uninitialized */
if (conn->evict_workers_alloc < conn->evict_workers_max) {
alloc = conn->evict_workers_alloc * sizeof(*workers);
diff --git a/src/include/btree_cmp.i b/src/include/btree_cmp.i
index 1993c1be293..23a462e4e50 100644
--- a/src/include/btree_cmp.i
+++ b/src/include/btree_cmp.i
@@ -52,8 +52,8 @@ __wt_lex_compare(const WT_ITEM *user_item, const WT_ITEM *tree_item)
for (; len > 0;
len -= WT_VECTOR_SIZE,
userp += WT_VECTOR_SIZE, treep += WT_VECTOR_SIZE) {
- u = _mm_load_si128((__m128i *)userp);
- t = _mm_load_si128((__m128i *)treep);
+ u = _mm_load_si128((const __m128i *)userp);
+ t = _mm_load_si128((const __m128i *)treep);
res_eq = _mm_cmpeq_epi8(u, t);
if (_mm_movemask_epi8(res_eq) != 65535)
break;
@@ -62,8 +62,8 @@ __wt_lex_compare(const WT_ITEM *user_item, const WT_ITEM *tree_item)
for (; len > 0;
len -= WT_VECTOR_SIZE,
userp += WT_VECTOR_SIZE, treep += WT_VECTOR_SIZE) {
- u = _mm_loadu_si128((__m128i *)userp);
- t = _mm_loadu_si128((__m128i *)treep);
+ u = _mm_loadu_si128((const __m128i *)userp);
+ t = _mm_loadu_si128((const __m128i *)treep);
res_eq = _mm_cmpeq_epi8(u, t);
if (_mm_movemask_epi8(res_eq) != 65535)
break;
@@ -123,8 +123,8 @@ __wt_lex_compare_skip(
tsz = tree_item->size;
len = WT_MIN(usz, tsz) - *matchp;
- userp = (uint8_t *)user_item->data + *matchp;
- treep = (uint8_t *)tree_item->data + *matchp;
+ userp = (const uint8_t *)user_item->data + *matchp;
+ treep = (const uint8_t *)tree_item->data + *matchp;
#ifdef HAVE_X86INTRIN_H
/* Use vector instructions if we'll execute at least 2 of them. */
@@ -139,8 +139,8 @@ __wt_lex_compare_skip(
len -= WT_VECTOR_SIZE,
userp += WT_VECTOR_SIZE, treep += WT_VECTOR_SIZE,
*matchp += WT_VECTOR_SIZE) {
- u = _mm_load_si128((__m128i *)userp);
- t = _mm_load_si128((__m128i *)treep);
+ u = _mm_load_si128((const __m128i *)userp);
+ t = _mm_load_si128((const __m128i *)treep);
res_eq = _mm_cmpeq_epi8(u, t);
if (_mm_movemask_epi8(res_eq) != 65535)
break;
@@ -150,8 +150,8 @@ __wt_lex_compare_skip(
len -= WT_VECTOR_SIZE,
userp += WT_VECTOR_SIZE, treep += WT_VECTOR_SIZE,
*matchp += WT_VECTOR_SIZE) {
- u = _mm_loadu_si128((__m128i *)userp);
- t = _mm_loadu_si128((__m128i *)treep);
+ u = _mm_loadu_si128((const __m128i *)userp);
+ t = _mm_loadu_si128((const __m128i *)treep);
res_eq = _mm_cmpeq_epi8(u, t);
if (_mm_movemask_epi8(res_eq) != 65535)
break;
diff --git a/src/include/cell.i b/src/include/cell.i
index 481d2a29764..c130768e595 100644
--- a/src/include/cell.i
+++ b/src/include/cell.i
@@ -183,9 +183,9 @@ __wt_cell_pack_addr(WT_CELL *cell, u_int cell_type, uint64_t recno, size_t size)
p = cell->__chunk + 1;
if (recno == WT_RECNO_OOB)
- cell->__chunk[0] = cell_type; /* Type */
+ cell->__chunk[0] = (uint8_t)cell_type; /* Type */
else {
- cell->__chunk[0] = cell_type | WT_CELL_64V;
+ cell->__chunk[0] = (uint8_t)(cell_type | WT_CELL_64V);
(void)__wt_vpack_uint(&p, 0, recno); /* Record number */
}
(void)__wt_vpack_uint(&p, 0, (uint64_t)size); /* Length */
@@ -207,8 +207,8 @@ __wt_cell_pack_data(WT_CELL *cell, uint64_t rle, size_t size)
*/
if (rle < 2 && size <= WT_CELL_SHORT_MAX) {
byte = (uint8_t)size; /* Type + length */
- cell->__chunk[0] =
- (byte << WT_CELL_SHORT_SHIFT) | WT_CELL_VALUE_SHORT;
+ cell->__chunk[0] = (uint8_t)
+ ((byte << WT_CELL_SHORT_SHIFT) | WT_CELL_VALUE_SHORT);
return (1);
}
@@ -331,8 +331,8 @@ __wt_cell_pack_int_key(WT_CELL *cell, size_t size)
/* Short keys have 6 bits of data length in the descriptor byte. */
if (size <= WT_CELL_SHORT_MAX) {
byte = (uint8_t)size;
- cell->__chunk[0] =
- (byte << WT_CELL_SHORT_SHIFT) | WT_CELL_KEY_SHORT;
+ cell->__chunk[0] = (uint8_t)
+ ((byte << WT_CELL_SHORT_SHIFT) | WT_CELL_KEY_SHORT);
return (1);
}
@@ -358,14 +358,14 @@ __wt_cell_pack_leaf_key(WT_CELL *cell, uint8_t prefix, size_t size)
if (size <= WT_CELL_SHORT_MAX) {
if (prefix == 0) {
byte = (uint8_t)size; /* Type + length */
- cell->__chunk[0] =
- (byte << WT_CELL_SHORT_SHIFT) | WT_CELL_KEY_SHORT;
+ cell->__chunk[0] = (uint8_t)
+ ((byte << WT_CELL_SHORT_SHIFT) | WT_CELL_KEY_SHORT);
return (1);
} else {
byte = (uint8_t)size; /* Type + length */
- cell->__chunk[0] =
- (byte << WT_CELL_SHORT_SHIFT) |
- WT_CELL_KEY_SHORT_PFX;
+ cell->__chunk[0] = (uint8_t)
+ ((byte << WT_CELL_SHORT_SHIFT) |
+ WT_CELL_KEY_SHORT_PFX);
cell->__chunk[1] = prefix; /* Prefix */
return (2);
}
@@ -585,8 +585,8 @@ restart:
WT_CELL_LEN_CHK(cell, 0);
unpack->cell = cell;
unpack->v = 0;
- unpack->raw = __wt_cell_type_raw(cell);
- unpack->type = __wt_cell_type(cell);
+ unpack->raw = (uint8_t)__wt_cell_type_raw(cell);
+ unpack->type = (uint8_t)__wt_cell_type(cell);
unpack->ovfl = 0;
/*
diff --git a/src/include/extern.h b/src/include/extern.h
index 34751bfde6c..5bc36454c09 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -598,7 +598,14 @@ extern int __wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_FUNC_
extern int __wt_ext_msg_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4)));
extern const char *__wt_ext_strerror(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, int error);
extern int __wt_progress(WT_SESSION_IMPL *session, const char *s, uint64_t v);
-extern void __wt_assert(WT_SESSION_IMPL *session, int error, const char *file_name, int line_number, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 5, 6)));
+extern void
+__wt_assert(WT_SESSION_IMPL *session,
+ int error, const char *file_name, int line_number, const char *fmt, ...)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 5, 6)))
+#ifdef HAVE_DIAGNOSTIC
+ WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn))
+#endif
+;
extern int __wt_panic(WT_SESSION_IMPL *session);
extern int __wt_illegal_value(WT_SESSION_IMPL *session, const char *name);
extern int __wt_object_unsupported(WT_SESSION_IMPL *session, const char *uri);
diff --git a/src/include/misc.h b/src/include/misc.h
index 4c7c9572905..e33139387cf 100644
--- a/src/include/misc.h
+++ b/src/include/misc.h
@@ -31,12 +31,12 @@
*/
#define WT_STORE_SIZE(s) ((uint32_t)(s))
#define WT_PTRDIFF(end, begin) \
- ((size_t)((uint8_t *)(end) - (uint8_t *)(begin)))
+ ((size_t)((const uint8_t *)(end) - (const uint8_t *)(begin)))
#define WT_PTRDIFF32(end, begin) \
WT_STORE_SIZE(WT_PTRDIFF((end), (begin)))
#define WT_BLOCK_FITS(p, len, begin, maxlen) \
- ((uint8_t *)(p) >= (uint8_t *)(begin) && \
- ((uint8_t *)(p) + (len) <= (uint8_t *)(begin) + (maxlen)))
+ ((const uint8_t *)(p) >= (const uint8_t *)(begin) && \
+ ((const uint8_t *)(p) + (len) <= (const uint8_t *)(begin) + (maxlen)))
#define WT_PTR_IN_RANGE(p, begin, maxlen) \
WT_BLOCK_FITS((p), 1, (begin), (maxlen))
diff --git a/src/include/packing.i b/src/include/packing.i
index 9d5971ed99f..316169fbe06 100644
--- a/src/include/packing.i
+++ b/src/include/packing.i
@@ -540,7 +540,7 @@ __unpack_read(WT_SESSION_IMPL *session,
break;
case 'R':
WT_SIZE_CHECK_UNPACK(sizeof(uint64_t), maxlen);
- pv->u.u = *(uint64_t *)*pp;
+ pv->u.u = *(const uint64_t *)*pp;
*pp += sizeof(uint64_t);
break;
default:
diff --git a/src/meta/meta_track.c b/src/meta/meta_track.c
index 4fe628e319b..eb06b2bed66 100644
--- a/src/meta/meta_track.c
+++ b/src/meta/meta_track.c
@@ -153,7 +153,6 @@ __meta_track_apply(WT_SESSION_IMPL *session, WT_META_TRACK *trk)
case WT_ST_REMOVE:
case WT_ST_SET:
break;
- WT_ILLEGAL_VALUE(session);
}
__meta_track_clear(session, trk);
@@ -215,7 +214,6 @@ __meta_track_unroll(WT_SESSION_IMPL *session, WT_META_TRACK *trk)
__wt_err(session, ret,
"metadata unroll update %s to %s", trk->a, trk->b);
break;
- WT_ILLEGAL_VALUE(session);
}
__meta_track_clear(session, trk);
diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c
index 6e406fc7180..b49946bb10e 100644
--- a/src/reconcile/rec_write.c
+++ b/src/reconcile/rec_write.c
@@ -1041,6 +1041,7 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
bool append_origv, skipped;
*updp = NULL;
+ append = NULL; /* -Wconditional-uninitialized */
btree = S2BT(session);
page = r->page;
@@ -2428,7 +2429,7 @@ __rec_split(WT_SESSION_IMPL *session, WT_RECONCILE *r, size_t next_len)
r->split_size - WT_PAGE_HEADER_BYTE_SIZE(btree);
break;
case SPLIT_TRACKING_RAW:
- WT_ILLEGAL_VALUE(session);
+ return (__wt_illegal_value(session, NULL));
}
/*
@@ -2959,7 +2960,6 @@ __rec_split_finish_std(WT_SESSION_IMPL *session, WT_RECONCILE *r)
* wrote anything, or there's a remaindered block of data.
*/
break;
- WT_ILLEGAL_VALUE(session);
}
/*
@@ -3330,6 +3330,8 @@ supd_check_complete:
}
bnd->entries = r->entries;
+
+#ifdef HAVE_VERBOSE
/* Output a verbose message if we create a page without many entries */
if (WT_VERBOSE_ISSET(session, WT_VERB_SPLIT) && r->entries < 6)
WT_ERR(__wt_verbose(session, WT_VERB_SPLIT,
@@ -3339,6 +3341,7 @@ supd_check_complete:
r->entries, r->page->memory_footprint, r->bnd_next,
F_ISSET(r, WT_EVICTING) ? "evict" : "checkpoint",
r->bnd_state));
+#endif
WT_ERR(__wt_bt_write(session,
buf, addr, &addr_size, false, bnd->already_compressed));
@@ -3527,6 +3530,7 @@ __wt_bulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
r = cbulk->reconcile;
r->is_bulk_load = true;
+ recno = WT_RECNO_OOB; /* -Werror=maybe-uninitialized */
switch (btree->type) {
case BTREE_COL_FIX:
case BTREE_COL_VAR:
@@ -3535,7 +3539,6 @@ __wt_bulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
case BTREE_ROW:
recno = WT_RECNO_OOB;
break;
- WT_ILLEGAL_VALUE(session);
}
return (__rec_split_init(
@@ -3569,7 +3572,6 @@ __wt_bulk_wrapup(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
break;
case BTREE_ROW:
break;
- WT_ILLEGAL_VALUE(session);
}
WT_RET(__rec_split_finish(session, r));
diff --git a/src/schema/schema_list.c b/src/schema/schema_list.c
index 5e9caf94b7a..79e3ef1da7c 100644
--- a/src/schema/schema_list.c
+++ b/src/schema/schema_list.c
@@ -20,6 +20,8 @@ __schema_add_table(WT_SESSION_IMPL *session,
WT_TABLE *table;
uint64_t bucket;
+ table = NULL; /* -Wconditional-uninitialized */
+
/* Make sure the metadata is open before getting other locks. */
WT_RET(__wt_metadata_cursor(session, NULL));
diff --git a/src/support/err.c b/src/support/err.c
index 815b79c16db..93c0af37328 100644
--- a/src/support/err.c
+++ b/src/support/err.c
@@ -469,6 +469,9 @@ void
__wt_assert(WT_SESSION_IMPL *session,
int error, const char *file_name, int line_number, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format (printf, 5, 6)))
+#ifdef HAVE_DIAGNOSTIC
+ WT_GCC_FUNC_ATTRIBUTE((noreturn))
+#endif
{
va_list ap;
@@ -493,7 +496,10 @@ __wt_panic(WT_SESSION_IMPL *session)
F_SET(S2C(session), WT_CONN_PANIC);
__wt_err(session, WT_PANIC, "the process must exit and restart");
-#if !defined(HAVE_DIAGNOSTIC)
+#if defined(HAVE_DIAGNOSTIC)
+ __wt_abort(session); /* Drop core if testing. */
+ /* NOTREACHED */
+#else
/*
* Chaos reigns within.
* Reflect, repent, and reboot.
@@ -501,9 +507,6 @@ __wt_panic(WT_SESSION_IMPL *session)
*/
return (WT_PANIC);
#endif
-
- __wt_abort(session); /* Drop core if testing. */
- /* NOTREACHED */
}
/*
@@ -517,12 +520,12 @@ __wt_illegal_value(WT_SESSION_IMPL *session, const char *name)
name == NULL ? "" : name, name == NULL ? "" : ": ",
"encountered an illegal file format or internal value");
-#if !defined(HAVE_DIAGNOSTIC)
- return (__wt_panic(session));
-#endif
-
+#if defined(HAVE_DIAGNOSTIC)
__wt_abort(session); /* Drop core if testing. */
/* NOTREACHED */
+#else
+ return (__wt_panic(session));
+#endif
}
/*
diff --git a/src/support/hash_city.c b/src/support/hash_city.c
index 7a700aa809c..8354532e820 100644
--- a/src/support/hash_city.c
+++ b/src/support/hash_city.c
@@ -85,6 +85,7 @@ static uint32_t UNALIGNED_LOAD32(const char *p) {
return (result);
}
+#ifdef WORDS_BIGENDIAN
#ifdef _MSC_VER
#include <stdlib.h>
@@ -132,7 +133,6 @@ static uint32_t UNALIGNED_LOAD32(const char *p) {
#endif
-#ifdef WORDS_BIGENDIAN
#define uint32_in_expected_order(x) (bswap_32(x))
#define uint64_in_expected_order(x) (bswap_64(x))
#else
diff --git a/src/support/hazard.c b/src/support/hazard.c
index 13e0eb3b9ac..dee85586a4d 100644
--- a/src/support/hazard.c
+++ b/src/support/hazard.c
@@ -121,7 +121,8 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp
return (0);
}
- __wt_errx(session, "session %p: hazard pointer table full", session);
+ __wt_errx(session,
+ "session %p: hazard pointer table full", (void *)session);
#ifdef HAVE_DIAGNOSTIC
__hazard_dump(session);
#endif
@@ -176,7 +177,8 @@ __wt_hazard_clear(WT_SESSION_IMPL *session, WT_PAGE *page)
* because using a page we didn't have pinned down implies corruption.
*/
WT_PANIC_RET(session, EINVAL,
- "session %p: clear hazard pointer: %p: not found", session, page);
+ "session %p: clear hazard pointer: %p: not found",
+ (void *)session, (void *)page);
}
/*
@@ -204,7 +206,8 @@ __wt_hazard_close(WT_SESSION_IMPL *session)
return;
__wt_errx(session,
- "session %p: close hazard pointer table: table not empty", session);
+ "session %p: close hazard pointer table: table not empty",
+ (void *)session);
#ifdef HAVE_DIAGNOSTIC
__hazard_dump(session);
@@ -232,7 +235,7 @@ __wt_hazard_close(WT_SESSION_IMPL *session)
__wt_errx(session,
"session %p: close hazard pointer table: count didn't "
"match entries",
- session);
+ (void *)session);
}
#ifdef HAVE_DIAGNOSTIC
@@ -250,6 +253,7 @@ __hazard_dump(WT_SESSION_IMPL *session)
if (hp->page != NULL)
__wt_errx(session,
"session %p: hazard pointer %p: %s, line %d",
- session, hp->page, hp->file, hp->line);
+ (void *)session,
+ (void *)hp->page, hp->file, hp->line);
}
#endif
diff --git a/src/support/huffman.c b/src/support/huffman.c
index 1e1aaeab5b5..3f35f301935 100644
--- a/src/support/huffman.c
+++ b/src/support/huffman.c
@@ -230,19 +230,19 @@ set_codes(WT_FREQTREE_NODE *node,
* lower-order bits for consecutive numbering.
*/
if (len < MAX_CODE_LENGTH &&
- ((half = 1 << (remaining - 1)) < node->left->weight ||
- half < node->right->weight)) {
- pattern = pattern << remaining;
+ ((half = (uint16_t)(1 << (remaining - 1))) <
+ node->left->weight || half < node->right->weight)) {
+ pattern = (uint16_t)(pattern << remaining);
len = MAX_CODE_LENGTH;
}
if (len < MAX_CODE_LENGTH) {
- patternleft = (pattern << 1) | 0;
- patternright = (pattern << 1) | 1;
+ patternleft = (uint16_t)((pattern << 1) | 0);
+ patternright = (uint16_t)((pattern << 1) | 1);
len++;
} else { /* "low bit mode" */
patternleft = pattern;
- patternright = pattern + node->left->weight;
+ patternright = (uint16_t)(pattern + node->left->weight);
/* len unchanged */
}
@@ -284,12 +284,12 @@ make_table(WT_SESSION_IMPL *session, uint8_t *code2symbol,
* than necessary, we allocate (2 ^ max-code-length) of them.
*/
c = codes[i].pattern;
- shift = max_depth - len;
+ shift = (uint8_t)(max_depth - len);
c1 = (uint32_t)c << shift;
c2 = (uint32_t)(c + 1) << shift;
for (j = c1; j < c2; j++) {
WT_ASSERT(session, code2symbol[j] == 0);
- code2symbol[j] = i;
+ code2symbol[j] = (uint8_t)i;
}
}
}
@@ -694,7 +694,7 @@ __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg,
* used in the last byte, unless they're 0, in which case there are 8
* bits used in the last byte.
*/
- padding_info = (bitpos % 8) << (8 - WT_HUFFMAN_HEADER);
+ padding_info = (uint8_t)((bitpos % 8) << (8 - WT_HUFFMAN_HEADER));
((uint8_t *)tmp->mem)[0] |= padding_info;
/* Copy result of exact known size into caller's buffer. */
@@ -808,8 +808,9 @@ __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg,
valid += 8;
from_bytes--;
}
- pattern = valid >= max ? /* short patterns near end */
- (bits >> (valid - max)) : (bits << (max - valid));
+ pattern = (uint16_t)
+ (valid >= max ? /* short patterns near end */
+ (bits >> (valid - max)) : (bits << (max - valid)));
symbol = huffman->code2symbol[pattern & mask];
len = huffman->codes[symbol].length;
valid -= len;
diff --git a/src/txn/txn.c b/src/txn/txn.c
index a2ae97fbd20..d48bb65dea8 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -343,6 +343,7 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force)
if (WT_TXNID_LT(txn_global->last_running, last_running)) {
txn_global->last_running = last_running;
+#ifdef HAVE_VERBOSE
/* Output a verbose message about long-running transactions,
* but only when some progress is being made. */
if (WT_VERBOSE_ISSET(session, WT_VERB_TRANSACTION) &&
@@ -355,6 +356,7 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force)
oldest_session->lastop,
oldest_session->txn.snap_min));
}
+#endif
}
done: WT_TRET(__wt_writeunlock(session, txn_global->scan_rwlock));
diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c
index da2670fb344..470515244f3 100644
--- a/src/txn/txn_log.c
+++ b/src/txn/txn_log.c
@@ -156,6 +156,7 @@ err: __wt_logrec_free(session, &logrec);
int
__wt_txn_log_op(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt)
{
+ WT_DECL_RET;
WT_ITEM *logrec;
WT_TXN *txn;
WT_TXN_OP *op;
@@ -179,24 +180,25 @@ __wt_txn_log_op(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt)
switch (op->type) {
case WT_TXN_OP_BASIC:
- return (__txn_op_log(session, logrec, op, cbt));
+ ret = __txn_op_log(session, logrec, op, cbt);
+ break;
case WT_TXN_OP_INMEM:
case WT_TXN_OP_REF:
/* Nothing to log, we're done. */
- return (0);
+ break;
case WT_TXN_OP_TRUNCATE_COL:
- return (__wt_logop_col_truncate_pack(session, logrec,
+ ret = __wt_logop_col_truncate_pack(session, logrec,
op->fileid,
- op->u.truncate_col.start, op->u.truncate_col.stop));
+ op->u.truncate_col.start, op->u.truncate_col.stop);
+ break;
case WT_TXN_OP_TRUNCATE_ROW:
- return (__wt_logop_row_truncate_pack(session, txn->logrec,
+ ret = __wt_logop_row_truncate_pack(session, txn->logrec,
op->fileid,
&op->u.truncate_row.start, &op->u.truncate_row.stop,
- (uint32_t)op->u.truncate_row.mode));
- WT_ILLEGAL_VALUE(session);
+ (uint32_t)op->u.truncate_row.mode);
+ break;
}
-
- /* NOTREACHED */
+ return (ret);
}
/*