|
19 | 19 | # include <pthread.h> |
20 | 20 | #endif |
21 | 21 |
|
22 | | -/******************************************************************************/ |
23 | | -/* |
24 | | - * Define always-enabled assertion macros, so that test assertions execute even |
25 | | - * if assertions are disabled in the library code. These definitions must |
26 | | - * exist prior to including "jemalloc/internal/util.h". |
27 | | - */ |
28 | | -#define assert(e) do { \ |
29 | | - if (!(e)) { \ |
30 | | - malloc_printf( \ |
31 | | - "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \ |
32 | | - __FILE__, __LINE__, #e); \ |
33 | | - abort(); \ |
34 | | - } \ |
35 | | -} while (0) |
36 | | - |
37 | | -#define not_reached() do { \ |
38 | | - malloc_printf( \ |
39 | | - "<jemalloc>: %s:%d: Unreachable code reached\n", \ |
40 | | - __FILE__, __LINE__); \ |
41 | | - abort(); \ |
42 | | -} while (0) |
43 | | - |
44 | | -#define not_implemented() do { \ |
45 | | - malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \ |
46 | | - __FILE__, __LINE__); \ |
47 | | - abort(); \ |
48 | | -} while (0) |
49 | | - |
50 | | -#define assert_not_implemented(e) do { \ |
51 | | - if (!(e)) \ |
52 | | - not_implemented(); \ |
53 | | -} while (0) |
54 | | - |
55 | 22 | #include "test/jemalloc_test_defs.h" |
56 | 23 |
|
57 | 24 | #ifdef JEMALLOC_OSSPIN |
|
86 | 53 | # include "jemalloc/internal/jemalloc_internal_defs.h" |
87 | 54 | # include "jemalloc/internal/jemalloc_internal_macros.h" |
88 | 55 |
|
| 56 | +static const bool config_debug = |
| 57 | +#ifdef JEMALLOC_DEBUG |
| 58 | + true |
| 59 | +#else |
| 60 | + false |
| 61 | +#endif |
| 62 | + ; |
| 63 | + |
89 | 64 | # define JEMALLOC_N(n) @private_namespace@##n |
90 | 65 | # include "jemalloc/internal/private_namespace.h" |
91 | 66 |
|
|
149 | 124 | #include "test/thd.h" |
150 | 125 | #define MEXP 19937 |
151 | 126 | #include "test/SFMT.h" |
| 127 | + |
| 128 | +/******************************************************************************/ |
| 129 | +/* |
| 130 | + * Define always-enabled assertion macros, so that test assertions execute even |
| 131 | + * if assertions are disabled in the library code. |
| 132 | + */ |
| 133 | +#undef assert |
| 134 | +#undef not_reached |
| 135 | +#undef not_implemented |
| 136 | +#undef assert_not_implemented |
| 137 | + |
| 138 | +#define assert(e) do { \ |
| 139 | + if (!(e)) { \ |
| 140 | + malloc_printf( \ |
| 141 | + "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \ |
| 142 | + __FILE__, __LINE__, #e); \ |
| 143 | + abort(); \ |
| 144 | + } \ |
| 145 | +} while (0) |
| 146 | + |
| 147 | +#define not_reached() do { \ |
| 148 | + malloc_printf( \ |
| 149 | + "<jemalloc>: %s:%d: Unreachable code reached\n", \ |
| 150 | + __FILE__, __LINE__); \ |
| 151 | + abort(); \ |
| 152 | +} while (0) |
| 153 | + |
| 154 | +#define not_implemented() do { \ |
| 155 | + malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \ |
| 156 | + __FILE__, __LINE__); \ |
| 157 | + abort(); \ |
| 158 | +} while (0) |
| 159 | + |
| 160 | +#define assert_not_implemented(e) do { \ |
| 161 | + if (!(e)) \ |
| 162 | + not_implemented(); \ |
| 163 | +} while (0) |
0 commit comments