Disable some spuriously-triggering warnings
This commit is contained in:
parent
a70909b130
commit
1b1e76acfe
@ -250,6 +250,11 @@ if test "x$GCC" = "xyes" ; then
|
|||||||
JE_CFLAGS_ADD([-Wsign-compare])
|
JE_CFLAGS_ADD([-Wsign-compare])
|
||||||
JE_CFLAGS_ADD([-Wundef])
|
JE_CFLAGS_ADD([-Wundef])
|
||||||
JE_CFLAGS_ADD([-Wno-format-zero-length])
|
JE_CFLAGS_ADD([-Wno-format-zero-length])
|
||||||
|
dnl This warning triggers on the use of the universal zero initializer, which
|
||||||
|
dnl is a very handy idiom for things like the tcache static initializer (which
|
||||||
|
dnl has lots of nested structs). See the discussion at.
|
||||||
|
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
|
||||||
|
JE_CFLAGS_ADD([-Wno-missing-braces])
|
||||||
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
|
||||||
|
@ -51,7 +51,7 @@ typedef struct tcaches_s tcaches_t;
|
|||||||
#define TCACHE_GC_INCR_BYTES 65536U
|
#define TCACHE_GC_INCR_BYTES 65536U
|
||||||
|
|
||||||
/* Used in TSD static initializer only. Real init in tsd_tcache_data_init(). */
|
/* Used in TSD static initializer only. Real init in tsd_tcache_data_init(). */
|
||||||
#define TCACHE_ZERO_INITIALIZER {{0}}
|
#define TCACHE_ZERO_INITIALIZER {0}
|
||||||
|
|
||||||
/* Used in TSD static initializer only. Will be initialized to opt_tcache. */
|
/* Used in TSD static initializer only. Will be initialized to opt_tcache. */
|
||||||
#define TCACHE_ENABLED_ZERO_INITIALIZER false
|
#define TCACHE_ENABLED_ZERO_INITIALIZER false
|
||||||
|
17
src/prof.c
17
src/prof.c
@ -113,6 +113,21 @@ bool prof_booted = false;
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If profiling is off, then PROF_DUMP_FILENAME_LEN is 1, so we'll end up
|
||||||
|
* calling strncpy with a size of 0, which triggers a -Wstringop-truncation
|
||||||
|
* warning (strncpy can never actually be called in this case, since we bail out
|
||||||
|
* much earlier when config_prof is false). This function works around the
|
||||||
|
* warning to let us leave the warning on.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
prof_strncpy(char *UNUSED dest, const char *UNUSED src, size_t UNUSED size) {
|
||||||
|
cassert(config_prof);
|
||||||
|
#ifdef JEMALLOC_PROF
|
||||||
|
strncpy(dest, src, size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx) {
|
prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx) {
|
||||||
malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
|
malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
|
||||||
@ -692,7 +707,7 @@ prof_dump_prefix_set(tsdn_t *tsdn, const char *prefix) {
|
|||||||
}
|
}
|
||||||
assert(prof_dump_prefix != NULL);
|
assert(prof_dump_prefix != NULL);
|
||||||
|
|
||||||
strncpy(prof_dump_prefix, prefix, PROF_DUMP_FILENAME_LEN - 1);
|
prof_strncpy(prof_dump_prefix, prefix, PROF_DUMP_FILENAME_LEN - 1);
|
||||||
prof_dump_prefix[PROF_DUMP_FILENAME_LEN - 1] = '\0';
|
prof_dump_prefix[PROF_DUMP_FILENAME_LEN - 1] = '\0';
|
||||||
malloc_mutex_unlock(tsdn, &prof_dump_filename_mtx);
|
malloc_mutex_unlock(tsdn, &prof_dump_filename_mtx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user