fixed wextra
MODIFY
test/unittests/unit_hash.c
test/unittests/unit_hash.c
@@ -30,6 +30,7 @@ extern void exit(int status);
extern void __real_exit(int status);
void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
@@ -39,11 +40,13 @@ extern int printf(const char *format, ...);
extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
/* Rand with 0 seed would broke in the past */
static void test_hash(void **state) {
+ (void)state;
char bitmap[64] = {0};
u64 hash0 = hash64(bitmap, sizeof(bitmap), 0xa5b35705);
@@ -62,6 +65,8 @@ static void test_hash(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_hash)

MODIFY
test/unittests/unit_list.c
test/unittests/unit_list.c
@@ -27,23 +27,26 @@ extern void mock_assert(const int result, const char* const expression,
(compile with `--wrap=exit`) */
extern void exit(int status);
extern void __real_exit(int status);
-void __wrap_exit(int status);
+//void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
/* ignore all printfs */
#undef printf
extern int printf(const char *format, ...);
-extern int __real_printf(const char *format, ...);
+//extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
static list_t testlist = {.element_prealloc_count = 0};
static void test_contains(void **state) {
+ (void)state;
u32 one = 1;
u32 two = 2;
@@ -56,6 +59,7 @@ static void test_contains(void **state) {
}
static void test_foreach(void **state) {
+ (void)state;
u32 one = 1;
u32 two = 2;
@@ -75,6 +79,7 @@ static void test_foreach(void **state) {
}
static void test_long_list(void **state) {
+ (void)state;
u32 result1 = 0;
u32 result2 = 0;
@@ -118,6 +123,8 @@ static void test_long_list(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_contains),

MODIFY
test/unittests/unit_maybe_alloc.c
test/unittests/unit_maybe_alloc.c
@@ -28,6 +28,7 @@ void __wrap_exit(int status);
extern void exit(int status);
extern void __real_exit(int status);
void __wrap_exit(int status) {
+ (void) status;
assert(0);
}
@@ -35,8 +36,9 @@ int __wrap_printf(const char *format, ...);
/* ignore all printfs */
#undef printf
extern int printf(const char *format, ...);
-extern int __real_printf(const char *format, ...);
+//extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
@@ -51,6 +53,7 @@ static int setup(void **state) {
*/
static void test_null_allocs(void **state) {
+ (void)state;
void *buf = NULL;
size_t size = 0;
@@ -62,6 +65,7 @@ static void test_null_allocs(void **state) {
}
static void test_nonpow2_size(void **state) {
+ (void)state;
char *buf = ck_alloc(150);
size_t size = 150;
@@ -75,6 +79,7 @@ static void test_nonpow2_size(void **state) {
}
static void test_zero_size(void **state) {
+ (void)state;
char *buf = NULL;
size_t size = 0;
@@ -95,6 +100,7 @@ static void test_zero_size(void **state) {
}
static void test_unchanged_size(void **state) {
+ (void)state;
void *buf = ck_alloc(100);
size_t size = 100;
@@ -107,6 +113,7 @@ static void test_unchanged_size(void **state) {
}
static void test_grow_multiple(void **state) {
+ (void)state;
char *buf = NULL;
size_t size = 0;
@@ -146,6 +153,8 @@ static int teardown(void **state) {
*/
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_null_allocs),

MODIFY
test/unittests/unit_preallocable.c
test/unittests/unit_preallocable.c
@@ -29,6 +29,7 @@ extern void exit(int status);
extern void __real_exit(int status);
void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
@@ -36,8 +37,9 @@ void __wrap_exit(int status) {
#undef printf
extern int printf(const char *format, ...);
extern int __real_printf(const char *format, ...);
-int __wrap_printf(const char *format, ...);
+//int __wrap_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
@@ -51,9 +53,10 @@ typedef struct prealloc_me
#define PREALLOCED_BUF_SIZE (64)
prealloc_me_t prealloc_me_buf[PREALLOCED_BUF_SIZE];
-size_t prealloc_me_size = 0;
+s32 prealloc_me_size = 0;
static void test_alloc_free(void **state) {
+ (void)state;
prealloc_me_t *prealloced = NULL;
PRE_ALLOC(prealloced, prealloc_me_buf, PREALLOCED_BUF_SIZE, prealloc_me_size);
@@ -63,6 +66,7 @@ static void test_alloc_free(void **state) {
}
static void test_prealloc_overflow(void **state) {
+ (void)state;
u32 i = 0;
prealloc_me_t *prealloced[PREALLOCED_BUF_SIZE + 10];
@@ -102,6 +106,8 @@ static void test_prealloc_overflow(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_alloc_free),

MODIFY
test/unittests/unit_rand.c
test/unittests/unit_rand.c
@@ -29,8 +29,9 @@ extern void mock_assert(const int result, const char* const expression,
(compile with `--wrap=exit`) */
extern void exit(int status);
extern void __real_exit(int status);
-void __wrap_exit(int status);
+//void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
@@ -40,11 +41,13 @@ extern int printf(const char *format, ...);
extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
/* Rand with 0 seed would broke in the past */
static void test_rand_0(void **state) {
+ (void)state;
afl_state_t afl = {0};
rand_set_seed(&afl, 0);
@@ -58,6 +61,7 @@ static void test_rand_0(void **state) {
}
static void test_rand_below(void **state) {
+ (void)state;
afl_state_t afl = {0};
rand_set_seed(&afl, 1337);
@@ -70,6 +74,8 @@ static void test_rand_below(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_rand_0),

fixed wextra