diff options
author | Nathan Moinvaziri <nathan@nathanm.com> | 2021-06-13 15:16:20 -0700 |
---|---|---|
committer | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2021-06-21 11:19:21 +0200 |
commit | f0a801edc93c2f58e705e1cf76011560727084d2 (patch) | |
tree | 9c2b5a30a8125b64b078e09febb8a697c8b383f4 /test | |
parent | 89992dfbf11c3665f9c7808237a9ba865beb82f2 (diff) |
Added Z_UNUSED define for ignore unused variables.
Diffstat (limited to 'test')
-rw-r--r-- | test/example.c | 2 | ||||
-rw-r--r-- | test/fuzz/checksum_fuzzer.c | 16 | ||||
-rw-r--r-- | test/fuzz/standalone_fuzz_target_runner.c | 4 | ||||
-rw-r--r-- | test/infcover.c | 10 |
4 files changed, 17 insertions, 15 deletions
diff --git a/test/example.c b/test/example.c index 97ca002..5dc8290 100644 --- a/test/example.c +++ b/test/example.c @@ -229,7 +229,7 @@ void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen) { fprintf(stderr, "gzclose unexpected return when handle null\n"); exit(1); } - (void)read; + Z_UNUSED(read); #endif } diff --git a/test/fuzz/checksum_fuzzer.c b/test/fuzz/checksum_fuzzer.c index ef99421..da9f130 100644 --- a/test/fuzz/checksum_fuzzer.c +++ b/test/fuzz/checksum_fuzzer.c @@ -42,16 +42,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) { uint32_t crc4 = PREFIX(crc32_combine_op)(crc1, crc3, op); crc1 = PREFIX(crc32_z)(crc1, data + offset, buffSize); assert(crc1 == crc4); - (void)crc1; - (void)crc4; + Z_UNUSED(crc1); + Z_UNUSED(crc4); } crc1 = PREFIX(crc32_z)(crc1, data + offset, dataLen % buffSize); crc2 = PREFIX(crc32_z)(crc2, data, dataLen); assert(crc1 == crc2); - (void)crc1; - (void)crc2; + Z_UNUSED(crc1); + Z_UNUSED(crc2); combine1 = PREFIX(crc32_combine)(crc1, crc2, (z_off_t)dataLen); combine2 = PREFIX(crc32_combine)(crc1, crc1, (z_off_t)dataLen); assert(combine1 == combine2); @@ -73,13 +73,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) { adler2 = PREFIX(adler32_z)(adler2, data, dataLen); assert(adler1 == adler2); - (void)adler1; - (void)adler2; + Z_UNUSED(adler1); + Z_UNUSED(adler2); combine1 = PREFIX(adler32_combine)(adler1, adler2, (z_off_t)dataLen); combine2 = PREFIX(adler32_combine)(adler1, adler1, (z_off_t)dataLen); assert(combine1 == combine2); - (void)combine1; - (void)combine2; + Z_UNUSED(combine1); + Z_UNUSED(combine2); /* This function must return 0. */ return 0; diff --git a/test/fuzz/standalone_fuzz_target_runner.c b/test/fuzz/standalone_fuzz_target_runner.c index a291b48..49f5e7f 100644 --- a/test/fuzz/standalone_fuzz_target_runner.c +++ b/test/fuzz/standalone_fuzz_target_runner.c @@ -2,6 +2,8 @@ #include <stdio.h> #include <stdlib.h> +#include "zbuild.h" + extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); int main(int argc, char **argv) { @@ -28,7 +30,7 @@ int main(int argc, char **argv) { free(buf); err = fclose(f); assert(err == 0); - (void)err; + Z_UNUSED(err); fprintf(stderr, "Done: %s: (%d bytes)\n", argv[i], (int)n_read); } diff --git a/test/infcover.c b/test/infcover.c index 3466b20..3446289 100644 --- a/test/infcover.c +++ b/test/infcover.c @@ -348,7 +348,7 @@ static void inf(char *hex, char *what, unsigned step, int win, unsigned len, int ret = PREFIX(inflateReset2)(&strm, -8); assert(ret == Z_OK); ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); mem_done(&strm, what); - (void)err; + Z_UNUSED(err); } /* cover all of the lines in inflate.c up to inflate() */ @@ -386,7 +386,7 @@ static void cover_support(void) { ret = PREFIX(inflateInit)(&strm); assert(ret == Z_OK); ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); fputs("inflate built-in memory routines\n", stderr); - (void)ret; + Z_UNUSED(ret); } /* cover all inflate() header and trailer cases and code after inflate() */ @@ -470,7 +470,7 @@ static unsigned pull(void *desc, z_const unsigned char **buf) { static int push(void *desc, unsigned char *buf, unsigned len) { buf += len; - (void)buf; + Z_UNUSED(buf); return desc != NULL; /* force error if desc not null */ } @@ -511,7 +511,7 @@ static void cover_back(void) { assert(ret == Z_OK); ret = PREFIX(inflateBackEnd)(&strm); assert(ret == Z_OK); fputs("inflateBack built-in memory routines\n", stderr); - (void)ret; + Z_UNUSED(ret); } /* do a raw inflate of data in hexadecimal with both inflate and inflateBack */ @@ -647,7 +647,7 @@ static void cover_trees(void) { ret = zng_inflate_table(DISTS, lens, 16, &next, &bits, work); assert(ret == 1); fputs("inflate_table not enough errors\n", stderr); - (void)ret; + Z_UNUSED(ret); } /* cover remaining inffast.c decoding and window copying */ |