From: Rusty Russell Date: Sun, 6 Nov 2016 04:34:17 +0000 (+1030) Subject: Mark unused arguments in many modules. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=ad2ce76c10f808283ea7cf25cd8e76a15710c4f3;hp=5877402640cff05f779b23a730e4cc62d729113f Mark unused arguments in many modules. Either with UNNEEDED (if the module already used ccan/compiler) or with (void) casting. The only other change is in ccan/list/test/run-CCAN_LIST_DEBUG.c, because the linenumbers change and thus it needs updating. Signed-off-by: Rusty Russell --- diff --git a/ccan/array_size/test/compile_fail.c b/ccan/array_size/test/compile_fail.c index 37d315f2..9bd65682 100644 --- a/ccan/array_size/test/compile_fail.c +++ b/ccan/array_size/test/compile_fail.c @@ -2,6 +2,8 @@ int main(int argc, char *argv[8]) { + (void)argc; + (void)argv; char array[100]; #ifdef FAIL return ARRAY_SIZE(argv) + ARRAY_SIZE(array); diff --git a/ccan/asort/test/compile_fail-context-type.c b/ccan/asort/test/compile_fail-context-type.c index 473d1026..aa2340f4 100644 --- a/ccan/asort/test/compile_fail-context-type.c +++ b/ccan/asort/test/compile_fail-context-type.c @@ -1,7 +1,7 @@ #include #include -static int cmp(char *const *a, char *const *b, int *flag) +static int cmp(char *const *a UNNEEDED, char *const *b UNNEEDED, int *flag UNNEEDED) { return 0; } diff --git a/ccan/autodata/autodata.c b/ccan/autodata/autodata.c index d8ea88fe..e8086e3a 100644 --- a/ccan/autodata/autodata.c +++ b/ccan/autodata/autodata.c @@ -11,7 +11,7 @@ void *autodata_get_section(void *start, void *stop, size_t *nump) return start; } -void autodata_free(void *table) +void autodata_free(void *table UNNEEDED) { } #else diff --git a/ccan/cast/test/compile_ok-static.c b/ccan/cast/test/compile_ok-static.c index 98b667e8..a7c65725 100644 --- a/ccan/cast/test/compile_ok-static.c +++ b/ccan/cast/test/compile_ok-static.c @@ -6,5 +6,6 @@ static char *p = cast_const(char *, (const char *)"hello"); int main(int argc, char *argv[]) { + (void)argc; return p[0] == argv[0][0]; } diff --git a/ccan/check_type/test/compile_fail-check_type.c b/ccan/check_type/test/compile_fail-check_type.c index fe7d6a23..4c22c65a 100644 --- a/ccan/check_type/test/compile_fail-check_type.c +++ b/ccan/check_type/test/compile_fail-check_type.c @@ -2,6 +2,8 @@ int main(int argc, char *argv[]) { + (void)argc; + (void)argv; #ifdef FAIL check_type(argc, char); #endif diff --git a/ccan/check_type/test/compile_fail-check_type_unsigned.c b/ccan/check_type/test/compile_fail-check_type_unsigned.c index 574d4aeb..795e7606 100644 --- a/ccan/check_type/test/compile_fail-check_type_unsigned.c +++ b/ccan/check_type/test/compile_fail-check_type_unsigned.c @@ -2,6 +2,8 @@ int main(int argc, char *argv[]) { + (void)argc; + (void)argv; #ifdef FAIL #if HAVE_TYPEOF check_type(argc, unsigned int); diff --git a/ccan/check_type/test/compile_fail-check_types_match.c b/ccan/check_type/test/compile_fail-check_types_match.c index cbd6e9bc..fb83738b 100644 --- a/ccan/check_type/test/compile_fail-check_types_match.c +++ b/ccan/check_type/test/compile_fail-check_types_match.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { unsigned char x = argc; + (void)argv; #ifdef FAIL check_types_match(argc, x); #endif diff --git a/ccan/check_type/test/run.c b/ccan/check_type/test/run.c index 83b903c0..09fd3634 100644 --- a/ccan/check_type/test/run.c +++ b/ccan/check_type/test/run.c @@ -5,6 +5,7 @@ int main(int argc, char *argv[]) { int x = 0, y = 0; + (void)argv; plan_tests(9); ok1(check_type(argc, int) == 0); diff --git a/ccan/compiler/_info b/ccan/compiler/_info index d60dff4d..12cb2475 100644 --- a/ccan/compiler/_info +++ b/ccan/compiler/_info @@ -41,7 +41,7 @@ * va_end(ap); * } * - * int main(int argc, char *argv[]) + * int main(int argc, char *argv[] UNNEEDED) * { * if (argc != 1) { * logger(3, "Don't want %i arguments!\n", argc-1); diff --git a/ccan/compiler/test/compile_fail-printf.c b/ccan/compiler/test/compile_fail-printf.c index 8f34ae5a..7664f65d 100644 --- a/ccan/compiler/test/compile_fail-printf.c +++ b/ccan/compiler/test/compile_fail-printf.c @@ -2,9 +2,11 @@ static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...) { + (void)x; + (void)fmt; } -int main(int argc, char *argv[]) +int main(void) { unsigned int i = 0; diff --git a/ccan/compiler/test/run-is_compile_constant.c b/ccan/compiler/test/run-is_compile_constant.c index a66f2e13..c914c683 100644 --- a/ccan/compiler/test/run-is_compile_constant.c +++ b/ccan/compiler/test/run-is_compile_constant.c @@ -3,6 +3,8 @@ int main(int argc, char *argv[]) { + (void)argc; + (void)argv; plan_tests(2); ok1(!IS_COMPILE_CONSTANT(argc)); diff --git a/ccan/crypto/siphash24/siphash24.c b/ccan/crypto/siphash24/siphash24.c index d250de32..20daa74d 100644 --- a/ccan/crypto/siphash24/siphash24.c +++ b/ccan/crypto/siphash24/siphash24.c @@ -45,6 +45,7 @@ static void check_siphash24(struct siphash24_ctx *ctx) static bool alignment_ok(const void *p, size_t n) { #if HAVE_UNALIGNED_ACCESS + (void)p; (void)n; return true; #else return ((size_t)p % n == 0); diff --git a/ccan/err/test/run.c b/ccan/err/test/run.c index c103f7cd..aeaa3750 100644 --- a/ccan/err/test/run.c +++ b/ccan/err/test/run.c @@ -15,6 +15,7 @@ int main(int argc, char *argv[]) int pfd[2]; const char *base; + (void)argc; plan_tests(24); err_set_progname(argv[0]); diff --git a/ccan/htable/_info b/ccan/htable/_info index 7e06c386..a55343b4 100644 --- a/ccan/htable/_info +++ b/ccan/htable/_info @@ -36,6 +36,7 @@ * // Wrapper for rehash function pointer. * static size_t rehash(const void *e, void *unused) * { + * (void)unused; * return hash_string(((struct name_to_digit *)e)->name); * } * diff --git a/ccan/htable/htable.h b/ccan/htable/htable.h index 61ed9170..9845388e 100644 --- a/ccan/htable/htable.h +++ b/ccan/htable/htable.h @@ -35,6 +35,7 @@ struct htable { * // For simplicity's sake, say hash value is contents of elem. * static size_t rehash(const void *elem, void *unused) * { + * (void)unused; * return *(size_t *)elem; * } * static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL); diff --git a/ccan/htable/test/run-copy.c b/ccan/htable/test/run-copy.c index 2bc17786..d111495a 100644 --- a/ccan/htable/test/run-copy.c +++ b/ccan/htable/test/run-copy.c @@ -6,7 +6,7 @@ #define NUM_VALS 512 -static size_t hash(const void *elem, void *unused) +static size_t hash(const void *elem, void *unused UNNEEDED) { size_t h = *(uint64_t *)elem / 2; return h; diff --git a/ccan/htable/test/run-size.c b/ccan/htable/test/run-size.c index 5b326389..1a2f5cdd 100644 --- a/ccan/htable/test/run-size.c +++ b/ccan/htable/test/run-size.c @@ -8,7 +8,7 @@ /* We use the number divided by two as the hash (for lots of collisions). */ -static size_t hash(const void *elem, void *unused) +static size_t hash(const void *elem, void *unused UNNEEDED) { size_t h = *(uint64_t *)elem / 2; return h; diff --git a/ccan/htable/test/run-type-int.c b/ccan/htable/test/run-type-int.c index 061ae76f..7b71815f 100644 --- a/ccan/htable/test/run-type-int.c +++ b/ccan/htable/test/run-type-int.c @@ -88,7 +88,7 @@ static void del_vals(struct htable_obj *ht, } static void del_vals_bykey(struct htable_obj *ht, - const struct obj val[], unsigned int num) + const struct obj val[] UNNEEDED, unsigned int num) { unsigned int i; diff --git a/ccan/htable/test/run-zero-hash-first-entry.c b/ccan/htable/test/run-zero-hash-first-entry.c index fdd18569..3a1a939e 100644 --- a/ccan/htable/test/run-zero-hash-first-entry.c +++ b/ccan/htable/test/run-zero-hash-first-entry.c @@ -8,7 +8,7 @@ struct data { }; /* Hash is simply key itself. */ -static size_t hash(const void *e, void *unused) +static size_t hash(const void *e, void *unused UNNEEDED) { struct data *d = (struct data *)e; diff --git a/ccan/htable/test/run.c b/ccan/htable/test/run.c index 98f20871..46514c72 100644 --- a/ccan/htable/test/run.c +++ b/ccan/htable/test/run.c @@ -10,7 +10,7 @@ /* We use the number divided by two as the hash (for lots of collisions), plus set all the higher bits so we can detect if they don't get masked out. */ -static size_t hash(const void *elem, void *unused) +static size_t hash(const void *elem, void *unused UNNEEDED) { size_t h = *(uint64_t *)elem / 2; h |= -1UL << NUM_BITS; diff --git a/ccan/list/test/run-CCAN_LIST_DEBUG.c b/ccan/list/test/run-CCAN_LIST_DEBUG.c index 9ff41078..b8e5165a 100644 --- a/ccan/list/test/run-CCAN_LIST_DEBUG.c +++ b/ccan/list/test/run-CCAN_LIST_DEBUG.c @@ -17,6 +17,7 @@ static int my_fprintf(FILE *stream, const char *format, ...) { va_list ap; int ret; + (void)stream; va_start(ap, format); ret = vsprintf(printf_buffer, format, ap); va_end(ap); @@ -44,7 +45,7 @@ int main(void) list.n.prev = &n1; /* Aborting version. */ - sprintf(expect, "run-CCAN_LIST_DEBUG.c:50: prev corrupt in node %p (0) of %p\n", + sprintf(expect, "run-CCAN_LIST_DEBUG.c:51: prev corrupt in node %p (0) of %p\n", &list, &list); if (setjmp(aborted) == 0) { assert(list_empty(&list)); diff --git a/ccan/list/test/run-check-corrupt.c b/ccan/list/test/run-check-corrupt.c index c6873c7a..94c2e67e 100644 --- a/ccan/list/test/run-check-corrupt.c +++ b/ccan/list/test/run-check-corrupt.c @@ -16,6 +16,7 @@ static int my_fprintf(FILE *stream, const char *format, ...) { va_list ap; int ret; + (void)stream; va_start(ap, format); ret = vsprintf(printf_buffer, format, ap); va_end(ap); diff --git a/ccan/mem/mem.h b/ccan/mem/mem.h index f2c3d5c7..19f69c03 100644 --- a/ccan/mem/mem.h +++ b/ccan/mem/mem.h @@ -250,6 +250,7 @@ static inline void *memcheck_(const void *data, size_t len) #else static inline void *memcheck_(const void *data, size_t len) { + (void)len; return (void *)data; } #endif diff --git a/ccan/opt/opt.h b/ccan/opt/opt.h index 690907e5..0d508cf6 100644 --- a/ccan/opt/opt.h +++ b/ccan/opt/opt.h @@ -185,7 +185,7 @@ void opt_register_table(const struct opt_table *table, const char *desc); * string (or see opt_set_alloc) and return false. * * Example: - * static char *explode(const char *optarg, void *unused) + * static char *explode(const char *optarg, void *unused UNNEEDED) * { * errx(1, "BOOM! %s", optarg); * } diff --git a/ccan/opt/test/run-add_desc.c b/ccan/opt/test/run-add_desc.c index 03fe37eb..b559c7f7 100644 --- a/ccan/opt/test/run-add_desc.c +++ b/ccan/opt/test/run-add_desc.c @@ -4,13 +4,13 @@ #include #include -static void show_10(char buf[OPT_SHOW_LEN], const void *arg) +static void show_10(char buf[OPT_SHOW_LEN], const void *arg UNNEEDED) { memset(buf, 'X', 10); buf[10] = '\0'; } -static void show_max(char buf[OPT_SHOW_LEN], const void *arg) +static void show_max(char buf[OPT_SHOW_LEN], const void *arg UNNEEDED) { memset(buf, 'X', OPT_SHOW_LEN); } diff --git a/ccan/opt/test/run-helpers.c b/ccan/opt/test/run-helpers.c index 6ec17f58..0a08a85f 100644 --- a/ccan/opt/test/run-helpers.c +++ b/ccan/opt/test/run-helpers.c @@ -52,7 +52,7 @@ static int saved_printf(const char *fmt, ...) return ret; } -static int saved_fprintf(FILE *ignored, const char *fmt, ...) +static int saved_fprintf(FILE *ignored UNNEEDED, const char *fmt, ...) { va_list ap; int ret; diff --git a/ccan/opt/test/run-set_alloc.c b/ccan/opt/test/run-set_alloc.c index 6a10d597..1dbb351b 100644 --- a/ccan/opt/test/run-set_alloc.c +++ b/ccan/opt/test/run-set_alloc.c @@ -2,15 +2,15 @@ #include /* Make sure we override these! */ -static void *no_malloc(size_t size) +static void *no_malloc(size_t size UNNEEDED) { abort(); } -static void *no_realloc(void *p, size_t size) +static void *no_realloc(void *p UNNEEDED, size_t size UNNEEDED) { abort(); } -static void no_free(void *p) +static void no_free(void *p UNNEEDED) { abort(); } diff --git a/ccan/opt/test/run-usage.c b/ccan/opt/test/run-usage.c index aec83244..cea678f3 100644 --- a/ccan/opt/test/run-usage.c +++ b/ccan/opt/test/run-usage.c @@ -6,7 +6,7 @@ #include "utils.h" /* Ensure width is sane. */ -static const char *getenv_override(const char *name) +static const char *getenv_override(const char *name UNNEEDED) { return "100"; } @@ -18,13 +18,13 @@ static const char *getenv_override(const char *name) #include #include -static char *my_cb(void *p) +static char *my_cb(void *p UNNEEDED) { return NULL; } /* Test helpers. */ -int main(int argc, char *argv[]) +int main(void) { char *output; char *longname = strdup("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); diff --git a/ccan/opt/test/utils.c b/ccan/opt/test/utils.c index c2967fca..a9bedf2e 100644 --- a/ccan/opt/test/utils.c +++ b/ccan/opt/test/utils.c @@ -8,7 +8,7 @@ #include "utils.h" unsigned int test_cb_called; -char *test_noarg(void *arg) +char *test_noarg(void *arg UNNEEDED) { test_cb_called++; return NULL; diff --git a/ccan/order/order.c b/ccan/order/order.c index 863a8e16..5ff85a98 100644 --- a/ccan/order/order.c +++ b/ccan/order/order.c @@ -24,7 +24,7 @@ const _type *b, \ void *ctx) \ { \ - return _order_##_oname(a, b, int2ptr(0)); \ + (void)ctx; return _order_##_oname(a, b, int2ptr(0)); \ } \ int _order_##_oname##_reverse(const void *a, \ const void *b, \ @@ -36,6 +36,7 @@ const _type *b, \ void *ctx) \ { \ + (void)ctx; \ return _order_##_oname##_reverse(a, b, int2ptr(0)); \ } \ int order_##_oname##_noctx(const void *a, \ diff --git a/ccan/read_write_all/test/run-read_all.c b/ccan/read_write_all/test/run-read_all.c index 0cdce187..6e6588d4 100644 --- a/ccan/read_write_all/test/run-read_all.c +++ b/ccan/read_write_all/test/run-read_all.c @@ -17,6 +17,7 @@ static int p2c[2], c2p[2]; static void got_signal(int sig) { char c = 0; + (void)sig; if (write(p2c[1], &c, 1) == 1) sigcount++; } diff --git a/ccan/read_write_all/test/run-write_all.c b/ccan/read_write_all/test/run-write_all.c index 36e4119e..c789d6b7 100644 --- a/ccan/read_write_all/test/run-write_all.c +++ b/ccan/read_write_all/test/run-write_all.c @@ -19,6 +19,9 @@ static ssize_t write_return; static ssize_t test_write(int fd, const void *buf, size_t count) { + (void)fd; + (void)buf; + if (write_return == 0) { errno = ENOSPC; return 0; diff --git a/ccan/str/test/compile_fail-isalnum.c b/ccan/str/test/compile_fail-isalnum.c index 930defff..5d989582 100644 --- a/ccan/str/test/compile_fail-isalnum.c +++ b/ccan/str/test/compile_fail-isalnum.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isalnum. diff --git a/ccan/str/test/compile_fail-isalpha.c b/ccan/str/test/compile_fail-isalpha.c index 20051098..33d36553 100644 --- a/ccan/str/test/compile_fail-isalpha.c +++ b/ccan/str/test/compile_fail-isalpha.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isalpha. diff --git a/ccan/str/test/compile_fail-isascii.c b/ccan/str/test/compile_fail-isascii.c index ee55e499..3946e0b3 100644 --- a/ccan/str/test/compile_fail-isascii.c +++ b/ccan/str/test/compile_fail-isascii.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isascii. diff --git a/ccan/str/test/compile_fail-isblank.c b/ccan/str/test/compile_fail-isblank.c index f4cb961d..e14b0d7e 100644 --- a/ccan/str/test/compile_fail-isblank.c +++ b/ccan/str/test/compile_fail-isblank.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF || !HAVE_ISBLANK #error We need typeof to check isblank. diff --git a/ccan/str/test/compile_fail-iscntrl.c b/ccan/str/test/compile_fail-iscntrl.c index bc741465..f9abf1dc 100644 --- a/ccan/str/test/compile_fail-iscntrl.c +++ b/ccan/str/test/compile_fail-iscntrl.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check iscntrl. diff --git a/ccan/str/test/compile_fail-isdigit.c b/ccan/str/test/compile_fail-isdigit.c index 71d1c714..a3ee439c 100644 --- a/ccan/str/test/compile_fail-isdigit.c +++ b/ccan/str/test/compile_fail-isdigit.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isdigit. diff --git a/ccan/str/test/compile_fail-islower.c b/ccan/str/test/compile_fail-islower.c index ca3f9907..8f5c4561 100644 --- a/ccan/str/test/compile_fail-islower.c +++ b/ccan/str/test/compile_fail-islower.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check islower. diff --git a/ccan/str/test/compile_fail-isprint.c b/ccan/str/test/compile_fail-isprint.c index 6432e41d..85ed028f 100644 --- a/ccan/str/test/compile_fail-isprint.c +++ b/ccan/str/test/compile_fail-isprint.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isprint. diff --git a/ccan/str/test/compile_fail-ispunct.c b/ccan/str/test/compile_fail-ispunct.c index 5d941fcb..09d4279a 100644 --- a/ccan/str/test/compile_fail-ispunct.c +++ b/ccan/str/test/compile_fail-ispunct.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check ispunct. diff --git a/ccan/str/test/compile_fail-isspace.c b/ccan/str/test/compile_fail-isspace.c index bfee1f89..798cfcd4 100644 --- a/ccan/str/test/compile_fail-isspace.c +++ b/ccan/str/test/compile_fail-isspace.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isspace. diff --git a/ccan/str/test/compile_fail-isupper.c b/ccan/str/test/compile_fail-isupper.c index 4cf9fd35..56f5dee1 100644 --- a/ccan/str/test/compile_fail-isupper.c +++ b/ccan/str/test/compile_fail-isupper.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isupper. diff --git a/ccan/str/test/compile_fail-isxdigit.c b/ccan/str/test/compile_fail-isxdigit.c index 65e6006a..ea4d5269 100644 --- a/ccan/str/test/compile_fail-isxdigit.c +++ b/ccan/str/test/compile_fail-isxdigit.c @@ -3,6 +3,7 @@ int main(int argc, char *argv[]) { + (void)argc; #ifdef FAIL #if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF #error We need typeof to check isxdigit. diff --git a/ccan/strmap/_info b/ccan/strmap/_info index c128cc27..b8768698 100644 --- a/ccan/strmap/_info +++ b/ccan/strmap/_info @@ -16,10 +16,11 @@ * license_depends_compat FAIL * * Example: + * #include * #include * #include * - * static bool dump(const char *member, size_t value, void *unused) + * static bool dump(const char *member, size_t value, void *unused UNNEEDED) * { * printf("%s at %zu. ", member, value); * // true means keep going with iteration. diff --git a/ccan/strmap/test/run-iterate-const.c b/ccan/strmap/test/run-iterate-const.c index 63bea952..dfd9dca7 100644 --- a/ccan/strmap/test/run-iterate-const.c +++ b/ccan/strmap/test/run-iterate-const.c @@ -5,7 +5,7 @@ static bool found = false; /* Make sure const args work. */ -static bool find_string(const char *str, char *member, const char *cmp) +static bool find_string(const char *str UNNEEDED, char *member, const char *cmp) { if (strcmp(member, cmp) == 0) found = true; diff --git a/ccan/strmap/test/run-prefix.c b/ccan/strmap/test/run-prefix.c index d88eb556..6232d71b 100644 --- a/ccan/strmap/test/run-prefix.c +++ b/ccan/strmap/test/run-prefix.c @@ -15,7 +15,7 @@ static bool in_order(const char *index, char *value, unsigned int *count) return true; } -static bool find_empty(const char *index, char *value, char *empty) +static bool find_empty(const char *index, char *value UNNEEDED, char *empty) { if (index == empty) pass("Found empty entry!"); diff --git a/ccan/take/test/run.c b/ccan/take/test/run.c index 0c8ca2a1..ba170fb3 100644 --- a/ccan/take/test/run.c +++ b/ccan/take/test/run.c @@ -15,7 +15,7 @@ static void *my_realloc(void *p, size_t len) #include static int my_allocfail_called; -static void my_allocfail(const void *p) +static void my_allocfail(const void *p UNNEEDED) { my_allocfail_called++; } diff --git a/ccan/tal/link/link.c b/ccan/tal/link/link.c index c25d97e5..7c8892d2 100644 --- a/ccan/tal/link/link.c +++ b/ccan/tal/link/link.c @@ -15,7 +15,7 @@ struct link { static void linkable_notifier(tal_t *linkable, enum tal_notify_type type, - void *info) + void *info UNNEEDED) { struct linkable *l = tal_parent(linkable); assert(type == TAL_NOTIFY_STEAL || type == TAL_NOTIFY_FREE); diff --git a/ccan/tal/link/test/run.c b/ccan/tal/link/test/run.c index 8533f76a..e031fef2 100644 --- a/ccan/tal/link/test/run.c +++ b/ccan/tal/link/test/run.c @@ -4,7 +4,7 @@ #include static unsigned int destroy_count = 0; -static void destroy_obj(void *obj) +static void destroy_obj(void *obj UNNEEDED) { destroy_count++; } diff --git a/ccan/tal/str/str.h b/ccan/tal/str/str.h index 0c182133..5147ca2d 100644 --- a/ccan/tal/str/str.h +++ b/ccan/tal/str/str.h @@ -171,6 +171,7 @@ char *tal_strjoin(const void *ctx, char *strings[], const char *delim, * { * char *person, *input; * + * (void)argc; * // Join args and trim trailing space. * input = tal_strjoin(NULL, argv+1, " ", STR_NO_TRAIL); * if (tal_strreg(NULL, input, diff --git a/ccan/tal/tal.c b/ccan/tal/tal.c index 79476772..842059d0 100644 --- a/ccan/tal/tal.c +++ b/ccan/tal/tal.c @@ -323,7 +323,7 @@ static struct name *add_name_property(struct tal_hdr *t, const char *name) } static struct children *add_child_property(struct tal_hdr *parent, - struct tal_hdr *child) + struct tal_hdr *child UNNEEDED) { struct children *prop = allocate(sizeof(*prop)); if (prop) { diff --git a/ccan/tal/test/run-allocfail.c b/ccan/tal/test/run-allocfail.c index a166be3f..97cba9f6 100644 --- a/ccan/tal/test/run-allocfail.c +++ b/ccan/tal/test/run-allocfail.c @@ -30,7 +30,7 @@ static void nofail_on_error(const char *msg) err_count++; } -static void destroy_p(void *p) +static void destroy_p(void *p UNNEEDED) { } diff --git a/ccan/tal/test/run-destructor.c b/ccan/tal/test/run-destructor.c index 87354888..7183f7c5 100644 --- a/ccan/tal/test/run-destructor.c +++ b/ccan/tal/test/run-destructor.c @@ -24,7 +24,7 @@ static void destroy_child(char *p) destroy_count++; } -static void destroy_inc(char *p) +static void destroy_inc(char *p UNNEEDED) { destroy_count++; } diff --git a/ccan/tal/test/run-free.c b/ccan/tal/test/run-free.c index 29aa8c6f..f2126474 100644 --- a/ccan/tal/test/run-free.c +++ b/ccan/tal/test/run-free.c @@ -2,7 +2,7 @@ #include #include -static void destroy_errno(char *p) +static void destroy_errno(char *p UNNEEDED) { errno = ENOENT; } diff --git a/ccan/tal/test/run-notifier.c b/ccan/tal/test/run-notifier.c index b57c902e..3820444f 100644 --- a/ccan/tal/test/run-notifier.c +++ b/ccan/tal/test/run-notifier.c @@ -20,7 +20,7 @@ static void *my_realloc(void *old, size_t size) return new; } -static void notify1(char *p, enum tal_notify_type notify, void *info) +static void notify1(char *p UNNEEDED, enum tal_notify_type notify, void *info) { ok1(ctx == ctx); ok1(notify == expect); @@ -31,7 +31,9 @@ static void notify1(char *p, enum tal_notify_type notify, void *info) notified1++; } -static void notify2(char *ctx, enum tal_notify_type notify, void *info) +static void notify2(char *ctx UNNEEDED, + enum tal_notify_type notify UNNEEDED, + void *info UNNEEDED) { notified2++; } diff --git a/ccan/tal/test/run-overflow.c b/ccan/tal/test/run-overflow.c index d975398b..d1919c1c 100644 --- a/ccan/tal/test/run-overflow.c +++ b/ccan/tal/test/run-overflow.c @@ -4,7 +4,7 @@ static int error_count; -static void my_error(const char *msg) +static void my_error(const char *msg UNNEEDED) { error_count++; } diff --git a/ccan/tal/test/run-test-backend.c b/ccan/tal/test/run-test-backend.c index 8fdfc064..ebcd8111 100644 --- a/ccan/tal/test/run-test-backend.c +++ b/ccan/tal/test/run-test-backend.c @@ -31,7 +31,7 @@ static void *my_realloc(void *old, size_t new_size) #define NUM_ALLOCS 1000 -static void destroy_p(void *p) +static void destroy_p(void *p UNNEEDED) { } diff --git a/ccan/tcon/test/compile_ok-void.c b/ccan/tcon/test/compile_ok-void.c index 694a53b5..442ca659 100644 --- a/ccan/tcon/test/compile_ok-void.c +++ b/ccan/tcon/test/compile_ok-void.c @@ -15,6 +15,7 @@ int main(int argc, char *argv[]) struct void_container vcon; TCON_WRAP(struct container, void *canary) vconw; + (void)argc; tcon_check(&vcon, canary, NULL)->raw.p = NULL; tcon_check(&vcon, canary, argv[0])->raw.p = NULL; tcon_check(&vcon, canary, main)->raw.p = NULL; diff --git a/ccan/tcon/test/compile_ok.c b/ccan/tcon/test/compile_ok.c index f3fe2c6f..6ba5f4c1 100644 --- a/ccan/tcon/test/compile_ok.c +++ b/ccan/tcon/test/compile_ok.c @@ -23,6 +23,7 @@ int main(int argc, char *argv[]) TCON_WRAP(struct container, int tc) iconw; TCON_WRAP(struct container, int tc1; char *tc2) ciconw; + (void)argc; tcon_check(&icon, tc, 7)->raw.p = NULL; tcon_check(&cicon, tc1, 7)->raw.p = argv[0]; tcon_check(&cicon, tc2, argv[0])->raw.p = argv[0]; diff --git a/ccan/timer/_info b/ccan/timer/_info index c3a01e30..9f5ec7a2 100644 --- a/ccan/timer/_info +++ b/ccan/timer/_info @@ -31,6 +31,7 @@ * struct timer *t; * struct timed_string *s; * + * (void)argc; * timers_init(&timers, time_mono()); * list_head_init(&strings); * diff --git a/ccan/timer/timer.c b/ccan/timer/timer.c index c55e23dd..91f46393 100644 --- a/ccan/timer/timer.c +++ b/ccan/timer/timer.c @@ -114,7 +114,7 @@ void timer_addmono(struct timers *timers, struct timer *t, struct timemono when) } /* FIXME: inline */ -void timer_del(struct timers *timers, struct timer *t) +void timer_del(struct timers *timers UNNEEDED, struct timer *t) { list_del_init(&t->list); } diff --git a/ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c b/ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c index b071b541..746facae 100644 --- a/ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c +++ b/ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c @@ -3,6 +3,7 @@ static void _set_some_value(void *val) { + (void)val; } #define set_some_value(expr) \ diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c index 006dd5e2..c9d47c50 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c @@ -15,6 +15,7 @@ void _callback(void (*fn)(void *arg), void *arg) void my_callback(int something); void my_callback(int something) { + (void)something; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c index 5d569373..5717f97b 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c @@ -3,6 +3,8 @@ static void _register_callback(void (*cb)(void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ @@ -10,6 +12,7 @@ static void _register_callback(void (*cb)(void *arg), void *arg) static void my_callback(char *p) { + (void)p; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c index aace84ee..d85886c9 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c @@ -23,6 +23,7 @@ struct other { static void take_any(struct any *any) { + (void)any; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c index 1b10e22e..7fa596cf 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c @@ -4,6 +4,7 @@ void _set_some_value(void *val); void _set_some_value(void *val) { + (void)val; } #define set_some_value(expr) \ diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c index f2de7a90..2100368f 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c @@ -3,12 +3,16 @@ static void _register_callback(void (*cb)(void *arg, int x), void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ _register_callback(typesafe_cb_postargs(void, void *, (cb), (arg), int), (arg)) static void my_callback(char *p, int x) { + (void)p; + (void)x; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c index bbdc4248..d359a77f 100644 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c +++ b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c @@ -3,6 +3,8 @@ static void _register_callback(void (*cb)(int x, void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ @@ -10,6 +12,8 @@ static void _register_callback(void (*cb)(int x, void *arg), void *arg) static void my_callback(int x, char *p) { + (void)p; + (void)x; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c index ac6a0e8f..738ec96b 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c @@ -5,6 +5,8 @@ static void _register_callback(void (*cb)(const void *arg), const void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-undefined.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-undefined.c index 33b8a69a..bb71042c 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-undefined.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-undefined.c @@ -5,6 +5,8 @@ static void _register_callback(void (*cb)(void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ @@ -12,6 +14,8 @@ static void _register_callback(void (*cb)(void *arg), void *arg) static void _register_callback_pre(void (*cb)(int x, void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback_pre(cb, arg) \ @@ -19,6 +23,8 @@ static void _register_callback_pre(void (*cb)(int x, void *arg), void *arg) static void _register_callback_post(void (*cb)(void *arg, int x), void *arg) { + (void)cb; + (void)arg; } #define register_callback_post(cb, arg) \ @@ -28,14 +34,19 @@ struct undefined; static void my_callback(struct undefined *undef) { + (void)undef; } static void my_callback_pre(int x, struct undefined *undef) { + (void)x; + (void)undef; } static void my_callback_post(struct undefined *undef, int x) { + (void)undef; + (void)x; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c index 9537a3ea..1cb1057d 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c @@ -5,6 +5,8 @@ static void _register_callback(void (*cb)(void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback(cb, arg) \ @@ -12,6 +14,8 @@ static void _register_callback(void (*cb)(void *arg), void *arg) static void _register_callback_pre(void (*cb)(int x, void *arg), void *arg) { + (void)cb; + (void)arg; } #define register_callback_pre(cb, arg) \ @@ -19,6 +23,8 @@ static void _register_callback_pre(void (*cb)(int x, void *arg), void *arg) static void _register_callback_post(void (*cb)(void *arg, int x), void *arg) { + (void)cb; + (void)arg; } #define register_callback_post(cb, arg) \ @@ -28,14 +34,19 @@ struct undefined; static void my_callback(struct undefined *undef) { + (void)undef; } static void my_callback_pre(int x, struct undefined *undef) { + (void)x; + (void)undef; } static void my_callback_post(struct undefined *undef, int x) { + (void)x; + (void)undef; } int main(void) diff --git a/ccan/typesafe_cb/test/compile_ok-typesafe_cb_cast.c b/ccan/typesafe_cb/test/compile_ok-typesafe_cb_cast.c index 473abf5e..bd7b7d65 100644 --- a/ccan/typesafe_cb/test/compile_ok-typesafe_cb_cast.c +++ b/ccan/typesafe_cb/test/compile_ok-typesafe_cb_cast.c @@ -19,6 +19,7 @@ struct any { static void take_any(struct any *any) { + (void)any; } int main(void)