diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2023-11-20 17:21:48 +0100 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2023-11-20 18:36:08 +0100 |
commit | 9d5b333fb6e548aa2a9cda9094ad7e96e3eb33f7 (patch) | |
tree | 014d5a8d1de974ee2e07b9db67477df8d3a0adfb /tests/internals | |
parent | 9cc4a6928da3931d0d7d6afad4489384cb21de23 (diff) | |
download | bindfs-9d5b333fb6e548aa2a9cda9094ad7e96e3eb33f7.tar.gz |
src|tests: Address warning -Wstrict-prototypes
Symptom with Clang 15:
> In file included from userinfo.c:20:
> ./userinfo.h:38:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
> void invalidate_user_cache(); /* safe to call from signal handler */
> ^
> void
> [many more]
Diffstat (limited to 'tests/internals')
-rw-r--r-- | tests/internals/test_common.c | 2 | ||||
-rw-r--r-- | tests/internals/test_common.h | 4 | ||||
-rw-r--r-- | tests/internals/test_internals.c | 12 | ||||
-rw-r--r-- | tests/internals/test_rate_limiter.c | 10 |
4 files changed, 14 insertions, 14 deletions
diff --git a/tests/internals/test_common.c b/tests/internals/test_common.c index 6c10292..449c64a 100644 --- a/tests/internals/test_common.c +++ b/tests/internals/test_common.c @@ -3,7 +3,7 @@ int failures = 0; -int run_suite(void (*suite)()) { +int run_suite(void (*suite)(void)) { suite(); return (failures > 0) ? 1 : 0; } diff --git a/tests/internals/test_common.h b/tests/internals/test_common.h index 1688add..055fc38 100644 --- a/tests/internals/test_common.h +++ b/tests/internals/test_common.h @@ -10,8 +10,8 @@ extern int failures; #define TEST_ASSERT(expr) do { if (!(expr)) { printf("Assertion failed: %s:%d: `%s'\n", __FILE__, __LINE__, #expr); ++failures; } } while (0); #define NEAR(a, b, eps) (fabs((a) - (b)) < (eps)) -int run_suite(void (*suite)()); +int run_suite(void (*suite)(void)); -#define TEST_MAIN(suite) int main() { return run_suite(suite); } +#define TEST_MAIN(suite) int main(void) { return run_suite(suite); } #endif diff --git a/tests/internals/test_internals.c b/tests/internals/test_internals.c index 53f9872..23fa192 100644 --- a/tests/internals/test_internals.c +++ b/tests/internals/test_internals.c @@ -6,7 +6,7 @@ #include <string.h> #include <stdlib.h> -static void arena_suite() +static void arena_suite(void) { const int iterations = 1000; struct arena arena; @@ -55,7 +55,7 @@ static void test_path_starts_with(const char* path, const char* prefix, bool exp } } -static void my_dirname_suite() +static void my_dirname_suite(void) { char buf[256]; @@ -90,7 +90,7 @@ static void my_dirname_suite() test_my_dirname(buf, ".."); } -static void path_starts_with_suite() +static void path_starts_with_suite(void) { test_path_starts_with("/a/b/c", "/a/b", true); test_path_starts_with("/a/b/c", "/a/b/", true); @@ -144,7 +144,7 @@ static void path_starts_with_suite() test_path_starts_with("/a/b/c", "/", true); } -static void sprintf_new_suite() { +static void sprintf_new_suite(void) { char *result; result = sprintf_new("Hello %d %s", 123, "World"); @@ -214,7 +214,7 @@ static void filter_o_opts_test(const char **init, const char **expected) { free(joined_input); } -static void filter_o_opts_suite() { +static void filter_o_opts_suite(void) { { const char *in[] = {"-obad1", NULL}; const char *exp[] = {NULL}; @@ -299,7 +299,7 @@ static void filter_o_opts_suite() { } } -static void test_internal_suite() { +static void test_internal_suite(void) { arena_suite(); my_dirname_suite(); path_starts_with_suite(); diff --git a/tests/internals/test_rate_limiter.c b/tests/internals/test_rate_limiter.c index 09b219e..25e26fb 100644 --- a/tests/internals/test_rate_limiter.c +++ b/tests/internals/test_rate_limiter.c @@ -6,12 +6,12 @@ static const double epsilon = 0.000000000001; static volatile double time_now = 123123.0; -double test_clock() +double test_clock(void) { return time_now; } -void computes_correct_sleep_times() +void computes_correct_sleep_times(void) { time_now = 123123.0; RateLimiter limiter; @@ -29,7 +29,7 @@ void computes_correct_sleep_times() rate_limiter_destroy(&limiter); } -void works_after_being_idle() +void works_after_being_idle(void) { time_now = 123123.0; RateLimiter limiter; @@ -45,7 +45,7 @@ void works_after_being_idle() rate_limiter_destroy(&limiter); } -void sleeps_correct_amount() +void sleeps_correct_amount(void) { RateLimiter limiter; rate_limiter_init(&limiter, 10, &gettimeofday_clock); @@ -58,7 +58,7 @@ void sleeps_correct_amount() rate_limiter_destroy(&limiter); } -void rate_limiter_suite() +void rate_limiter_suite(void) { computes_correct_sleep_times(); works_after_being_idle(); |