aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_ptr_slow.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-03-22 12:57:58 +0200
committerrl1987 <rl1987@sdf.lonestar.org>2019-03-22 12:57:58 +0200
commit13b28063f9f2a3d2a587eabac358452a42277052 (patch)
tree20a149f6fc566576f0a526b5e82264629de272fd /src/test/test_ptr_slow.c
parent72e0dc0822deb8587b3cae2edf584ece13cb6bb8 (diff)
downloadtor-13b28063f9f2a3d2a587eabac358452a42277052.tar.gz
tor-13b28063f9f2a3d2a587eabac358452a42277052.zip
Compile time check for being able to fit {unsigned} int inside void pointer
Diffstat (limited to 'src/test/test_ptr_slow.c')
-rw-r--r--src/test/test_ptr_slow.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test_ptr_slow.c b/src/test/test_ptr_slow.c
index 0142fd1c8a..37560d4359 100644
--- a/src/test/test_ptr_slow.c
+++ b/src/test/test_ptr_slow.c
@@ -11,6 +11,15 @@
#include <stdint.h>
#include <limits.h>
+#if SIZEOF_INT > SIZEOF_VOID_P
+#error "sizeof(int) > sizeof(void *) - Tor cannot be built on this platform!"
+#endif
+
+#if SIZEOF_UNSIGNED_INT > SIZEOF_VOID_P
+#error "sizeof(unsigned int) > sizeof(void *) - Tor cannot be built on this \
+platform!"
+#endif
+
/** Assert that <b>a</b> can be cast to void * and back. */
static void
assert_int_voidptr_roundtrip(int a)