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.
This commit is contained in:
parent
3823effe12
commit
425253e2cd
@ -241,6 +241,7 @@ if test "x$GCC" = "xyes" ; then
|
|||||||
JE_CFLAGS_ADD([-Wall])
|
JE_CFLAGS_ADD([-Wall])
|
||||||
JE_CFLAGS_ADD([-Wshorten-64-to-32])
|
JE_CFLAGS_ADD([-Wshorten-64-to-32])
|
||||||
JE_CFLAGS_ADD([-Wsign-compare])
|
JE_CFLAGS_ADD([-Wsign-compare])
|
||||||
|
JE_CFLAGS_ADD([-Wundef])
|
||||||
JE_CFLAGS_ADD([-pipe])
|
JE_CFLAGS_ADD([-pipe])
|
||||||
JE_CFLAGS_ADD([-g3])
|
JE_CFLAGS_ADD([-g3])
|
||||||
elif test "x$je_cv_msvc" = "xyes" ; then
|
elif test "x$je_cv_msvc" = "xyes" ; then
|
||||||
@ -824,7 +825,9 @@ else
|
|||||||
JEMALLOC_PREFIX="je_"
|
JEMALLOC_PREFIX="je_"
|
||||||
fi]
|
fi]
|
||||||
)
|
)
|
||||||
if test "x$JEMALLOC_PREFIX" != "x" ; then
|
if test "x$JEMALLOC_PREFIX" = "x" ; then
|
||||||
|
AC_DEFINE([JEMALLOC_IS_MALLOC])
|
||||||
|
else
|
||||||
JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
|
JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
|
||||||
AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
|
AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
|
||||||
AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
|
AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
|
||||||
|
@ -312,4 +312,7 @@
|
|||||||
/* config.malloc_conf options string. */
|
/* config.malloc_conf options string. */
|
||||||
#undef JEMALLOC_CONFIG_MALLOC_CONF
|
#undef JEMALLOC_CONFIG_MALLOC_CONF
|
||||||
|
|
||||||
|
/* If defined, jemalloc takes the malloc/free/etc. symbol names. */
|
||||||
|
#undef JEMALLOC_IS_MALLOC
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#define JEMALLOC_NO_DEMANGLE
|
#define JEMALLOC_NO_DEMANGLE
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
|
# undef JEMALLOC_IS_MALLOC
|
||||||
# define JEMALLOC_N(n) jet_##n
|
# define JEMALLOC_N(n) jet_##n
|
||||||
# include "jemalloc/internal/public_namespace.h"
|
# include "jemalloc/internal/public_namespace.h"
|
||||||
# define JEMALLOC_NO_RENAME
|
# define JEMALLOC_NO_RENAME
|
||||||
|
@ -2285,15 +2285,7 @@ je_valloc(size_t size) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#if defined(JEMALLOC_IS_MALLOC) && defined(JEMALLOC_GLIBC_MALLOC_HOOK)
|
||||||
* 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))
|
|
||||||
/*
|
/*
|
||||||
* glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible
|
* glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible
|
||||||
* to inconsistently reference libc's malloc(3)-compatible functions
|
* to inconsistently reference libc's malloc(3)-compatible functions
|
||||||
|
@ -96,7 +96,7 @@ nstime_get(nstime_t *time) {
|
|||||||
|
|
||||||
nstime_init(time, ticks_100ns * 100);
|
nstime_init(time, ticks_100ns * 100);
|
||||||
}
|
}
|
||||||
#elif JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
|
#elif defined(JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE)
|
||||||
# define NSTIME_MONOTONIC true
|
# define NSTIME_MONOTONIC true
|
||||||
static void
|
static void
|
||||||
nstime_get(nstime_t *time) {
|
nstime_get(nstime_t *time) {
|
||||||
@ -105,7 +105,7 @@ nstime_get(nstime_t *time) {
|
|||||||
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
|
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
|
||||||
nstime_init2(time, ts.tv_sec, ts.tv_nsec);
|
nstime_init2(time, ts.tv_sec, ts.tv_nsec);
|
||||||
}
|
}
|
||||||
#elif JEMALLOC_HAVE_CLOCK_MONOTONIC
|
#elif defined(JEMALLOC_HAVE_CLOCK_MONOTONIC)
|
||||||
# define NSTIME_MONOTONIC true
|
# define NSTIME_MONOTONIC true
|
||||||
static void
|
static void
|
||||||
nstime_get(nstime_t *time) {
|
nstime_get(nstime_t *time) {
|
||||||
@ -114,7 +114,7 @@ nstime_get(nstime_t *time) {
|
|||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
nstime_init2(time, ts.tv_sec, ts.tv_nsec);
|
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
|
# define NSTIME_MONOTONIC true
|
||||||
static void
|
static void
|
||||||
nstime_get(nstime_t *time) {
|
nstime_get(nstime_t *time) {
|
||||||
|
Loading…
Reference in New Issue
Block a user