1 #ifndef JEMALLOC_INTERNAL_MACROS_H 2 #define JEMALLOC_INTERNAL_MACROS_H 3 4 /* 5 * JEMALLOC_ALWAYS_INLINE and JEMALLOC_INLINE are used within header files for 6 * functions that are static inline functions if inlining is enabled, and 7 * single-definition library-private functions if inlining is disabled. 8 * 9 * JEMALLOC_ALWAYS_INLINE_C and JEMALLOC_INLINE_C are for use in .c files, in 10 * which case the denoted functions are always static, regardless of whether 11 * inlining is enabled. 12 */ 13 #if defined(JEMALLOC_DEBUG) || defined(JEMALLOC_CODE_COVERAGE) 14 /* Disable inlining to make debugging/profiling easier. */ 15 # define JEMALLOC_ALWAYS_INLINE 16 # define JEMALLOC_ALWAYS_INLINE_C static 17 # define JEMALLOC_INLINE 18 # define JEMALLOC_INLINE_C static 19 # define inline 20 #else 21 # define JEMALLOC_ENABLE_INLINE 22 # ifdef JEMALLOC_HAVE_ATTR 23 # define JEMALLOC_ALWAYS_INLINE \ 24 static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline) 25 # define JEMALLOC_ALWAYS_INLINE_C \ 26 static inline JEMALLOC_ATTR(always_inline) 27 # else 28 # define JEMALLOC_ALWAYS_INLINE static inline 29 # define JEMALLOC_ALWAYS_INLINE_C static inline 30 # endif 31 # define JEMALLOC_INLINE static inline 32 # define JEMALLOC_INLINE_C static inline 33 # ifdef _MSC_VER 34 # define inline _inline 35 # endif 36 #endif 37 38 #ifdef JEMALLOC_CC_SILENCE 39 # define UNUSED JEMALLOC_ATTR(unused) 40 #else 41 # define UNUSED 42 #endif 43 44 #define ZU(z) ((size_t)z) 45 #define ZI(z) ((ssize_t)z) 46 #define QU(q) ((uint64_t)q) 47 #define QI(q) ((int64_t)q) 48 49 #define KZU(z) ZU(z##ULL) 50 #define KZI(z) ZI(z##LL) 51 #define KQU(q) QU(q##ULL) 52 #define KQI(q) QI(q##LL) 53 54 #ifndef __DECONST 55 # define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) 56 #endif 57 58 #if !defined(JEMALLOC_HAS_RESTRICT) || defined(__cplusplus) 59 # define restrict 60 #endif 61 62 #endif /* JEMALLOC_INTERNAL_MACROS_H */ 63