Commit e7e57cbf authored by Rusty Russell's avatar Rusty Russell

Remove unused main() args in many modules.

This makes us closer to compiling cleanly with -Wunused (as used by -Wextra).
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent c3a3b745
......@@ -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
}
int main(int argc, char *argv[])
int main(void)
{
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);
int main(int argc, char *argv[])
int main(void)
{
plan_tests(8);
ok1(array1_size == 1);
......
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
return BUILD_ASSERT_OR_ZERO(1 == 0);
......
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
BUILD_ASSERT(1 == 0);
......
#include <ccan/build_assert/build_assert.h>
int main(int argc, char *argv[])
int main(void)
{
BUILD_ASSERT(1 == 1);
return 0;
......
#include <ccan/build_assert/build_assert.h>
#include <ccan/tap/tap.h>
int main(int argc, char *argv[])
int main(void)
{
plan_tests(1);
ok1(BUILD_ASSERT_OR_ZERO(1 == 1) == 0);
......
......@@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char *uc;
const
......
......@@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char **uc;
const
......
......@@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
char ***uc;
const
......
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL
......
......@@ -6,7 +6,7 @@ struct char_struct {
char c;
};
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL
......
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
unsigned char *uc;
#ifdef FAIL
......
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
char *c;
#ifdef FAIL
......
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
char *c;
#ifdef FAIL
......
#include <ccan/cast/cast.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int main(void)
{
long c;
#ifdef FAIL
......
......@@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 };
int *intp = &foo.a;
......
......@@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 }, *foop;
int *intp = &foo.a;
......
......@@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 }, *foop;
int *intp = &foo.a;
......
......@@ -6,7 +6,7 @@ struct foo {
char b;
};
int main(int argc, char *argv[])
int main(void)
{
struct foo foo = { .a = 1, .b = 2 };
int *intp = &foo.a;
......
......@@ -3,7 +3,7 @@
#include <stddef.h>
#include <ccan/tap/tap.h>
int main(int argc, char *argv[])
int main(void)
{
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;
}
int main(int argc, char *argv[])
int main(void)
{
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;
}
int main(int argc, char *argv[])
int main(void)
{
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;
}
int main(int argc, char *argv[])
int main(void)
{
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)
return true;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i;
struct htable_obj ht, ht2;
......
......@@ -95,7 +95,7 @@ static bool check_mask(struct htable *ht, uint64_t val[], unsigned num)
return true;
}
int main(int argc, char *argv[])
int main(void)
{
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;
......
......@@ -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;
/*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
};
int main(int _argc,const char *_argv[]){
int main(void){
isaac_ctx isaac;
int i;
int j;
......
......@@ -262,7 +262,7 @@ static const uint64_t STATEVEC64[ISAAC64_SZ<<1]={
0x1877B51E57A764D5ULL, 0x001F837CC7350524ULL
};
int main(int _argc,const char *_argv[]){
int main(void){
isaac64_ctx isaac64;
int i;
int j;
......
......@@ -26,7 +26,7 @@ static bool likely_one_unlikely_two(unsigned int val1, unsigned int val2)
return false;
}
int main(int argc, char *argv[])
int main(void)
{
char *bad;
......
......@@ -17,7 +17,7 @@ static bool one_seems_unlikely(unsigned int val)
return false;
}
int main(int argc, char *argv[])
int main(void)
{
plan_tests(4);
......
......@@ -28,7 +28,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
#include <ccan/tap/tap.h>
#include <ccan/list/list.c>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list;
struct list_node n1;
......
......@@ -26,7 +26,7 @@ static int my_fprintf(FILE *stream, const char *format, ...)
#include <ccan/tap/tap.h>
#include <ccan/list/list.c>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list;
struct list_node n1;
......
......@@ -8,7 +8,7 @@ struct child {
struct list_node list;
};
int main(int argc, char *argv[])
int main(void)
{
struct child c1, c2;
struct list_head list = LIST_HEAD_INIT(list);
......
......@@ -7,7 +7,7 @@
#include <unistd.h>
#include <signal.h>
int main(int argc, char *argv[])
int main(void)
{
struct list_head list1, list2;
struct list_node n1, n2, n3;
......
......@@ -14,7 +14,7 @@ struct child {
struct list_node list;
};
int main(int argc, char *argv[])
int main(void)
{
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);
}
int main(int argc, char *argv[])
int main(void)
{
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))
int main(int argc, char *argv[])
int main(void)
{
struct parent parent;
struct child c1, c2, c3, *c, *n;
......
......@@ -16,7 +16,7 @@ struct child {
static LIST_HEAD(static_list);
int main(int argc, char *argv[])
int main(void)
{
struct parent parent;
struct child c1, c2, c3, x1, *c, *n;
......
......@@ -7,7 +7,7 @@
#include <stdio.h>
#include <assert.h>
int main(int argc, char *argv[])
int main(void)
{
const char *name = "noerr.file";
int fd;
......
......@@ -4,7 +4,7 @@
#include <ccan/opt/parse.c>
#include <ccan/opt/usage.c>
int main(int argc, char *argv[])
int main(void)
{
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. */
int main(int argc, char *argv[])
int main(void)
{
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 main(int argc, char *argv[])
int main(void)
{
int exitval;
......
......@@ -5,7 +5,7 @@
#include <ccan/opt/parse.c>
/* Test consume_words helper. */
int main(int argc, char *argv[])
int main(void)
{
size_t prefix, len;
bool start = true;
......
......@@ -10,7 +10,7 @@
#include <ccan/opt/parse.c>
/* Test iterators. */
int main(int argc, char *argv[])
int main(void)
{
unsigned j, i, len = 0;
const char *p;
......
......@@ -12,7 +12,7 @@ typedef int item_t;
typedef struct item item_t;
#endif
int main(int argc, char *argv[])
int main(void)
{
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;
#endif
int main(int argc, char *argv[])
int main(void)
{
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp, struct item,
......
......@@ -6,7 +6,7 @@
#include "fancy_cmp.h"
int main(int argc, char *argv[])
int main(void)
{
total_order_cb(cb0, struct item, struct cmp_info *) = fancy_cmp;
_total_order_cb cb1 = total_order_cast(fancy_cmp,
......
......@@ -8,7 +8,7 @@
#include "fancy_cmp.h"
int main(int argc, char *argv[])
int main(void)
{
struct item item1 = {
.value = 0,
......
......@@ -29,7 +29,7 @@
*
* void (*cb)(void *opaque) = callback;
*
* int main(int argc, char *argv[])
* int main(void)
* {
* int val = 17;
*
......
......@@ -17,7 +17,7 @@
* #include <ccan/read_write_all/read_write_all.h>
*
* #define BUFFER_SIZE 10
* int main(int argc, char *argv[])
* int main(void)
* {
* 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)
int main(int argc, char *argv[])
int main(void)
{
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
int main(int argc, char *argv[])
int main(void)
{
char *buffer;
......
......@@ -4,7 +4,7 @@ struct s {
int val;
};
int main(int argc, char *argv[])
int main(void)
{
struct s
#ifdef FAIL
......
#define CCAN_STR_DEBUG 1
#include <ccan/str/str.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
#if !HAVE_TYPEOF
......
#define CCAN_STR_DEBUG 1
#include <ccan/str/str.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
#if !HAVE_TYPEOF
......
#define CCAN_STR_DEBUG 1
#include <ccan/str/str.h>
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
#if !HAVE_TYPEOF
......
......@@ -4,7 +4,7 @@
#include <ccan/tap/tap.h>
#include <stdint.h>
int main(int argc, char *argv[])
int main(void)
{
char str[1000];
struct {
......
......@@ -21,7 +21,7 @@ static char *strdup_rev(const char *s)
return ret;
}
int main(int argc, char *argv[])
int main(void)
{
unsigned int i, j, n;
char *strings[NUM_SUBSTRINGS * NUM_SUBSTRINGS];
......
......@@ -10,7 +10,7 @@
#include <ccan/tal/str/str.h>
int
main(int argc, char *argv[])
main(void)
{
unsigned int i;
char **split, *str;
......
......@@ -9,7 +9,7 @@ static void destroy_obj(void *obj)
destroy_count++;
}
int main(int argc, char *argv[])
int main(void)
{
char *linkable, *p1, *p2, *p3;
void **voidpp;
......
......@@ -38,7 +38,7 @@
* return retval;
* }
*
* int main(int argc, char *argv[])
* int main(void)
* {
* tal_t *tmp_ctx = tal_newframe();
* int *val = do_work();
......
......@@ -6,7 +6,7 @@
#include "helper.h"
/* Empty format string: should still terminate! */
int main(int argc, char *argv[])
int main(void)
{
char *str;
const char *fmt = "";
......
......@@ -5,7 +5,7 @@
#include <ccan/tap/tap.h>
#include "helper.h"
int main(int argc, char *argv[])
int main(void)
{
char *str, *copy;
......
......@@ -14,7 +14,7 @@ static bool find_parent(tal_t *child, tal_t *parent)
return false;
}
int main(int argc, char *argv[])
int main(void)
{
void *ctx = tal_strdup(NULL, "toplevel");
char *a, *b;
......
......@@ -10,7 +10,7 @@
static const char *substrings[]
= { "far", "bar", "baz", "b", "ba", "z", "ar", NULL };
int main(int argc, char *argv[])
int main(void)
{
char **split, *str;
void *ctx;
......
......@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(concan, struct outer, inner));
};
int main(int argc, char *argv[])
int main(void)
{
struct info_tcon info;
struct outer ovar;
......
......@@ -17,7 +17,7 @@ struct info_base {
char *infop;
};
int main(int argc, char *argv[])
int main(void)
{
TCON_WRAP(struct info_base,
TCON_CONTAINER(concan, struct outer, inner)) info;
......
......@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(concan, struct outer, inner));
};
int main(int argc, char *argv[])
int main(void)
{
struct info_tcon info;
struct outer ovar;
......
......@@ -17,7 +17,7 @@ struct info_base {
char *infop;
};
int main(int argc, char *argv[])
int main(void)
{
TCON_WRAP(struct info_base,
TCON_CONTAINER(concan, struct outer, inner)) info;
......
......@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(concan, struct outer, inner));
};
int main(int argc, char *argv[])
int main(void)
{
struct info_tcon info;
struct outer ovar;
......
......@@ -17,7 +17,7 @@ struct info_base {
char *infop;
};
int main(int argc, char *argv[])
int main(void)
{
TCON_WRAP(struct info_base,
TCON_CONTAINER(concan, struct outer, inner)) info;
......
......@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(concan, struct outer, inner));
};
int main(int argc, char *argv[])
int main(void)
{
struct info_tcon info;
struct outer ovar;
......
......@@ -17,7 +17,7 @@ struct info_base {
char *infop;
};
int main(int argc, char *argv[])
int main(void)
{
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);
};
int main(int argc, char *argv[])
int main(void)
{
struct int_and_charp_container icon;
#ifdef FAIL
......
......@@ -5,7 +5,7 @@ struct container {
void *p;
};
int main(int argc, char *argv[])
int main(void)
{
TCON_WRAP(struct container,
int *tc1; char *tc2) icon;
......
......@@ -5,7 +5,7 @@ struct container {
void *p;
};
int main(int argc, char *argv[])
int main(void)
{
TCON_WRAP(struct container, int *canary) icon;
#ifdef FAIL
......
......@@ -10,7 +10,7 @@ struct int_container {
TCON(int *canary);
};
int main(int argc, char *argv[])
int main(void)
{
struct int_container icon;
#ifdef FAIL
......
......@@ -22,7 +22,7 @@ struct info_tcon {
TCON(TCON_CONTAINER(fi, struct outer, inner));
};
int main(int argc, char *argv[])
int main(void)
{
/* Const should work! */
const struct outer *ovar = NULL;
......
......@@ -16,7 +16,7 @@ struct charp_and_int_container {
TCON(int tc1; char *tc2);
};
int main(int argc, char *argv[])
int main(void)
{
struct int_container icon;
struct charp_and_int_container cicon;
......
......@@ -26,7 +26,7 @@ struct offs_container {
TCON_VALUE(off2, offsetof(struct other_struct, x2)));
};
int main(int argc, char *argv[])
int main(void)
{
struct val_container valcon;
struct offs_container offscon;
......
......@@ -28,7 +28,7 @@ struct info_tcon {
TCON_CONTAINER(fi2, struct outer0, inner));
};
int main(int argc, char *argv[])
int main(void)
{
struct info_tcon info;
TCON_WRAP(struct info_base,
......
......@@ -4,7 +4,7 @@
typedef TCON_WRAP(int, char *canary) canaried_int;
int main(int argc, char *argv[])
int main(void)
{
canaried_int ci = TCON_WRAP_INIT(0);
......
......@@ -23,7 +23,7 @@ static void update_and_expire(struct timers *timers)
free(timers_expire(timers, when));
}
int main(int argc, char *argv[])
int main(void)
{
struct timemono when;
struct timers timers;
......
......@@ -5,7 +5,7 @@
#include <ccan/tap/tap.h>
/* This is the original pre-cut-down dump. */
int main(int argc, char *argv[])
int main(void)
{
struct timemono when;
struct timers timers;
......
......@@ -5,7 +5,7 @@
#include <ccan/tap/tap.h>
/* This is the original pre-cut-down dump. */
int main(int argc, char *argv[])
int main(void)
{
struct timemono when;
struct timers timers;
......
......@@ -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)))
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
bool x = 0;
......
......@@ -17,7 +17,7 @@ void my_callback(int something)
{
}
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
/* This fails due to arg, not due to cast. */
......
......@@ -12,7 +12,7 @@ static void my_callback(char *p)
{
}
int main(int argc, char *argv[])
int main(void)
{
char str[] = "hello world";
#ifdef FAIL
......
......@@ -25,7 +25,7 @@ static void take_any(struct any *any)
{
}
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
struct other
......
......@@ -9,7 +9,7 @@ void _set_some_value(void *val)
#define set_some_value(expr) \
_set_some_value(typesafe_cb_cast(void *, unsigned long, (expr)))
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
int x = 0;
......
......@@ -11,7 +11,7 @@ static void my_callback(char *p, int x)
{
}
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
int *p;
......
......@@ -12,7 +12,7 @@ static void my_callback(int x, char *p)
{
}
int main(int argc, char *argv[])
int main(void)
{
#ifdef FAIL
int *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))
int main(int argc, char *argv[])
int main(void)
{
register_callback(NULL, "hello world");
return 0;
......
......@@ -38,7 +38,7 @@ static void my_callback_post(struct undefined *undef, int x)
{
}
int main(int argc, char *argv[])
int main(void)
{
struct undefined *handle = NULL;
......
......@@ -38,7 +38,7 @@ static void my_callback_post(struct undefined *undef, int x)
{
}
int main(int argc, char *argv[])
int main(void)
{
struct undefined *handle = NULL;
void (*cb)(struct undefined *undef) = my_callback;
......
......@@ -21,7 +21,7 @@ static void take_any(struct any *any)
{
}
int main(int argc, char *argv[])
int main(void)
{
/* 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" };
int main(int argc, char *argv[])
int main(void)
{
void *p = &dummy;
unsigned long l = (unsigned long)p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment