summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2012-03-23 22:39:07 (GMT)
committerJason Evans <je@fb.com>2012-03-23 22:39:07 (GMT)
commit9225a1991a58190207cca2ff3cdba966bb322dd5 (patch)
tree147177dd0007189a37c1399d2ecea502b2f56a7b /include
parentcd9a1346e96f71bdecdc654ea50fc62d76371e74 (diff)
downloadjemalloc-9225a1991a58190207cca2ff3cdba966bb322dd5.zip
jemalloc-9225a1991a58190207cca2ff3cdba966bb322dd5.tar.gz
jemalloc-9225a1991a58190207cca2ff3cdba966bb322dd5.tar.bz2
Add JEMALLOC_CC_SILENCE_INIT().
Add JEMALLOC_CC_SILENCE_INIT(), which provides succinct syntax for initializing a variable to avoid a spurious compiler warning.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in6
-rw-r--r--include/jemalloc/internal/util.h11
2 files changed, 12 insertions, 5 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index 387aabb..e055814 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -611,11 +611,7 @@ ipalloc(size_t usize, size_t alignment, bool zero)
if (usize <= arena_maxclass && alignment <= PAGE_SIZE)
ret = arena_malloc(usize, zero);
else {
- size_t run_size
-#ifdef JEMALLOC_CC_SILENCE
- = 0
-#endif
- ;
+ size_t run_size JEMALLOC_CC_SILENCE_INIT(0);
/*
* Ideally we would only ever call sa2u() once per aligned
diff --git a/include/jemalloc/internal/util.h b/include/jemalloc/internal/util.h
index fb354da..5156399 100644
--- a/include/jemalloc/internal/util.h
+++ b/include/jemalloc/internal/util.h
@@ -17,6 +17,17 @@
#define JEMALLOC_CONCAT(...) __VA_ARGS__
/*
+ * Silence compiler warnings due to uninitialized values. This is used
+ * wherever the compiler fails to recognize that the variable is never used
+ * uninitialized.
+ */
+#ifdef JEMALLOC_CC_SILENCE
+# define JEMALLOC_CC_SILENCE_INIT(v) = v
+#else
+# define JEMALLOC_CC_SILENCE_INIT(v)
+#endif
+
+/*
* Define a custom assert() in order to reduce the chances of deadlock during
* assertion failure.
*/