summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-04-21 20:47:49 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-04-22 00:03:56 (GMT)
commit425253e2cd64e23585f557bfa82789a5208d06e1 (patch)
tree90755680edc8093e0b8c85b89caecc9531039426 /src
parent3823effe126ec602c438b02eb70d4c258a2f0e3f (diff)
downloadjemalloc-425253e2cd64e23585f557bfa82789a5208d06e1.zip
jemalloc-425253e2cd64e23585f557bfa82789a5208d06e1.tar.gz
jemalloc-425253e2cd64e23585f557bfa82789a5208d06e1.tar.bz2
Enable -Wundef, when supported.
This can catch bugs in which one header defines a numeric constant, and another uses it without including the defining header. Undefined preprocessor symbols expand to '0', so that this will compile fine, silently doing the math wrong.
Diffstat (limited to 'src')
-rw-r--r--src/jemalloc.c10
-rw-r--r--src/nstime.c6
2 files changed, 4 insertions, 12 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 27a9fd7..de858e3 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -2285,15 +2285,7 @@ je_valloc(size_t size) {
}
#endif
-/*
- * is_malloc(je_malloc) is some macro magic to detect if jemalloc_defs.h has
- * #define je_malloc malloc
- */
-#define malloc_is_malloc 1
-#define is_malloc_(a) malloc_is_ ## a
-#define is_malloc(a) is_malloc_(a)
-
-#if ((is_malloc(je_malloc) == 1) && defined(JEMALLOC_GLIBC_MALLOC_HOOK))
+#if defined(JEMALLOC_IS_MALLOC) && defined(JEMALLOC_GLIBC_MALLOC_HOOK)
/*
* glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible
* to inconsistently reference libc's malloc(3)-compatible functions
diff --git a/src/nstime.c b/src/nstime.c
index 9f5d192..20c0042 100644
--- a/src/nstime.c
+++ b/src/nstime.c
@@ -96,7 +96,7 @@ nstime_get(nstime_t *time) {
nstime_init(time, ticks_100ns * 100);
}
-#elif JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
+#elif defined(JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE)
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time) {
@@ -105,7 +105,7 @@ nstime_get(nstime_t *time) {
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
nstime_init2(time, ts.tv_sec, ts.tv_nsec);
}
-#elif JEMALLOC_HAVE_CLOCK_MONOTONIC
+#elif defined(JEMALLOC_HAVE_CLOCK_MONOTONIC)
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time) {
@@ -114,7 +114,7 @@ nstime_get(nstime_t *time) {
clock_gettime(CLOCK_MONOTONIC, &ts);
nstime_init2(time, ts.tv_sec, ts.tv_nsec);
}
-#elif JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
+#elif defined(JEMALLOC_HAVE_MACH_ABSOLUTE_TIME)
# define NSTIME_MONOTONIC true
static void
nstime_get(nstime_t *time) {