summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/nimbase.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h
index 52de60969..a75016ed7 100644
--- a/lib/nimbase.h
+++ b/lib/nimbase.h
@@ -459,3 +459,11 @@ typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == siz
 #elif defined(__FreeBSD__)
 #  include <sys/types.h>
 #endif
+
+/* Compile with -t:-DNIM_CHECK_ABI to enable */
+#ifdef NIM_CHECK_ABI
+#  define NIM_CHECK_SIZE(typ, sz) \
+  _Static_assert(sizeof(typ) == sz, "Nim & C disagree on type size")
+#else
+#  define NIM_CHECK_SIZE(typ, sz)
+#endif