mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-18 04:38:08 +00:00
fixed wextra
This commit is contained in:
@ -30,6 +30,7 @@ extern void exit(int status);
|
|||||||
extern void __real_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 __wrap_exit(int status) {
|
||||||
|
(void)status;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,11 +40,13 @@ 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, ...);
|
||||||
int __wrap_printf(const char *format, ...) {
|
int __wrap_printf(const char *format, ...) {
|
||||||
|
(void)format;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rand with 0 seed would broke in the past */
|
/* Rand with 0 seed would broke in the past */
|
||||||
static void test_hash(void **state) {
|
static void test_hash(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
char bitmap[64] = {0};
|
char bitmap[64] = {0};
|
||||||
u64 hash0 = hash64(bitmap, sizeof(bitmap), 0xa5b35705);
|
u64 hash0 = hash64(bitmap, sizeof(bitmap), 0xa5b35705);
|
||||||
@ -62,6 +65,8 @@ static void test_hash(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
const struct CMUnitTest tests[] = {
|
const struct CMUnitTest tests[] = {
|
||||||
cmocka_unit_test(test_hash)
|
cmocka_unit_test(test_hash)
|
||||||
|
@ -27,23 +27,26 @@ extern void mock_assert(const int result, const char* const expression,
|
|||||||
(compile with `--wrap=exit`) */
|
(compile with `--wrap=exit`) */
|
||||||
extern void exit(int status);
|
extern void exit(int status);
|
||||||
extern void __real_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 __wrap_exit(int status) {
|
||||||
|
(void)status;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore all printfs */
|
/* ignore all printfs */
|
||||||
#undef printf
|
#undef printf
|
||||||
extern int printf(const char *format, ...);
|
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, ...);
|
||||||
int __wrap_printf(const char *format, ...) {
|
int __wrap_printf(const char *format, ...) {
|
||||||
|
(void)format;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static list_t testlist = {.element_prealloc_count = 0};
|
static list_t testlist = {.element_prealloc_count = 0};
|
||||||
|
|
||||||
static void test_contains(void **state) {
|
static void test_contains(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
u32 one = 1;
|
u32 one = 1;
|
||||||
u32 two = 2;
|
u32 two = 2;
|
||||||
@ -56,6 +59,7 @@ static void test_contains(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_foreach(void **state) {
|
static void test_foreach(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
u32 one = 1;
|
u32 one = 1;
|
||||||
u32 two = 2;
|
u32 two = 2;
|
||||||
@ -75,6 +79,7 @@ static void test_foreach(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_long_list(void **state) {
|
static void test_long_list(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
u32 result1 = 0;
|
u32 result1 = 0;
|
||||||
u32 result2 = 0;
|
u32 result2 = 0;
|
||||||
@ -118,6 +123,8 @@ static void test_long_list(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
const struct CMUnitTest tests[] = {
|
const struct CMUnitTest tests[] = {
|
||||||
cmocka_unit_test(test_contains),
|
cmocka_unit_test(test_contains),
|
||||||
|
@ -28,6 +28,7 @@ void __wrap_exit(int status);
|
|||||||
extern void exit(int status);
|
extern void exit(int status);
|
||||||
extern void __real_exit(int status);
|
extern void __real_exit(int status);
|
||||||
void __wrap_exit(int status) {
|
void __wrap_exit(int status) {
|
||||||
|
(void) status;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +36,9 @@ int __wrap_printf(const char *format, ...);
|
|||||||
/* ignore all printfs */
|
/* ignore all printfs */
|
||||||
#undef printf
|
#undef printf
|
||||||
extern int printf(const char *format, ...);
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +53,7 @@ static int setup(void **state) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void test_null_allocs(void **state) {
|
static void test_null_allocs(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
@ -62,6 +65,7 @@ static void test_null_allocs(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_nonpow2_size(void **state) {
|
static void test_nonpow2_size(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
char *buf = ck_alloc(150);
|
char *buf = ck_alloc(150);
|
||||||
size_t size = 150;
|
size_t size = 150;
|
||||||
@ -75,6 +79,7 @@ static void test_nonpow2_size(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_zero_size(void **state) {
|
static void test_zero_size(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
@ -95,6 +100,7 @@ static void test_zero_size(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_unchanged_size(void **state) {
|
static void test_unchanged_size(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
void *buf = ck_alloc(100);
|
void *buf = ck_alloc(100);
|
||||||
size_t size = 100;
|
size_t size = 100;
|
||||||
@ -107,6 +113,7 @@ static void test_unchanged_size(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_grow_multiple(void **state) {
|
static void test_grow_multiple(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
@ -146,6 +153,8 @@ static int teardown(void **state) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
const struct CMUnitTest tests[] = {
|
const struct CMUnitTest tests[] = {
|
||||||
cmocka_unit_test(test_null_allocs),
|
cmocka_unit_test(test_null_allocs),
|
||||||
|
@ -29,6 +29,7 @@ extern void exit(int status);
|
|||||||
extern void __real_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 __wrap_exit(int status) {
|
||||||
|
(void)status;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,8 +37,9 @@ void __wrap_exit(int status) {
|
|||||||
#undef printf
|
#undef printf
|
||||||
extern int printf(const char *format, ...);
|
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, ...);
|
||||||
int __wrap_printf(const char *format, ...) {
|
int __wrap_printf(const char *format, ...) {
|
||||||
|
(void)format;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +53,10 @@ typedef struct prealloc_me
|
|||||||
|
|
||||||
#define PREALLOCED_BUF_SIZE (64)
|
#define PREALLOCED_BUF_SIZE (64)
|
||||||
prealloc_me_t prealloc_me_buf[PREALLOCED_BUF_SIZE];
|
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) {
|
static void test_alloc_free(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
prealloc_me_t *prealloced = NULL;
|
prealloc_me_t *prealloced = NULL;
|
||||||
PRE_ALLOC(prealloced, prealloc_me_buf, PREALLOCED_BUF_SIZE, prealloc_me_size);
|
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) {
|
static void test_prealloc_overflow(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
prealloc_me_t *prealloced[PREALLOCED_BUF_SIZE + 10];
|
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) {
|
int main(int argc, char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
const struct CMUnitTest tests[] = {
|
const struct CMUnitTest tests[] = {
|
||||||
cmocka_unit_test(test_alloc_free),
|
cmocka_unit_test(test_alloc_free),
|
||||||
|
@ -29,8 +29,9 @@ extern void mock_assert(const int result, const char* const expression,
|
|||||||
(compile with `--wrap=exit`) */
|
(compile with `--wrap=exit`) */
|
||||||
extern void exit(int status);
|
extern void exit(int status);
|
||||||
extern void __real_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 __wrap_exit(int status) {
|
||||||
|
(void)status;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,11 +41,13 @@ 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, ...);
|
||||||
int __wrap_printf(const char *format, ...) {
|
int __wrap_printf(const char *format, ...) {
|
||||||
|
(void)format;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rand with 0 seed would broke in the past */
|
/* Rand with 0 seed would broke in the past */
|
||||||
static void test_rand_0(void **state) {
|
static void test_rand_0(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
afl_state_t afl = {0};
|
afl_state_t afl = {0};
|
||||||
rand_set_seed(&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) {
|
static void test_rand_below(void **state) {
|
||||||
|
(void)state;
|
||||||
|
|
||||||
afl_state_t afl = {0};
|
afl_state_t afl = {0};
|
||||||
rand_set_seed(&afl, 1337);
|
rand_set_seed(&afl, 1337);
|
||||||
@ -70,6 +74,8 @@ static void test_rand_below(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
const struct CMUnitTest tests[] = {
|
const struct CMUnitTest tests[] = {
|
||||||
cmocka_unit_test(test_rand_0),
|
cmocka_unit_test(test_rand_0),
|
||||||
|
Reference in New Issue
Block a user