This makes us closer to compiling cleanly with -Wunused (as used by -Wextra). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@@ -21,7 +21,7 @@
*
* // Output contains "ALIGNOF(char) == 1"
* // Will also print out whether an onstack char array can hold a long.
- * int main(int argc, char *argv[])
+ * int main(void)
* {
* char arr[sizeof(int)];
@@ -24,7 +24,7 @@ struct lots_of_types
char c5;
};
-int main(int argc, char *argv[])
+int main(void)
{
struct lots_of_types lots_of_types, *lp = malloc(sizeof(*lp));
char c;
@@ -18,7 +18,7 @@ int check_parameter(const struct foo *array)
#endif
}
return check_parameter(NULL);
@@ -16,7 +16,7 @@ static int array2_size = ARRAY_SIZE(array2);
static int array3_size = ARRAY_SIZE(array3);
static int array4_size = ARRAY_SIZE(array4);
plan_tests(8);
ok1(array1_size == 1);
@@ -1,6 +1,6 @@
#include <ccan/build_assert/build_assert.h>
#ifdef FAIL
return BUILD_ASSERT_OR_ZERO(1 == 0);
BUILD_ASSERT(1 == 0);
BUILD_ASSERT(1 == 1);
return 0;
@@ -1,7 +1,7 @@
#include <ccan/tap/tap.h>
plan_tests(1);
ok1(BUILD_ASSERT_OR_ZERO(1 == 1) == 0);
@@ -6,7 +6,7 @@ struct char_struct {
char *uc;
const
char **uc;
char ***uc;
#include <ccan/cast/cast.h>
#include <stdlib.h>
unsigned char *uc;
char *c;
long c;
@@ -6,7 +6,7 @@ struct foo {
char b;
struct foo foo = { .a = 1, .b = 2 };
int *intp = &foo.a;
struct foo foo = { .a = 1, .b = 2 }, *foop;
@@ -3,7 +3,7 @@
#include <stddef.h>
union {
uint64_t u64;
@@ -17,7 +17,7 @@ static bool cmp(const void *candidate, void *ptr)
return *(const uint64_t *)candidate == *(const uint64_t *)ptr;
struct htable ht, ht2;
uint64_t val[NUM_VALS], i;
@@ -14,7 +14,7 @@ static size_t hash(const void *elem, void *unused)
return h;
struct htable ht;
uint64_t val[NUM_VALS];
@@ -112,7 +112,7 @@ static bool check_mask(struct htable *ht, const struct obj val[], unsigned num)
return true;
unsigned int i;
struct htable_obj ht, ht2;
@@ -107,7 +107,7 @@ static bool check_mask(struct htable *ht, const struct obj val[], unsigned num)
@@ -95,7 +95,7 @@ static bool check_mask(struct htable *ht, uint64_t val[], unsigned num)
unsigned int i, weight;
uintptr_t perfect_bit;
@@ -19,7 +19,7 @@ static int test_ilog64(uint64_t _v){
#define NTRIALS (64)
-int main(int _argc,const char *_argv[]){
+int main(void){
int i;
int j;
int (*il32)(uint32_t) = ilog32;
/*This is how many tests you plan to run.*/
@@ -134,7 +134,7 @@ static const uint32_t STATEVEC[ISAAC_SZ<<1]={
0x46D95CA5, 0xC54CD95B, 0x9D855E89, 0x4BB5AF29
isaac_ctx isaac;
@@ -262,7 +262,7 @@ static const uint64_t STATEVEC64[ISAAC64_SZ<<1]={
0x1877B51E57A764D5ULL, 0x001F837CC7350524ULL
isaac64_ctx isaac64;
@@ -26,7 +26,7 @@ static bool likely_one_unlikely_two(unsigned int val1, unsigned int val2)
return false;
char *bad;
@@ -17,7 +17,7 @@ static bool one_seems_unlikely(unsigned int val)
plan_tests(4);
@@ -28,7 +28,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
#include <ccan/list/list.c>
struct list_head list;
struct list_node n1;
@@ -26,7 +26,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
@@ -8,7 +8,7 @@ struct child {
struct list_node list;
struct child c1, c2;
struct list_head list = LIST_HEAD_INIT(list);
@@ -7,7 +7,7 @@
#include <unistd.h>
#include <signal.h>
struct list_head list1, list2;
struct list_node n1, n2, n3;
@@ -14,7 +14,7 @@ struct child {
struct parent parent;
struct child c1, c2, c3;
@@ -17,7 +17,7 @@ static bool list_expect(struct list_head *h, ...)
return (n->next == &h->n);
struct list_head h1, h2;
struct list_node n[4];
@@ -19,7 +19,7 @@ static LIST_HEAD(static_list);
#define ref(obj, counter) ((counter)++, (obj))
struct child c1, c2, c3, *c, *n;
@@ -16,7 +16,7 @@ struct child {
static LIST_HEAD(static_list);
struct child c1, c2, c3, x1, *c, *n;
#include <stdio.h>
#include <assert.h>
const char *name = "noerr.file";
int fd;
@@ -4,7 +4,7 @@
#include <ccan/opt/parse.c>
#include <ccan/opt/usage.c>
opt_register_noarg("-v", opt_version_and_exit,
(const char *)"1.2.3",
@@ -16,7 +16,7 @@ static void show_max(char buf[OPT_SHOW_LEN], const void *arg)
/* Test add_desc helper. */
struct opt_table opt;
char *ret;
@@ -53,7 +53,7 @@ static void reset(void)
opt_count = opt_num_short = opt_num_short_arg = opt_num_long = 0;
int exitval;
@@ -5,7 +5,7 @@
/* Test consume_words helper. */
size_t prefix, len;
bool start = true;
@@ -10,7 +10,7 @@
/* Test iterators. */
unsigned j, i, len = 0;
const char *p;
@@ -12,7 +12,7 @@ typedef int item_t;
typedef struct item item_t;
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp,
@@ -12,7 +12,7 @@ typedef int ctx_t;
typedef struct cmp_info ctx_t;
_total_order_cb cb1 = total_order_cast(fancy_cmp, struct item,
@@ -6,7 +6,7 @@
#include "fancy_cmp.h"
@@ -8,7 +8,7 @@
struct item item1 = {
.value = 0,
@@ -29,7 +29,7 @@
* void (*cb)(void *opaque) = callback;
* int val = 17;
@@ -17,7 +17,7 @@
* #include <ccan/read_write_all/read_write_all.h>
* #define BUFFER_SIZE 10
* char buffer[BUFFER_SIZE+1];
@@ -24,7 +24,7 @@ static void got_signal(int sig)
/* < PIPE_BUF *will* be atomic. But > PIPE_BUF only *might* be non-atomic. */
#define BUFSZ (1024*1024)
char *buffer;
char c = 0;
@@ -39,7 +39,7 @@ static ssize_t test_write(int fd, const void *buf, size_t count)
#define BUFSZ 1024
@@ -4,7 +4,7 @@ struct s {
int val;
struct s
#define CCAN_STR_DEBUG 1
#include <ccan/str/str.h>
#if !HAVE_TYPEOF
#include <stdint.h>
char str[1000];
struct {
@@ -21,7 +21,7 @@ static char *strdup_rev(const char *s)
return ret;
unsigned int i, j, n;
char *strings[NUM_SUBSTRINGS * NUM_SUBSTRINGS];
#include <ccan/tal/str/str.h>
int
-main(int argc, char *argv[])
+main(void)
char **split, *str;
@@ -9,7 +9,7 @@ static void destroy_obj(void *obj)
destroy_count++;
char *linkable, *p1, *p2, *p3;
void **voidpp;
@@ -38,7 +38,7 @@
* return retval;
* }
* tal_t *tmp_ctx = tal_newframe();
* int *val = do_work();
#include "helper.h"
/* Empty format string: should still terminate! */
char *str;
const char *fmt = "";
char *str, *copy;
@@ -14,7 +14,7 @@ static bool find_parent(tal_t *child, tal_t *parent)
void *ctx = tal_strdup(NULL, "toplevel");
char *a, *b;
static const char *substrings[]
= { "far", "bar", "baz", "b", "ba", "z", "ar", NULL };
void *ctx;
@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(concan, struct outer, inner));
struct info_tcon info;
struct outer ovar;
@@ -17,7 +17,7 @@ struct info_base {
char *infop;
TCON_WRAP(struct info_base,
TCON_CONTAINER(concan, struct outer, inner)) info;
@@ -10,7 +10,7 @@ struct int_and_charp_container {
TCON(int *tc1; char *tc2);
struct int_and_charp_container icon;
@@ -5,7 +5,7 @@ struct container {
void *p;
TCON_WRAP(struct container,
int *tc1; char *tc2) icon;
TCON_WRAP(struct container, int *canary) icon;
@@ -10,7 +10,7 @@ struct int_container {
TCON(int *canary);
struct int_container icon;
TCON(TCON_CONTAINER(fi, struct outer, inner));
/* Const should work! */
const struct outer *ovar = NULL;
@@ -16,7 +16,7 @@ struct charp_and_int_container {
TCON(int tc1; char *tc2);
struct charp_and_int_container cicon;
@@ -26,7 +26,7 @@ struct offs_container {
TCON_VALUE(off2, offsetof(struct other_struct, x2)));
struct val_container valcon;
struct offs_container offscon;
@@ -28,7 +28,7 @@ struct info_tcon {
TCON_CONTAINER(fi2, struct outer0, inner));
typedef TCON_WRAP(int, char *canary) canaried_int;
canaried_int ci = TCON_WRAP_INIT(0);
@@ -23,7 +23,7 @@ static void update_and_expire(struct timers *timers)
free(timers_expire(timers, when));
struct timemono when;
struct timers timers;
/* This is the original pre-cut-down dump. */
@@ -8,7 +8,7 @@ static void _set_some_value(void *val)
#define set_some_value(expr) \
_set_some_value(typesafe_cb_cast(void *, long, (expr)))
bool x = 0;
@@ -17,7 +17,7 @@ void my_callback(int something)
/* This fails due to arg, not due to cast. */
@@ -12,7 +12,7 @@ static void my_callback(char *p)
char str[] = "hello world";
@@ -25,7 +25,7 @@ static void take_any(struct any *any)
struct other
@@ -9,7 +9,7 @@ void _set_some_value(void *val)
_set_some_value(typesafe_cb_cast(void *, unsigned long, (expr)))
int x = 0;
@@ -11,7 +11,7 @@ static void my_callback(char *p, int x)
int *p;
@@ -12,7 +12,7 @@ static void my_callback(int x, char *p)
@@ -10,7 +10,7 @@ static void _register_callback(void (*cb)(const void *arg), const void *arg)
#define register_callback(cb, arg) \
_register_callback(typesafe_cb(void, const void *, (cb), (arg)), (arg))
register_callback(NULL, "hello world");
@@ -38,7 +38,7 @@ static void my_callback_post(struct undefined *undef, int x)
struct undefined *handle = NULL;
void (*cb)(struct undefined *undef) = my_callback;
@@ -21,7 +21,7 @@ static void take_any(struct any *any)
/* Otherwise we get unused warnings for these. */
struct foo *foo = NULL;
@@ -89,7 +89,7 @@ struct callback_postargs cb_postargs
= { typesafe_cb_postargs(void, void *, my_callback_postargs,
(char *)(intptr_t)"hi", int, int), "hi" };
void *p = &dummy;
unsigned long l = (unsigned long)p;