summaryrefslogtreecommitdiffstats
path: root/include/jemalloc/internal/assert.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-06-13 19:49:58 (GMT)
committerJason Evans <jasone@canonware.com>2017-06-13 19:51:09 (GMT)
commit5018fe3f0979b7f9db9930accdf7ee31071fd703 (patch)
tree894055b5ff4ccde3d9d782861d45af4664f12ad2 /include/jemalloc/internal/assert.h
parent04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5 (diff)
parentba29113e5a58caeb6b4a65b1db6d8efae79cae45 (diff)
downloadjemalloc-5.0.0.zip
jemalloc-5.0.0.tar.gz
jemalloc-5.0.0.tar.bz2
Merge branch 'dev'5.0.0
Diffstat (limited to 'include/jemalloc/internal/assert.h')
-rw-r--r--include/jemalloc/internal/assert.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/jemalloc/internal/assert.h b/include/jemalloc/internal/assert.h
index 6f8f7eb..be4d45b 100644
--- a/include/jemalloc/internal/assert.h
+++ b/include/jemalloc/internal/assert.h
@@ -1,9 +1,12 @@
+#include "jemalloc/internal/malloc_io.h"
+#include "jemalloc/internal/util.h"
+
/*
* Define a custom assert() in order to reduce the chances of deadlock during
* assertion failure.
*/
#ifndef assert
-#define assert(e) do { \
+#define assert(e) do { \
if (unlikely(config_debug && !(e))) { \
malloc_printf( \
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
@@ -14,7 +17,7 @@
#endif
#ifndef not_reached
-#define not_reached() do { \
+#define not_reached() do { \
if (config_debug) { \
malloc_printf( \
"<jemalloc>: %s:%d: Unreachable code reached\n", \
@@ -26,7 +29,7 @@
#endif
#ifndef not_implemented
-#define not_implemented() do { \
+#define not_implemented() do { \
if (config_debug) { \
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
__FILE__, __LINE__); \
@@ -36,10 +39,18 @@
#endif
#ifndef assert_not_implemented
-#define assert_not_implemented(e) do { \
- if (unlikely(config_debug && !(e))) \
+#define assert_not_implemented(e) do { \
+ if (unlikely(config_debug && !(e))) { \
not_implemented(); \
+ } \
} while (0)
#endif
-
+/* Use to assert a particular configuration, e.g., cassert(config_debug). */
+#ifndef cassert
+#define cassert(c) do { \
+ if (unlikely(!(c))) { \
+ not_reached(); \
+ } \
+} while (0)
+#endif