Enabled -Wstrict-prototypes and fixed warnings.

This commit is contained in:
Qi Wang
2023-07-05 13:33:34 -07:00
committed by Qi Wang
parent ebd7e99f5c
commit 602edd7566
42 changed files with 82 additions and 80 deletions

View File

@@ -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);

View File

@@ -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];

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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(

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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",

View File

@@ -3,7 +3,7 @@
static bool hook_called = false;
static void
hook() {
hook(void) {
hook_called = true;
}

View File

@@ -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;
};

View File

@@ -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;
}

View File

@@ -1,7 +1,7 @@
#include "test/jemalloc_test.h"
static uint64_t
deallocated() {
deallocated(void) {
if (!config_stats) {
return 0;
}

View File

@@ -1,7 +1,7 @@
#include "test/jemalloc_test.h"
static size_t
zero_reallocs() {
zero_reallocs(void) {
if (!config_stats) {
return 0;
}