]> git.ozlabs.org Git - ccan/commitdiff
Mark unused arguments in many modules.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 6 Nov 2016 04:34:17 +0000 (15:04 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 6 Nov 2016 05:16:27 +0000 (15:46 +1030)
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 <rusty@rustcorp.com.au>
73 files changed:
ccan/array_size/test/compile_fail.c
ccan/asort/test/compile_fail-context-type.c
ccan/autodata/autodata.c
ccan/cast/test/compile_ok-static.c
ccan/check_type/test/compile_fail-check_type.c
ccan/check_type/test/compile_fail-check_type_unsigned.c
ccan/check_type/test/compile_fail-check_types_match.c
ccan/check_type/test/run.c
ccan/compiler/_info
ccan/compiler/test/compile_fail-printf.c
ccan/compiler/test/run-is_compile_constant.c
ccan/crypto/siphash24/siphash24.c
ccan/err/test/run.c
ccan/htable/_info
ccan/htable/htable.h
ccan/htable/test/run-copy.c
ccan/htable/test/run-size.c
ccan/htable/test/run-type-int.c
ccan/htable/test/run-zero-hash-first-entry.c
ccan/htable/test/run.c
ccan/list/test/run-CCAN_LIST_DEBUG.c
ccan/list/test/run-check-corrupt.c
ccan/mem/mem.h
ccan/opt/opt.h
ccan/opt/test/run-add_desc.c
ccan/opt/test/run-helpers.c
ccan/opt/test/run-set_alloc.c
ccan/opt/test/run-usage.c
ccan/opt/test/utils.c
ccan/order/order.c
ccan/read_write_all/test/run-read_all.c
ccan/read_write_all/test/run-write_all.c
ccan/str/test/compile_fail-isalnum.c
ccan/str/test/compile_fail-isalpha.c
ccan/str/test/compile_fail-isascii.c
ccan/str/test/compile_fail-isblank.c
ccan/str/test/compile_fail-iscntrl.c
ccan/str/test/compile_fail-isdigit.c
ccan/str/test/compile_fail-islower.c
ccan/str/test/compile_fail-isprint.c
ccan/str/test/compile_fail-ispunct.c
ccan/str/test/compile_fail-isspace.c
ccan/str/test/compile_fail-isupper.c
ccan/str/test/compile_fail-isxdigit.c
ccan/strmap/_info
ccan/strmap/test/run-iterate-const.c
ccan/strmap/test/run-prefix.c
ccan/take/test/run.c
ccan/tal/link/link.c
ccan/tal/link/test/run.c
ccan/tal/str/str.h
ccan/tal/tal.c
ccan/tal/test/run-allocfail.c
ccan/tal/test/run-destructor.c
ccan/tal/test/run-free.c
ccan/tal/test/run-notifier.c
ccan/tal/test/run-overflow.c
ccan/tal/test/run-test-backend.c
ccan/tcon/test/compile_ok-void.c
ccan/tcon/test/compile_ok.c
ccan/timer/_info
ccan/timer/timer.c
ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c
ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c
ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c
ccan/typesafe_cb/test/compile_ok-typesafe_cb-undefined.c
ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c
ccan/typesafe_cb/test/compile_ok-typesafe_cb_cast.c

index 37d315f2198c59c083cdc81c3c1e057538a123bd..9bd656826dc72d38eaeaff82f5887737df30b2bb 100644 (file)
@@ -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);
index 473d10264140e04710be1a98f02e353a726a9d77..aa2340f4e22b8bf8c8e133f854889c8ef1dffc5b 100644 (file)
@@ -1,7 +1,7 @@
 #include <ccan/asort/asort.h>
 #include <ccan/asort/asort.c>
 
-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;
 }
index d8ea88feae962e28fb4735bbc823824052f8c197..e8086e3abceaa661ecbcf67cb6353d75f8249b32 100644 (file)
@@ -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
index 98b667e83440f36020856fdcb89a00c171a29549..a7c65725ba0924553d586a2eac5f990c1aa78b9d 100644 (file)
@@ -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];
 }
index fe7d6a235c33011040bfe9648e98916c69418ce4..4c22c65a499c5df7252444549fb3efe56d70a51b 100644 (file)
@@ -2,6 +2,8 @@
 
 int main(int argc, char *argv[])
 {
+       (void)argc;
+       (void)argv;
 #ifdef FAIL
        check_type(argc, char);
 #endif
index 574d4aeb2402cf3f5ac6d0e7c3a1fe11a3e3de79..795e7606701955440ebd81e816946f36abecbcc8 100644 (file)
@@ -2,6 +2,8 @@
 
 int main(int argc, char *argv[])
 {
+       (void)argc;
+       (void)argv;
 #ifdef FAIL
 #if HAVE_TYPEOF
        check_type(argc, unsigned int);
index cbd6e9bc5b45fd79739b8bdebd9b3a68c5b3dca3..fb83738b90aba585aedb6c749709b93054c7b9a1 100644 (file)
@@ -3,6 +3,7 @@
 int main(int argc, char *argv[])
 {
        unsigned char x = argc;
+       (void)argv;
 #ifdef FAIL
        check_types_match(argc, x);
 #endif
index 83b903c0b1b33314b3cefae512299de9f59986bb..09fd3634376fc078d3d62df5b465e54f0a2db4cd 100644 (file)
@@ -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);
index d60dff4d17bb0a50b691bb83097debdc94f38cf5..12cb24757829b55d339ed6f9e540834d84eac9d3 100644 (file)
@@ -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);
index 8f34ae5a1255b25f89aa0ae3424c9c47ef750cee..7664f65d4803a6426781e84493476ce72773c049 100644 (file)
@@ -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;
 
index a66f2e13e6c9c3749ae9357cb800517377d5863c..c914c68300868e79ee3c0b2862487740e76d6a1d 100644 (file)
@@ -3,6 +3,8 @@
 
 int main(int argc, char *argv[])
 {
+       (void)argc;
+       (void)argv;
        plan_tests(2);
 
        ok1(!IS_COMPILE_CONSTANT(argc));
index d250de3295418f6f5e127167d0fad0421d13bc87..20daa74d32b71fd8c296295a8ed9fba69d4c7d5e 100644 (file)
@@ -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);
index c103f7cda6e0039092a5b19e14b2a6adb2008b11..aeaa3750b3d40ac7cc0223f24e4ae7fb4b0da42a 100644 (file)
@@ -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]);
index 7e06c3867a3f977797720e54368f25cb3084d6c6..a55343b465282db60d7592c965f7b8186632ebfd 100644 (file)
@@ -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);
  *     }
  *
index 61ed9170fda461779840f63db55295757a9bce8a..9845388e1b9f47b7938e765a4682c7b4aee689fe 100644 (file)
@@ -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);
index 2bc1778614e1146fb4e96e0ac188c47d5ef9c10f..d111495ad4c775c20a6875e141aef19c12f942da 100644 (file)
@@ -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;
index 5b3263895ca83ad28bcb3312122c4bb3c056be41..1a2f5cdd1ef8cbbfc1ab84f8221b5bb61b9734ab 100644 (file)
@@ -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;
index 061ae76f07f356bc1a619e5335d48cd4f995dac7..7b71815f3c38fef390a63ad4e420040939338c0e 100644 (file)
@@ -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;
 
index fdd18569e7cc516f2d5b7fb5bbc25a7d0a35bacf..3a1a939e8ab390b921c02a3a1607ca98a6c38389 100644 (file)
@@ -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;
 
index 98f208717c74ec284df105dfa3797afba4ab6065..46514c7202f2438b54b15aca2f9c0800ca5f5dd4 100644 (file)
@@ -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;
index 9ff4107880d0aad772fb68d277800f050fe5f1b3..b8e5165a6441c841ef77d85798ef5547d49ef65b 100644 (file)
@@ -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));
index c6873c7a969b226d0ef918b287b583cde4110729..94c2e67e7bed36ddf3f19f511de8327c296ac1fa 100644 (file)
@@ -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);
index f2c3d5c7a6f795e2e091df8a545992c6533b50ec..19f69c038c67efe1e11ac8ab5cec036123aa3b95 100644 (file)
@@ -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
index 690907e595eff6922690204eb4c76a6be3e59d8c..0d508cf6fd173d1578bf26d1a703c3b12bbf3643 100644 (file)
@@ -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);
  * }
index 03fe37eb61f6e810bc4926a25ba9ddcad3f146d0..b559c7f747689bae70d34589ee9794f4cf710ac0 100644 (file)
@@ -4,13 +4,13 @@
 #include <ccan/opt/helpers.c>
 #include <ccan/opt/parse.c>
 
-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);
 }
index 6ec17f589fdb76d8c1fc7f0f78d39619d18c6294..0a08a85f7aa3930011cba5600186f3a21d5c5f09 100644 (file)
@@ -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;
index 6a10d5979fca77d9e024fca95e962108ad66dbe4..1dbb351bedf41b0022a8abd26b3c0fbbc07ad445 100644 (file)
@@ -2,15 +2,15 @@
 #include <stdlib.h>
 
 /* 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();
 }
index aec8324474f2b2a547574d870968c92b476e3e3e..cea678f3806ded21d7636bf3f3380ebe67e3ca02 100644 (file)
@@ -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 <ccan/opt/helpers.c>
 #include <ccan/opt/parse.c>
 
-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");
index c2967fca173d51010b810fcaa626eb6ebff420df..a9bedf2e0063333060a597a3bd591ff76744ab00 100644 (file)
@@ -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;
index 863a8e16e1425803621ee0bc68e37ee376693f20..5ff85a987fec66fd5c55aa89d3a18ba5bcd9020c 100644 (file)
@@ -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,                       \
index 0cdce1872b4752e26de2d1e65afb36e0f7108b12..6e6588d4149a79351f04993bbc37470ab8d36626 100644 (file)
@@ -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++;
 }
index 36e4119e8ea472eceb54a1dd34732608dc592e4a..c789d6b7829b3b05243ce7ae9d6bd679cfc8735f 100644 (file)
@@ -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;
index 930defffa0c231862679e42ddb851655cf5a93a1..5d9895822ccd96442a7b1391d87d558856f13cca 100644 (file)
@@ -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.
index 2005109829be36e1ea558e287b770d9fbb1cc663..33d365538aff0a28c6f5b7f36119363ab6d7ae71 100644 (file)
@@ -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.
index ee55e4997434c5cd4c11c01a0bd45d28af67d37d..3946e0b3b88a288606903756c53eaaf6d267d0e8 100644 (file)
@@ -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.
index f4cb961d740d9dd0bc9b99825a3af51d3d50d848..e14b0d7e66ac1a8e0018233c709b7274e182a468 100644 (file)
@@ -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.
index bc74146542f1b36ecefe1fb394bfb84254d4b571..f9abf1dc56e4d4464dd417b2c2586769a22ccf15 100644 (file)
@@ -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.
index 71d1c714330f2cf9f363e46a3161a4e0f5c9e93c..a3ee439c631eb867a876c955169cb4be2119c03f 100644 (file)
@@ -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.
index ca3f9907e52087eefb75d6f40831f11c50b12e8e..8f5c456197ff33cb2e4fdeef9704702b2aefa43c 100644 (file)
@@ -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.
index 6432e41d2b7db9db5ddc0ecd35611fcc169e49d3..85ed028f60f1e99a4da8983e3f3df4800e5e88ad 100644 (file)
@@ -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.
index 5d941fcba687a23863780acc6076479ba05bfcd8..09d4279a9344d4770d93eb9b689ea2639c344ab1 100644 (file)
@@ -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.
index bfee1f89f166614b603b9aec5c2315ad430a3af0..798cfcd470f82db076a0b37ff79375baad194344 100644 (file)
@@ -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.
index 4cf9fd35785c37e40e1ea16529845886896381f8..56f5dee11b9512268bdc782d85069b8f10331fcd 100644 (file)
@@ -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.
index 65e6006a885b029ae7cec620a44aebd652567e22..ea4d5269add225115a436092fc8184e3a45151a0 100644 (file)
@@ -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.
index c128cc27b5c3cbe941cd5e72a4bef2ae2c043f91..b8768698bf87a40de3a9bbc7163488206a02b281 100644 (file)
  *     license_depends_compat FAIL
  *
  * Example:
+ * #include <ccan/compiler/compiler.h>
  * #include <ccan/strmap/strmap.h>
  * #include <stdio.h>
  *
- * 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.
index 63bea95236af32ba1372c460151243bf3f5d7d66..dfd9dca73847db6e100dc2716d80b9b5b191469e 100644 (file)
@@ -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;
index d88eb55655c2bfe3737ca3fc510f8d3b43658bc9..6232d71b26135106016d22a01f84feee45c988ca 100644 (file)
@@ -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!");
index 0c8ca2a1d6ae5207e76fabb249f2737327c5595b..ba170fb3aad71261f59bc7cd71a7b6feb65b69b6 100644 (file)
@@ -15,7 +15,7 @@ static void *my_realloc(void *p, size_t len)
 #include <ccan/tap/tap.h>
 
 static int my_allocfail_called;
-static void my_allocfail(const void *p)
+static void my_allocfail(const void *p UNNEEDED)
 {
        my_allocfail_called++;
 }      
index c25d97e581c9ab7b2a5580835a682532a1401f24..7c8892d2b59fc882167d3b0b8a0a5a80f7d0c5c2 100644 (file)
@@ -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);
index 8533f76a8358c63c9a1481dba3091b20d6fe93c0..e031fef2806d1d92faff4891b3b765b69880a3fc 100644 (file)
@@ -4,7 +4,7 @@
 #include <err.h>
 
 static unsigned int destroy_count = 0;
-static void destroy_obj(void *obj)
+static void destroy_obj(void *obj UNNEEDED)
 {
        destroy_count++;
 }
index 0c1821331e6a733b7a43fe3491e19b9065947eb8..5147ca2d4667fc7cc6997c34c9e6fdc5fc113c85 100644 (file)
@@ -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,
index 79476772c585564b7e0840f215b59d09844723f1..842059d031b76977d665b31f1aedd3259a86ff0f 100644 (file)
@@ -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) {
index a166be3f6520a8795ea2c7bd916f0bfdf2a9cada..97cba9f6848d37d54594f666292bb82f21dbbce3 100644 (file)
@@ -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)
 {
 }
 
index 873548889e91472013c3901b92bae8f01ae4e25c..7183f7c5b5a3daaff2e543d35e9f25c6d33366a2 100644 (file)
@@ -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++;
 }
index 29aa8c6f49dacf462300f41eda207b414c29ea95..f21264748d40a056a7e1ae5ed1d0976190d86e5a 100644 (file)
@@ -2,7 +2,7 @@
 #include <ccan/tal/tal.c>
 #include <ccan/tap/tap.h>
 
-static void destroy_errno(char *p)
+static void destroy_errno(char *p UNNEEDED)
 {
        errno = ENOENT;
 }
index b57c902e80ba9c3b7ec6a9ea285b4c0be0b40419..3820444f86f8245c38ffb9817f8d6cb38de506d1 100644 (file)
@@ -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++;
 }
index d975398b4ba39b9e55ef35a57b18537aa514bbc8..d1919c1cceefcc65702fd5bf65a2ef015c30f7d7 100644 (file)
@@ -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++;
 }
index 8fdfc064abb7eca68d06a18d0f4b00f7b9927df3..ebcd811192cfc9e2c39f09e9aff914ce25767ed0 100644 (file)
@@ -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)
 {
 }
 
index 694a53b533d87db6478dda4557d77c2b206e1ad6..442ca6599938b2877b5615fc0bf036b26c2e1c6f 100644 (file)
@@ -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;
index f3fe2c6f8a1a09b4f7d3b2b9f6aee5f285e1d56f..6ba5f4c1458a793879e9a76cffa2448235f06bae 100644 (file)
@@ -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];
index c3a01e301e8328cb985042ede9e758ba430672ed..9f5ec7a22809efa6de4d3806820f1b1ed78b2485 100644 (file)
@@ -31,6 +31,7 @@
  *             struct timer *t;
  *             struct timed_string *s;
  *
+ *             (void)argc;
  *             timers_init(&timers, time_mono());
  *             list_head_init(&strings);
  *
index c55e23dd21cf287d64b6d1ce6482b7cf0d33df9d..91f46393958acef5b6e9dc10968f14344b35ab5d 100644 (file)
@@ -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);
 }
index b071b54107655c01e437cf3301e534722c653a36..746facaef3ed102989afcc9c7f0a71df063e6fc3 100644 (file)
@@ -3,6 +3,7 @@
 
 static void _set_some_value(void *val)
 {
+       (void)val;
 }
 
 #define set_some_value(expr)                                           \
index 006dd5e2d5ebecbf8c18f1c797b19fb3e29de62f..c9d47c50b17f38f4f534057a7091c677cc4cf2dd 100644 (file)
@@ -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)
index 5d569373bb1ef13ec4f68b4bc4bb7b846a46ca2c..5717f97be64cc0d5676f06f5dc2930b7d7a518ac 100644 (file)
@@ -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)
index aace84ee8b1f70e21cf7f5aeeed40f825e8d9862..d85886c929f470ebad95f3400391424dc112c70c 100644 (file)
@@ -23,6 +23,7 @@ struct other {
 
 static void take_any(struct any *any)
 {
+       (void)any;
 }
 
 int main(void)
index 1b10e22e721f37689859f1277717a9bea41da78f..7fa596cf23b489fd184a9cbb18d3091648114c8e 100644 (file)
@@ -4,6 +4,7 @@ void _set_some_value(void *val);
 
 void _set_some_value(void *val)
 {
+       (void)val;
 }
 
 #define set_some_value(expr)                                           \
index f2de7a90d3891b4ae93c065e4455689ea1de7c63..2100368f03292e41e94c5624d366f8de91b93e16 100644 (file)
@@ -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)
index bbdc424837fa523b9a12f4d2a27c6d2c810a7430..d359a77f5b859b5f0c29c04fb994f02e0f628f37 100644 (file)
@@ -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)
index ac6a0e8ffbc6cc617d5e5ed470c4b7afe66d6b32..738ec96b277f7707e6de95abcebb0cbd3b9004d7 100644 (file)
@@ -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)                             \
index 33b8a69a74910fdc32ff231174b48fd479ca8248..bb71042c3b14914c41a0bbe4ea648fd159812c2c 100644 (file)
@@ -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)
index 9537a3ea519b7e50cedce554aed32673953f7920..1cb1057d823c954b25e9206bdc7b28781e293d3e 100644 (file)
@@ -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)
index 473abf5e3f3d56bcfa7669583a9a40823eea5bdc..bd7b7d6532bffce5da05f1fbc31b055928691376 100644 (file)
@@ -19,6 +19,7 @@ struct any {
 
 static void take_any(struct any *any)
 {
+       (void)any;
 }
 
 int main(void)