Home | History | Annotate | Download | only in internal
      1 /*
      2  * Define a custom assert() in order to reduce the chances of deadlock during
      3  * assertion failure.
      4  */
      5 #ifndef assert
      6 #define	assert(e) do {							\
      7 	if (unlikely(config_debug && !(e))) {				\
      8 		malloc_printf(						\
      9 		    "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n",	\
     10 		    __FILE__, __LINE__, #e);				\
     11 		abort();						\
     12 	}								\
     13 } while (0)
     14 #endif
     15 
     16 #ifndef not_reached
     17 #define	not_reached() do {						\
     18 	if (config_debug) {						\
     19 		malloc_printf(						\
     20 		    "<jemalloc>: %s:%d: Unreachable code reached\n",	\
     21 		    __FILE__, __LINE__);				\
     22 		abort();						\
     23 	}								\
     24 	unreachable();							\
     25 } while (0)
     26 #endif
     27 
     28 #ifndef not_implemented
     29 #define	not_implemented() do {						\
     30 	if (config_debug) {						\
     31 		malloc_printf("<jemalloc>: %s:%d: Not implemented\n",	\
     32 		    __FILE__, __LINE__);				\
     33 		abort();						\
     34 	}								\
     35 } while (0)
     36 #endif
     37 
     38 #ifndef assert_not_implemented
     39 #define	assert_not_implemented(e) do {					\
     40 	if (unlikely(config_debug && !(e)))				\
     41 		not_implemented();					\
     42 } while (0)
     43 #endif
     44 
     45 
     46