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