From 602edd75664e2a2ef3063d9b3bd42d1f81a1be2b Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Wed, 5 Jul 2023 13:33:34 -0700 Subject: [PATCH] Enabled -Wstrict-prototypes and fixed warnings. --- configure.ac | 1 + include/jemalloc/internal/ehooks.h | 2 +- include/jemalloc/internal/hook.h | 2 +- include/jemalloc/internal/hpa.h | 2 +- include/jemalloc/internal/prof_data.h | 2 +- include/jemalloc/internal/prof_externs.h | 8 ++++---- include/jemalloc/internal/prof_inlines.h | 2 +- include/jemalloc/internal/prof_recent.h | 4 ++-- include/jemalloc/internal/prof_sys.h | 6 +++--- include/jemalloc/internal/san_bump.h | 2 +- include/jemalloc/internal/spin.h | 2 +- include/jemalloc/internal/test_hooks.h | 4 ++-- include/jemalloc/internal/tsd.h | 2 +- src/ehooks.c | 2 +- src/hook.c | 4 ++-- src/hpa.c | 2 +- src/jemalloc.c | 4 ++-- src/pages.c | 2 +- src/prof.c | 8 ++++---- src/prof_data.c | 2 +- src/prof_recent.c | 8 ++++---- src/prof_sys.c | 6 +++--- src/test_hooks.c | 4 ++-- src/tsd.c | 2 +- test/analyze/sizes.c | 2 +- test/include/test/bench.h | 4 ++-- test/include/test/test.h | 2 +- test/src/test.c | 6 +++--- test/stress/batch_alloc.c | 16 ++++++++-------- test/unit/double_free.c | 4 ++-- test/unit/fork.c | 2 +- test/unit/hook.c | 6 +++--- test/unit/hpa_background_thread.c | 4 ++-- test/unit/junk.c | 2 +- test/unit/prof_log.c | 12 ++++++------ test/unit/prof_mdump.c | 2 +- test/unit/prof_recent.c | 4 ++-- test/unit/test_hooks.c | 2 +- test/unit/zero_realloc_abort.c | 3 ++- test/unit/zero_realloc_alloc.c | 4 ++-- test/unit/zero_realloc_free.c | 2 +- test/unit/zero_reallocs.c | 2 +- 42 files changed, 82 insertions(+), 80 deletions(-) diff --git a/configure.ac b/configure.ac index 687b221c..9686ac53 100644 --- a/configure.ac +++ b/configure.ac @@ -262,6 +262,7 @@ if test "x$GCC" = "xyes" ; then dnl This one too. JE_CFLAGS_ADD([-Wno-missing-field-initializers]) JE_CFLAGS_ADD([-Wno-missing-attributes]) + JE_CFLAGS_ADD([-Wstrict-prototypes]) JE_CFLAGS_ADD([-pipe]) JE_CFLAGS_ADD([-g3]) elif test "x$je_cv_msvc" = "xyes" ; then diff --git a/include/jemalloc/internal/ehooks.h b/include/jemalloc/internal/ehooks.h index 8d9513e2..d583c521 100644 --- a/include/jemalloc/internal/ehooks.h +++ b/include/jemalloc/internal/ehooks.h @@ -53,7 +53,7 @@ bool ehooks_default_purge_lazy_impl(void *addr, size_t offset, size_t length); #ifdef PAGES_CAN_PURGE_FORCED bool ehooks_default_purge_forced_impl(void *addr, size_t offset, size_t length); #endif -bool ehooks_default_split_impl(); +bool ehooks_default_split_impl(void); /* * Merge is the only default extent hook we declare -- see the comment in * ehooks_merge. diff --git a/include/jemalloc/internal/hook.h b/include/jemalloc/internal/hook.h index af03d2f5..41157207 100644 --- a/include/jemalloc/internal/hook.h +++ b/include/jemalloc/internal/hook.h @@ -144,7 +144,7 @@ struct hook_ralloc_args_s { * Returns an opaque handle to be used when removing the hook. NULL means that * we couldn't install the hook. */ -bool hook_boot(); +bool hook_boot(void); void *hook_install(tsdn_t *tsdn, hooks_t *hooks); /* Uninstalls the hook with the handle previously returned from hook_install. */ diff --git a/include/jemalloc/internal/hpa.h b/include/jemalloc/internal/hpa.h index 0b3c76c6..01fe3166 100644 --- a/include/jemalloc/internal/hpa.h +++ b/include/jemalloc/internal/hpa.h @@ -143,7 +143,7 @@ struct hpa_shard_s { * is not necessarily a guarantee that it backs its allocations by hugepages, * just that it can function properly given the system it's running on. */ -bool hpa_supported(); +bool hpa_supported(void); bool hpa_central_init(hpa_central_t *central, base_t *base, const hpa_hooks_t *hooks); bool hpa_shard_init(hpa_shard_t *shard, hpa_central_t *central, emap_t *emap, base_t *base, edata_cache_t *edata_cache, unsigned ind, diff --git a/include/jemalloc/internal/prof_data.h b/include/jemalloc/internal/prof_data.h index c4286b51..016b6507 100644 --- a/include/jemalloc/internal/prof_data.h +++ b/include/jemalloc/internal/prof_data.h @@ -19,7 +19,7 @@ bool prof_bt_keycomp(const void *k1, const void *k2); bool prof_data_init(tsd_t *tsd); prof_tctx_t *prof_lookup(tsd_t *tsd, prof_bt_t *bt); int prof_thread_name_set_impl(tsd_t *tsd, const char *thread_name); -void prof_unbias_map_init(); +void prof_unbias_map_init(void); void prof_dump_impl(tsd_t *tsd, write_cb_t *prof_dump_write, void *cbopaque, prof_tdata_t *tdata, bool leakcheck); prof_tdata_t * prof_tdata_init_impl(tsd_t *tsd, uint64_t thr_uid, diff --git a/include/jemalloc/internal/prof_externs.h b/include/jemalloc/internal/prof_externs.h index 412378a2..cce5c8f5 100644 --- a/include/jemalloc/internal/prof_externs.h +++ b/include/jemalloc/internal/prof_externs.h @@ -51,16 +51,16 @@ extern size_t lg_prof_sample; extern bool prof_booted; void prof_backtrace_hook_set(prof_backtrace_hook_t hook); -prof_backtrace_hook_t prof_backtrace_hook_get(); +prof_backtrace_hook_t prof_backtrace_hook_get(void); void prof_dump_hook_set(prof_dump_hook_t hook); -prof_dump_hook_t prof_dump_hook_get(); +prof_dump_hook_t prof_dump_hook_get(void); void prof_sample_hook_set(prof_sample_hook_t hook); -prof_sample_hook_t prof_sample_hook_get(); +prof_sample_hook_t prof_sample_hook_get(void); void prof_sample_free_hook_set(prof_sample_free_hook_t hook); -prof_sample_free_hook_t prof_sample_free_hook_get(); +prof_sample_free_hook_t prof_sample_free_hook_get(void); /* Functions only accessed in prof_inlines.h */ prof_tdata_t *prof_tdata_init(tsd_t *tsd); diff --git a/include/jemalloc/internal/prof_inlines.h b/include/jemalloc/internal/prof_inlines.h index b5273010..c0783fc1 100644 --- a/include/jemalloc/internal/prof_inlines.h +++ b/include/jemalloc/internal/prof_inlines.h @@ -7,7 +7,7 @@ #include "jemalloc/internal/jemalloc_internal_inlines_c.h" JEMALLOC_ALWAYS_INLINE void -prof_active_assert() { +prof_active_assert(void) { cassert(config_prof); /* * If opt_prof is off, then prof_active must always be off, regardless diff --git a/include/jemalloc/internal/prof_recent.h b/include/jemalloc/internal/prof_recent.h index df410236..959e336b 100644 --- a/include/jemalloc/internal/prof_recent.h +++ b/include/jemalloc/internal/prof_recent.h @@ -7,7 +7,7 @@ extern malloc_mutex_t prof_recent_dump_mtx; bool prof_recent_alloc_prepare(tsd_t *tsd, prof_tctx_t *tctx); void prof_recent_alloc(tsd_t *tsd, edata_t *edata, size_t size, size_t usize); void prof_recent_alloc_reset(tsd_t *tsd, edata_t *edata); -bool prof_recent_init(); +bool prof_recent_init(void); void edata_prof_recent_alloc_init(edata_t *edata); /* Used in unit tests. */ @@ -16,7 +16,7 @@ extern prof_recent_list_t prof_recent_alloc_list; edata_t *prof_recent_alloc_edata_get_no_lock_test(const prof_recent_t *node); prof_recent_t *edata_prof_recent_alloc_get_no_lock_test(const edata_t *edata); -ssize_t prof_recent_alloc_max_ctl_read(); +ssize_t prof_recent_alloc_max_ctl_read(void); ssize_t prof_recent_alloc_max_ctl_write(tsd_t *tsd, ssize_t max); void prof_recent_alloc_dump(tsd_t *tsd, write_cb_t *write_cb, void *cbopaque); diff --git a/include/jemalloc/internal/prof_sys.h b/include/jemalloc/internal/prof_sys.h index 3d25a429..0eb50788 100644 --- a/include/jemalloc/internal/prof_sys.h +++ b/include/jemalloc/internal/prof_sys.h @@ -6,8 +6,8 @@ extern base_t *prof_base; void bt_init(prof_bt_t *bt, void **vec); void prof_backtrace(tsd_t *tsd, prof_bt_t *bt); -void prof_hooks_init(); -void prof_unwind_init(); +void prof_hooks_init(void); +void prof_unwind_init(void); void prof_sys_thread_name_fetch(tsd_t *tsd); int prof_getpid(void); void prof_get_default_filename(tsdn_t *tsdn, char *filename, uint64_t ind); @@ -24,7 +24,7 @@ typedef int (prof_dump_open_file_t)(const char *, int); extern prof_dump_open_file_t *JET_MUTABLE prof_dump_open_file; typedef ssize_t (prof_dump_write_file_t)(int, const void *, size_t); extern prof_dump_write_file_t *JET_MUTABLE prof_dump_write_file; -typedef int (prof_dump_open_maps_t)(); +typedef int (prof_dump_open_maps_t)(void); extern prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps; #endif /* JEMALLOC_INTERNAL_PROF_SYS_H */ diff --git a/include/jemalloc/internal/san_bump.h b/include/jemalloc/internal/san_bump.h index 8ec4a710..0a8e76e9 100644 --- a/include/jemalloc/internal/san_bump.h +++ b/include/jemalloc/internal/san_bump.h @@ -20,7 +20,7 @@ struct san_bump_alloc_s { }; static inline bool -san_bump_enabled() { +san_bump_enabled(void) { /* * We enable san_bump allocator only when it's possible to break up a * mapping and unmap a part of it (maps_coalesce). This is needed to diff --git a/include/jemalloc/internal/spin.h b/include/jemalloc/internal/spin.h index 22804c68..6940f15e 100644 --- a/include/jemalloc/internal/spin.h +++ b/include/jemalloc/internal/spin.h @@ -8,7 +8,7 @@ typedef struct { } spin_t; static inline void -spin_cpu_spinwait() { +spin_cpu_spinwait(void) { # if HAVE_CPU_SPINWAIT CPU_SPINWAIT; # else diff --git a/include/jemalloc/internal/test_hooks.h b/include/jemalloc/internal/test_hooks.h index 3d530b5c..2b90afe1 100644 --- a/include/jemalloc/internal/test_hooks.h +++ b/include/jemalloc/internal/test_hooks.h @@ -1,8 +1,8 @@ #ifndef JEMALLOC_INTERNAL_TEST_HOOKS_H #define JEMALLOC_INTERNAL_TEST_HOOKS_H -extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(); -extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); +extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(void); +extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(void); #if defined(JEMALLOC_JET) || defined(JEMALLOC_UNIT_TEST) # define JEMALLOC_TEST_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h index c6bf28fc..3dd52247 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h @@ -177,7 +177,7 @@ void tsd_postfork_child(tsd_t *tsd); */ void tsd_global_slow_inc(tsdn_t *tsdn); void tsd_global_slow_dec(tsdn_t *tsdn); -bool tsd_global_slow(); +bool tsd_global_slow(void); #define TSD_MIN_INIT_STATE_MAX_FETCHED (128) diff --git a/src/ehooks.c b/src/ehooks.c index 383e9de6..da759215 100644 --- a/src/ehooks.c +++ b/src/ehooks.c @@ -159,7 +159,7 @@ ehooks_default_purge_forced(extent_hooks_t *extent_hooks, void *addr, #endif bool -ehooks_default_split_impl() { +ehooks_default_split_impl(void) { if (!maps_coalesce) { /* * Without retain, only whole regions can be purged (required by diff --git a/src/hook.c b/src/hook.c index 493edbbe..77a988d7 100644 --- a/src/hook.c +++ b/src/hook.c @@ -19,7 +19,7 @@ static seq_hooks_t hooks[HOOK_MAX]; static malloc_mutex_t hooks_mu; bool -hook_boot() { +hook_boot(void) { return malloc_mutex_init(&hooks_mu, "hooks", WITNESS_RANK_HOOK, malloc_mutex_rank_exclusive); } @@ -100,7 +100,7 @@ for (int for_each_hook_counter = 0; \ } static bool * -hook_reentrantp() { +hook_reentrantp(void) { /* * We prevent user reentrancy within hooks. This is basically just a * thread-local bool that triggers an early-exit. diff --git a/src/hpa.c b/src/hpa.c index 7462025c..ee41994f 100644 --- a/src/hpa.c +++ b/src/hpa.c @@ -24,7 +24,7 @@ static void hpa_dalloc_batch(tsdn_t *tsdn, pai_t *self, static uint64_t hpa_time_until_deferred_work(tsdn_t *tsdn, pai_t *self); bool -hpa_supported() { +hpa_supported(void) { #ifdef _WIN32 /* * At least until the API and implementation is somewhat settled, we diff --git a/src/jemalloc.c b/src/jemalloc.c index 4e4e4bee..7771a731 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -766,7 +766,7 @@ malloc_ncpus(void) { * Since otherwise tricky things is possible with percpu arenas in use. */ static bool -malloc_cpu_count_is_deterministic() +malloc_cpu_count_is_deterministic(void) { #ifdef _WIN32 return true; @@ -1807,7 +1807,7 @@ malloc_init_hard_needed(void) { } static bool -malloc_init_hard_a0_locked() { +malloc_init_hard_a0_locked(void) { malloc_initializer = INITIALIZER; JEMALLOC_DIAGNOSTIC_PUSH diff --git a/src/pages.c b/src/pages.c index 41bbef57..e70c6e92 100644 --- a/src/pages.c +++ b/src/pages.c @@ -66,7 +66,7 @@ static int madvise_dont_need_zeros_is_faulty = -1; * * [1]: https://patchwork.kernel.org/patch/10576637/ */ -static int madvise_MADV_DONTNEED_zeroes_pages() +static int madvise_MADV_DONTNEED_zeroes_pages(void) { size_t size = PAGE; diff --git a/src/prof.c b/src/prof.c index 832aa528..e958349e 100644 --- a/src/prof.c +++ b/src/prof.c @@ -562,7 +562,7 @@ prof_backtrace_hook_set(prof_backtrace_hook_t hook) { } prof_backtrace_hook_t -prof_backtrace_hook_get() { +prof_backtrace_hook_get(void) { return (prof_backtrace_hook_t)atomic_load_p(&prof_backtrace_hook, ATOMIC_ACQUIRE); } @@ -573,7 +573,7 @@ prof_dump_hook_set(prof_dump_hook_t hook) { } prof_dump_hook_t -prof_dump_hook_get() { +prof_dump_hook_get(void) { return (prof_dump_hook_t)atomic_load_p(&prof_dump_hook, ATOMIC_ACQUIRE); } @@ -584,7 +584,7 @@ prof_sample_hook_set(prof_sample_hook_t hook) { } prof_sample_hook_t -prof_sample_hook_get() { +prof_sample_hook_get(void) { return (prof_sample_hook_t)atomic_load_p(&prof_sample_hook, ATOMIC_ACQUIRE); } @@ -595,7 +595,7 @@ prof_sample_free_hook_set(prof_sample_free_hook_t hook) { } prof_sample_free_hook_t -prof_sample_free_hook_get() { +prof_sample_free_hook_get(void) { return (prof_sample_free_hook_t)atomic_load_p(&prof_sample_free_hook, ATOMIC_ACQUIRE); } diff --git a/src/prof_data.c b/src/prof_data.c index c33668ee..d52522b0 100644 --- a/src/prof_data.c +++ b/src/prof_data.c @@ -503,7 +503,7 @@ prof_double_uint64_cast(double d) { } #endif -void prof_unbias_map_init() { +void prof_unbias_map_init(void) { /* See the comment in prof_sample_new_event_wait */ #ifdef JEMALLOC_PROF for (szind_t i = 0; i < SC_NSIZES; i++) { diff --git a/src/prof_recent.c b/src/prof_recent.c index e5b3fb17..b5639b4c 100644 --- a/src/prof_recent.c +++ b/src/prof_recent.c @@ -16,13 +16,13 @@ prof_recent_list_t prof_recent_alloc_list; malloc_mutex_t prof_recent_dump_mtx; /* Protects dumping. */ static void -prof_recent_alloc_max_init() { +prof_recent_alloc_max_init(void) { atomic_store_zd(&prof_recent_alloc_max, opt_prof_recent_alloc_max, ATOMIC_RELAXED); } static inline ssize_t -prof_recent_alloc_max_get_no_lock() { +prof_recent_alloc_max_get_no_lock(void) { return atomic_load_zd(&prof_recent_alloc_max, ATOMIC_RELAXED); } @@ -403,7 +403,7 @@ label_rollback: } ssize_t -prof_recent_alloc_max_ctl_read() { +prof_recent_alloc_max_ctl_read(void) { cassert(config_prof); /* Don't bother to acquire the lock. */ return prof_recent_alloc_max_get_no_lock(); @@ -582,7 +582,7 @@ prof_recent_alloc_dump(tsd_t *tsd, write_cb_t *write_cb, void *cbopaque) { #undef PROF_RECENT_PRINT_BUFSIZE bool -prof_recent_init() { +prof_recent_init(void) { cassert(config_prof); prof_recent_alloc_max_init(); diff --git a/src/prof_sys.c b/src/prof_sys.c index 3cbb3a85..467394a5 100644 --- a/src/prof_sys.c +++ b/src/prof_sys.c @@ -428,7 +428,7 @@ prof_backtrace(tsd_t *tsd, prof_bt_t *bt) { } void -prof_hooks_init() { +prof_hooks_init(void) { prof_backtrace_hook_set(&prof_backtrace_impl); prof_dump_hook_set(NULL); prof_sample_hook_set(NULL); @@ -436,7 +436,7 @@ prof_hooks_init() { } void -prof_unwind_init() { +prof_unwind_init(void) { #ifdef JEMALLOC_PROF_LIBGCC /* * Cause the backtracing machinery to allocate its internal @@ -596,7 +596,7 @@ prof_open_maps_internal(const char *format, ...) { #endif static int -prof_dump_open_maps_impl() { +prof_dump_open_maps_impl(void) { int mfd; cassert(config_prof); diff --git a/src/test_hooks.c b/src/test_hooks.c index ace00d9c..40621199 100644 --- a/src/test_hooks.c +++ b/src/test_hooks.c @@ -6,7 +6,7 @@ * from outside the generated library, so that we can use them in test code. */ JEMALLOC_EXPORT -void (*test_hooks_arena_new_hook)() = NULL; +void (*test_hooks_arena_new_hook)(void) = NULL; JEMALLOC_EXPORT -void (*test_hooks_libc_hook)() = NULL; +void (*test_hooks_libc_hook)(void) = NULL; diff --git a/src/tsd.c b/src/tsd.c index cef7ba58..a4db8e36 100644 --- a/src/tsd.c +++ b/src/tsd.c @@ -148,7 +148,7 @@ tsd_local_slow(tsd_t *tsd) { } bool -tsd_global_slow() { +tsd_global_slow(void) { return atomic_load_u32(&tsd_global_slow_count, ATOMIC_RELAXED) > 0; } diff --git a/test/analyze/sizes.c b/test/analyze/sizes.c index 44c9de5e..a48c4f48 100644 --- a/test/analyze/sizes.c +++ b/test/analyze/sizes.c @@ -29,7 +29,7 @@ do_print(const char *name, size_t sz_bytes) { } int -main() { +main(void) { #define P(type) \ do_print(#type, sizeof(type)) P(arena_t); diff --git a/test/include/test/bench.h b/test/include/test/bench.h index 29c6801f..e2a9fc09 100644 --- a/test/include/test/bench.h +++ b/test/include/test/bench.h @@ -40,8 +40,8 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a, return; } - time_func(&timer_a, nwarmup, niter, (void (*)())func_a); - time_func(&timer_b, nwarmup, niter, (void (*)())func_b); + time_func(&timer_a, nwarmup, niter, (void (*)(void))func_a); + time_func(&timer_b, nwarmup, niter, (void (*)(void))func_b); uint64_t usec_a = timer_usec(&timer_a); char buf_a[FMT_NSECS_BUF_SIZE]; diff --git a/test/include/test/test.h b/test/include/test/test.h index 54610dab..183dfc00 100644 --- a/test/include/test/test.h +++ b/test/include/test/test.h @@ -569,7 +569,7 @@ label_test_end: \ } \ } while (0) -bool test_is_reentrant(); +bool test_is_reentrant(void); void test_skip(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2); void test_fail(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2); diff --git a/test/src/test.c b/test/src/test.c index 4cd803e5..e26dbfd4 100644 --- a/test/src/test.c +++ b/test/src/test.c @@ -35,7 +35,7 @@ reentrancy_t_str(reentrancy_t r) { } static void -do_hook(bool *hook_ran, void (**hook)()) { +do_hook(bool *hook_ran, void (**hook)(void)) { *hook_ran = true; *hook = NULL; @@ -47,12 +47,12 @@ do_hook(bool *hook_ran, void (**hook)()) { } static void -libc_reentrancy_hook() { +libc_reentrancy_hook(void) { do_hook(&libc_hook_ran, &test_hooks_libc_hook); } static void -arena_new_reentrancy_hook() { +arena_new_reentrancy_hook(void) { do_hook(&arena_new_hook_ran, &test_hooks_arena_new_hook); } diff --git a/test/stress/batch_alloc.c b/test/stress/batch_alloc.c index 427e1cba..6b973bb1 100644 --- a/test/stress/batch_alloc.c +++ b/test/stress/batch_alloc.c @@ -124,12 +124,12 @@ compare_with_free(size_t batch, size_t iter, } static void -batch_alloc_without_free_tiny() { +batch_alloc_without_free_tiny(void) { batch_alloc_without_free(TINY_BATCH); } static void -item_alloc_without_free_tiny() { +item_alloc_without_free_tiny(void) { item_alloc_without_free(TINY_BATCH); } @@ -140,12 +140,12 @@ TEST_BEGIN(test_tiny_batch_without_free) { TEST_END static void -batch_alloc_with_free_tiny() { +batch_alloc_with_free_tiny(void) { batch_alloc_with_free(TINY_BATCH); } static void -item_alloc_with_free_tiny() { +item_alloc_with_free_tiny(void) { item_alloc_with_free(TINY_BATCH); } @@ -156,12 +156,12 @@ TEST_BEGIN(test_tiny_batch_with_free) { TEST_END static void -batch_alloc_without_free_huge() { +batch_alloc_without_free_huge(void) { batch_alloc_without_free(HUGE_BATCH); } static void -item_alloc_without_free_huge() { +item_alloc_without_free_huge(void) { item_alloc_without_free(HUGE_BATCH); } @@ -172,12 +172,12 @@ TEST_BEGIN(test_huge_batch_without_free) { TEST_END static void -batch_alloc_with_free_huge() { +batch_alloc_with_free_huge(void) { batch_alloc_with_free(HUGE_BATCH); } static void -item_alloc_with_free_huge() { +item_alloc_with_free_huge(void) { item_alloc_with_free(HUGE_BATCH); } diff --git a/test/unit/double_free.c b/test/unit/double_free.c index f1e50cd2..b6ae8f75 100644 --- a/test/unit/double_free.c +++ b/test/unit/double_free.c @@ -16,13 +16,13 @@ test_double_free_pre(void) { } static void -test_double_free_post() { +test_double_free_post(void) { expect_b_eq(fake_abort_called, true, "Double-free check didn't fire."); safety_check_set_abort(NULL); } static bool -tcache_enabled() { +tcache_enabled(void) { bool enabled; size_t sz = sizeof(enabled); assert_d_eq( diff --git a/test/unit/fork.c b/test/unit/fork.c index 4137423f..447eb191 100644 --- a/test/unit/fork.c +++ b/test/unit/fork.c @@ -95,7 +95,7 @@ do_fork_thd(void *arg) { #ifndef _WIN32 static void -do_test_fork_multithreaded() { +do_test_fork_multithreaded(void) { thd_t child; thd_create(&child, do_fork_thd, NULL); do_fork_thd(NULL); diff --git a/test/unit/hook.c b/test/unit/hook.c index 36dbd269..f2a7f190 100644 --- a/test/unit/hook.c +++ b/test/unit/hook.c @@ -14,7 +14,7 @@ static uintptr_t arg_args_raw[4]; static int call_count = 0; static void -reset_args() { +reset_args(void) { arg_extra = NULL; arg_type = 12345; arg_result = NULL; @@ -40,7 +40,7 @@ alloc_free_size(size_t sz) { * allocation scenarios. */ static void -be_reentrant() { +be_reentrant(void) { /* Let's make sure the tcache is non-empty if enabled. */ alloc_free_size(1); alloc_free_size(1024); @@ -77,7 +77,7 @@ expect_args_raw(uintptr_t *args_raw_expected, int nargs) { } static void -reset() { +reset(void) { call_count = 0; reset_args(); } diff --git a/test/unit/hpa_background_thread.c b/test/unit/hpa_background_thread.c index 81c25612..774ccb4a 100644 --- a/test/unit/hpa_background_thread.c +++ b/test/unit/hpa_background_thread.c @@ -2,7 +2,7 @@ #include "test/sleep.h" static void -sleep_for_background_thread_interval() { +sleep_for_background_thread_interval(void) { /* * The sleep interval set in our .sh file is 50ms. So it likely will * run if we sleep for four times that. @@ -11,7 +11,7 @@ sleep_for_background_thread_interval() { } static unsigned -create_arena() { +create_arena(void) { unsigned arena_ind; size_t sz; diff --git a/test/unit/junk.c b/test/unit/junk.c index 543092f1..6c5b8beb 100644 --- a/test/unit/junk.c +++ b/test/unit/junk.c @@ -7,7 +7,7 @@ static void *last_junked_ptr; static size_t last_junked_usize; static void -reset() { +reset(void) { ptr_ind = 0; last_junked_ptr = NULL; last_junked_usize = 0; diff --git a/test/unit/prof_log.c b/test/unit/prof_log.c index 5ff208e2..a32fdd0b 100644 --- a/test/unit/prof_log.c +++ b/test/unit/prof_log.c @@ -4,11 +4,11 @@ #define N_PARAM 100 #define N_THREADS 10 -static void expect_rep() { +static void expect_rep(void) { expect_b_eq(prof_log_rep_check(), false, "Rep check failed"); } -static void expect_log_empty() { +static void expect_log_empty(void) { expect_zu_eq(prof_log_bt_count(), 0, "The log has backtraces; it isn't empty"); expect_zu_eq(prof_log_thr_count(), 0, @@ -19,7 +19,7 @@ static void expect_log_empty() { void *buf[N_PARAM]; -static void f() { +static void f(void) { int i; for (i = 0; i < N_PARAM; i++) { buf[i] = malloc(100); @@ -91,18 +91,18 @@ TEST_BEGIN(test_prof_log_many_threads) { } TEST_END -static void f3() { +static void f3(void) { void *p = malloc(100); free(p); } -static void f1() { +static void f1(void) { void *p = malloc(100); f3(); free(p); } -static void f2() { +static void f2(void) { void *p = malloc(100); free(p); } diff --git a/test/unit/prof_mdump.c b/test/unit/prof_mdump.c index 75b3a515..bcbb961a 100644 --- a/test/unit/prof_mdump.c +++ b/test/unit/prof_mdump.c @@ -129,7 +129,7 @@ TEST_BEGIN(test_mdump_output_error) { TEST_END static int -prof_dump_open_maps_error() { +prof_dump_open_maps_error(void) { return -1; } diff --git a/test/unit/prof_recent.c b/test/unit/prof_recent.c index 2cf699d8..24ee6f42 100644 --- a/test/unit/prof_recent.c +++ b/test/unit/prof_recent.c @@ -9,7 +9,7 @@ const char *test_thread_name = "test_thread"; /* Invariant before and after every test (when config_prof is on) */ static void -confirm_prof_setup() { +confirm_prof_setup(void) { /* Options */ assert_true(opt_prof, "opt_prof not on"); assert_true(opt_prof_active, "opt_prof_active not on"); @@ -356,7 +356,7 @@ test_dump_write_cb(void *not_used, const char *str) { } static void -call_dump() { +call_dump(void) { static void *in[2] = {test_dump_write_cb, NULL}; dump_out_len = 0; assert_d_eq(mallctl("experimental.prof_recent.alloc_dump", diff --git a/test/unit/test_hooks.c b/test/unit/test_hooks.c index 8cd2b3bb..41e7bf35 100644 --- a/test/unit/test_hooks.c +++ b/test/unit/test_hooks.c @@ -3,7 +3,7 @@ static bool hook_called = false; static void -hook() { +hook(void) { hook_called = true; } diff --git a/test/unit/zero_realloc_abort.c b/test/unit/zero_realloc_abort.c index a880d104..f014cdc2 100644 --- a/test/unit/zero_realloc_abort.c +++ b/test/unit/zero_realloc_abort.c @@ -4,7 +4,8 @@ static bool abort_called = false; -void set_abort_called() { +void set_abort_called(const char *message) { + (void)message; abort_called = true; }; diff --git a/test/unit/zero_realloc_alloc.c b/test/unit/zero_realloc_alloc.c index 65e07bdb..6954818c 100644 --- a/test/unit/zero_realloc_alloc.c +++ b/test/unit/zero_realloc_alloc.c @@ -1,7 +1,7 @@ #include "test/jemalloc_test.h" static uint64_t -allocated() { +allocated(void) { if (!config_stats) { return 0; } @@ -13,7 +13,7 @@ allocated() { } static uint64_t -deallocated() { +deallocated(void) { if (!config_stats) { return 0; } diff --git a/test/unit/zero_realloc_free.c b/test/unit/zero_realloc_free.c index baed86c9..277f219d 100644 --- a/test/unit/zero_realloc_free.c +++ b/test/unit/zero_realloc_free.c @@ -1,7 +1,7 @@ #include "test/jemalloc_test.h" static uint64_t -deallocated() { +deallocated(void) { if (!config_stats) { return 0; } diff --git a/test/unit/zero_reallocs.c b/test/unit/zero_reallocs.c index 66c7a404..a9077222 100644 --- a/test/unit/zero_reallocs.c +++ b/test/unit/zero_reallocs.c @@ -1,7 +1,7 @@ #include "test/jemalloc_test.h" static size_t -zero_reallocs() { +zero_reallocs(void) { if (!config_stats) { return 0; }