From a6048680a8056a881911c5907d13c66e526fb0c8 Mon Sep 17 00:00:00 2001 From: Slobodan Predolac Date: Fri, 5 Jun 2026 10:23:22 -0700 Subject: [PATCH] Fix -Wmissing-prototypes, -Wmissing-variable-declarations, and -Wstrict-prototypes warnings --- include/jemalloc/internal/conf.h | 2 +- include/jemalloc/internal/stats.h | 3 +++ src/pages.c | 2 +- src/prof.c | 2 +- src/stats.c | 6 +++--- src/tcache.c | 4 ++-- src/thread_event.c | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/jemalloc/internal/conf.h b/include/jemalloc/internal/conf.h index 26983ee9..e24aba03 100644 --- a/include/jemalloc/internal/conf.h +++ b/include/jemalloc/internal/conf.h @@ -7,9 +7,9 @@ void malloc_conf_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS], char readlink_buf[PATH_MAX + 1]); void malloc_abort_invalid_conf(void); -#ifdef JEMALLOC_JET extern bool had_conf_error; +#ifdef JEMALLOC_JET bool conf_next(char const **opts_p, char const **k_p, size_t *klen_p, char const **v_p, size_t *vlen_p); void conf_error( diff --git a/include/jemalloc/internal/stats.h b/include/jemalloc/internal/stats.h index 1c7b23e0..77c680e0 100644 --- a/include/jemalloc/internal/stats.h +++ b/include/jemalloc/internal/stats.h @@ -43,6 +43,9 @@ extern char opt_stats_interval_opts[stats_print_tot_num_options + 1]; #define STATS_INTERVAL_ACCUM_LG_BATCH_SIZE 6 #define STATS_INTERVAL_ACCUM_BATCH_MAX (4 << 20) +/* Per thread batch accum size for stats_interval; read by thread event. */ +extern uint64_t stats_interval_accum_batch; + /* Only accessed by thread event. */ extern te_base_cb_t stats_interval_te_handler; diff --git a/src/pages.c b/src/pages.c index 4f316a9d..bd0e62da 100644 --- a/src/pages.c +++ b/src/pages.c @@ -783,7 +783,7 @@ os_overcommits_proc(void) { #endif static bool -pages_should_skip_set_thp_state() { +pages_should_skip_set_thp_state(void) { if (opt_thp == thp_mode_do_nothing || (opt_thp == thp_mode_always && init_system_thp_mode == system_thp_mode_always) diff --git a/src/prof.c b/src/prof.c index fc37c4fe..0768c0ba 100644 --- a/src/prof.c +++ b/src/prof.c @@ -295,7 +295,7 @@ prof_sample_new_event_wait(tsd_t *tsd) { #endif } -void +static void prof_sample_event_handler(tsd_t *tsd) { cassert(config_prof); if (prof_interval == 0 || !prof_active_get_unlocked()) { diff --git a/src/stats.c b/src/stats.c index 29ac8c1e..603bb528 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2208,17 +2208,17 @@ stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts) { emitter_end(&emitter); } -uint64_t +static uint64_t stats_interval_new_event_wait(tsd_t *tsd) { return stats_interval_accum_batch; } -uint64_t +static uint64_t stats_interval_postponed_event_wait(tsd_t *tsd) { return TE_MIN_START_WAIT; } -void +static void stats_interval_event_handler(tsd_t *tsd) { uint64_t last_event = thread_allocated_last_event_get(tsd); uint64_t last_sample_event = tsd_stats_interval_last_event_get(tsd); diff --git a/src/tcache.c b/src/tcache.c index 3f66d640..14d82a74 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -112,12 +112,12 @@ tcache_salloc(tsdn_t *tsdn, const void *ptr) { return arena_salloc(tsdn, ptr); } -uint64_t +static uint64_t tcache_gc_new_event_wait(tsd_t *tsd) { return opt_tcache_gc_incr_bytes; } -uint64_t +static uint64_t tcache_gc_postponed_event_wait(tsd_t *tsd) { return TE_MIN_START_WAIT; } diff --git a/src/thread_event.c b/src/thread_event.c index 2f2dd711..c50a1ae7 100644 --- a/src/thread_event.c +++ b/src/thread_event.c @@ -3,6 +3,7 @@ #include "jemalloc/internal/jemalloc_internal_inlines_a.h" #include "jemalloc/internal/peak_event.h" #include "jemalloc/internal/prof.h" +#include "jemalloc/internal/stats.h" #include "jemalloc/internal/tcache.h" #include "jemalloc/internal/thread_event.h" #include "jemalloc/internal/thread_event_registry.h" @@ -185,7 +186,6 @@ te_update_wait(tsd_t *tsd, uint64_t accumbytes, bool allow, uint64_t *ev_wait, return ret; } -extern uint64_t stats_interval_accum_batch; /* Return number of handlers enqueued into to_trigger array */ static inline size_t te_update_alloc_events(tsd_t *tsd, te_base_cb_t **to_trigger,