diff options
author | Jason Evans <je@fb.com> | 2015-11-12 19:06:41 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2015-11-12 19:06:41 (GMT) |
commit | f9e3459f751b08b3c2108fda7462827cf8a4f2af (patch) | |
tree | cf0fc3b4cf73bf05da362427b9899b8e425aed66 /include | |
parent | a6ec1c869e1abe3eb70616d19d3e553339449636 (diff) | |
download | jemalloc-f9e3459f751b08b3c2108fda7462827cf8a4f2af.zip jemalloc-f9e3459f751b08b3c2108fda7462827cf8a4f2af.tar.gz jemalloc-f9e3459f751b08b3c2108fda7462827cf8a4f2af.tar.bz2 |
Tweak code to allow compilation of concatenated src/*.c sources.
This resolves #294.
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/internal/assert.h | 45 | ||||
-rw-r--r-- | include/jemalloc/internal/util.h | 44 |
2 files changed, 46 insertions, 43 deletions
diff --git a/include/jemalloc/internal/assert.h b/include/jemalloc/internal/assert.h new file mode 100644 index 0000000..6f8f7eb --- /dev/null +++ b/include/jemalloc/internal/assert.h @@ -0,0 +1,45 @@ +/* + * Define a custom assert() in order to reduce the chances of deadlock during + * assertion failure. + */ +#ifndef assert +#define assert(e) do { \ + if (unlikely(config_debug && !(e))) { \ + malloc_printf( \ + "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \ + __FILE__, __LINE__, #e); \ + abort(); \ + } \ +} while (0) +#endif + +#ifndef not_reached +#define not_reached() do { \ + if (config_debug) { \ + malloc_printf( \ + "<jemalloc>: %s:%d: Unreachable code reached\n", \ + __FILE__, __LINE__); \ + abort(); \ + } \ + unreachable(); \ +} while (0) +#endif + +#ifndef not_implemented +#define not_implemented() do { \ + if (config_debug) { \ + malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \ + __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) +#endif + +#ifndef assert_not_implemented +#define assert_not_implemented(e) do { \ + if (unlikely(config_debug && !(e))) \ + not_implemented(); \ +} while (0) +#endif + + diff --git a/include/jemalloc/internal/util.h b/include/jemalloc/internal/util.h index b2ea740..0bccea2 100644 --- a/include/jemalloc/internal/util.h +++ b/include/jemalloc/internal/util.h @@ -81,49 +81,7 @@ # define unreachable() #endif -/* - * Define a custom assert() in order to reduce the chances of deadlock during - * assertion failure. - */ -#ifndef assert -#define assert(e) do { \ - if (unlikely(config_debug && !(e))) { \ - malloc_printf( \ - "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \ - __FILE__, __LINE__, #e); \ - abort(); \ - } \ -} while (0) -#endif - -#ifndef not_reached -#define not_reached() do { \ - if (config_debug) { \ - malloc_printf( \ - "<jemalloc>: %s:%d: Unreachable code reached\n", \ - __FILE__, __LINE__); \ - abort(); \ - } \ - unreachable(); \ -} while (0) -#endif - -#ifndef not_implemented -#define not_implemented() do { \ - if (config_debug) { \ - malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \ - __FILE__, __LINE__); \ - abort(); \ - } \ -} while (0) -#endif - -#ifndef assert_not_implemented -#define assert_not_implemented(e) do { \ - if (unlikely(config_debug && !(e))) \ - not_implemented(); \ -} while (0) -#endif +#include "jemalloc/internal/assert.h" /* Use to assert a particular configuration, e.g., cassert(config_debug). */ #define cassert(c) do { \ |