summaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/jemalloc_internal_macros.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-01-22 11:11:22 -0800
committerJason Evans <jasone@canonware.com>2014-01-22 11:11:22 -0800
commitcc47dde16203a6ae7eb685b53e1ae501f3869bc6 (patch)
tree74e81d65651b2ca7e294a857797dda6635177454 /include/jemalloc/internal/jemalloc_internal_macros.h
parent0135fb806e4137dc9cdf152541926a2bc95e33f0 (diff)
parent798a48103014aabf8afb3d7efff90399a466dd8c (diff)
downloadjemalloc-3.5.0.tar.gz
Merge branch 'dev'3.5.0
Diffstat (limited to 'include/jemalloc/internal/jemalloc_internal_macros.h')
-rw-r--r--include/jemalloc/internal/jemalloc_internal_macros.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_macros.h b/include/jemalloc/internal/jemalloc_internal_macros.h
new file mode 100644
index 00000000..70602ee8
--- /dev/null
+++ b/include/jemalloc/internal/jemalloc_internal_macros.h
@@ -0,0 +1,47 @@
+/*
+ * JEMALLOC_ALWAYS_INLINE and JEMALLOC_INLINE are used within header files for
+ * functions that are static inline functions if inlining is enabled, and
+ * single-definition library-private functions if inlining is disabled.
+ *
+ * JEMALLOC_ALWAYS_INLINE_C and JEMALLOC_INLINE_C are for use in .c files, in
+ * which case the denoted functions are always static, regardless of whether
+ * inlining is enabled.
+ */
+#if defined(JEMALLOC_DEBUG) || defined(JEMALLOC_CODE_COVERAGE)
+ /* Disable inlining to make debugging/profiling easier. */
+# define JEMALLOC_ALWAYS_INLINE
+# define JEMALLOC_ALWAYS_INLINE_C static
+# define JEMALLOC_INLINE
+# define JEMALLOC_INLINE_C static
+# define inline
+#else
+# define JEMALLOC_ENABLE_INLINE
+# ifdef JEMALLOC_HAVE_ATTR
+# define JEMALLOC_ALWAYS_INLINE \
+ static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline)
+# define JEMALLOC_ALWAYS_INLINE_C \
+ static inline JEMALLOC_ATTR(always_inline)
+# else
+# define JEMALLOC_ALWAYS_INLINE static inline
+# define JEMALLOC_ALWAYS_INLINE_C static inline
+# endif
+# define JEMALLOC_INLINE static inline
+# define JEMALLOC_INLINE_C static inline
+# ifdef _MSC_VER
+# define inline _inline
+# endif
+#endif
+
+#ifdef JEMALLOC_CC_SILENCE
+# define UNUSED JEMALLOC_ATTR(unused)
+#else
+# define UNUSED
+#endif
+
+#define ZU(z) ((size_t)z)
+#define QU(q) ((uint64_t)q)
+#define QI(q) ((int64_t)q)
+
+#ifndef __DECONST
+# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
+#endif