summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/include/verify_build.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/include/verify_build.h')
-rw-r--r--src/third_party/wiredtiger/src/include/verify_build.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/src/include/verify_build.h b/src/third_party/wiredtiger/src/include/verify_build.h
index 477b9b7c134..8abc192892e 100644
--- a/src/third_party/wiredtiger/src/include/verify_build.h
+++ b/src/third_party/wiredtiger/src/include/verify_build.h
@@ -6,9 +6,6 @@
* See the file LICENSE for redistribution information.
*/
-#undef ALIGN_CHECK
-#undef SIZE_CHECK
-
/*
* NOTE: If you see a compile failure in this file, your compiler is laying out
* structs in memory in a way WiredTiger does not expect. Please refer to the
@@ -36,12 +33,12 @@
*/
#define WT_STATIC_ASSERT(cond) (void)sizeof(char[1 - 2 * !(cond)])
-#define SIZE_CHECK(type, e) do { \
+#define WT_SIZE_CHECK(type, e) do { \
char __check_##type[1 - 2 * !(sizeof(type) == (e))]; \
(void)__check_##type; \
} while (0)
-#define ALIGN_CHECK(type, a) \
+#define WT_ALIGN_CHECK(type, a) \
WT_STATIC_ASSERT(WT_ALIGN(sizeof(type), (a)) == sizeof(type))
/*
@@ -53,8 +50,18 @@ static inline void
__wt_verify_build(void)
{
/* Check specific structures weren't padded. */
- SIZE_CHECK(WT_BLOCK_DESC, WT_BLOCK_DESC_SIZE);
- SIZE_CHECK(WT_REF, WT_REF_SIZE);
+ WT_SIZE_CHECK(WT_BLOCK_DESC, WT_BLOCK_DESC_SIZE);
+ WT_SIZE_CHECK(WT_REF, WT_REF_SIZE);
+
+ /* Check specific structures were padded. */
+#define WT_PADDING_CHECK(s) \
+ WT_STATIC_ASSERT( \
+ sizeof(s) > WT_CACHE_LINE_ALIGNMENT || \
+ sizeof(s) % WT_CACHE_LINE_ALIGNMENT == 0)
+ WT_PADDING_CHECK(WT_LOGSLOT);
+ WT_PADDING_CHECK(WT_RWLOCK);
+ WT_PADDING_CHECK(WT_SPINLOCK);
+ WT_PADDING_CHECK(WT_TXN_STATE);
/*
* The btree code encodes key/value pairs in size_t's, and requires at
@@ -71,6 +78,3 @@ __wt_verify_build(void)
*/
WT_STATIC_ASSERT(sizeof(wt_off_t) == 8);
}
-
-#undef ALIGN_CHECK
-#undef SIZE_CHECK