Mark intentionally unused parameters as such (with "UNUSED")

This commit is contained in:
practicalswift 2018-02-21 16:06:07 +01:00 committed by Rusty Russell
parent 3dbace3421
commit 91a9c2923f
38 changed files with 85 additions and 85 deletions

View File

@ -65,11 +65,11 @@ static void dump_tx(const char *msg,
}
}
#else
static void dump_tx(const char *msg,
const struct bitcoin_tx *tx, size_t inputnum,
const u8 *script,
const struct pubkey *key,
const struct sha256_double *h)
static void dump_tx(const char *msg UNUSED,
const struct bitcoin_tx *tx UNUSED, size_t inputnum UNUSED,
const u8 *script UNUSED,
const struct pubkey *key UNUSED,
const struct sha256_double *h UNUSED)
{
}
#endif

View File

@ -255,7 +255,7 @@ u8 *linearize_tx(const tal_t *ctx, const struct bitcoin_tx *tx)
return arr;
}
static void push_measure(const void *data, size_t len, void *lenp)
static void push_measure(const void *data UNUSED, size_t len, void *lenp)
{
*(size_t *)lenp += len;
}

View File

@ -1743,9 +1743,9 @@ static void channeld_io_error(struct peer *peer)
peer_conn_broken(peer);
}
static bool channeld_send_reply(struct crypto_state *cs,
int peer_fd,
const u8 *msg,
static bool channeld_send_reply(struct crypto_state *cs UNUSED,
int peer_fd UNUSED,
const u8 *msg UNUSED,
struct peer *peer)
{
enqueue_peer_msg(peer, msg);

View File

@ -14,7 +14,7 @@
#include <common/type_to_string.h>
#include <stdio.h>
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;

View File

@ -42,7 +42,7 @@ static void tal_freefn(void *ptr)
struct netaddr;
char *netaddr_name(const tal_t *ctx, const struct netaddr *a);
char *netaddr_name(const tal_t *ctx, const struct netaddr *a)
char *netaddr_name(const tal_t *ctx UNUSED, const struct netaddr *a UNUSED)
{
return NULL;
}

View File

@ -30,14 +30,14 @@ char *version_and_exit(const void *unused UNNEEDED)
{ fprintf(stderr, "version_and_exit called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
int test_socket(int domain, int type, int protocol)
int test_socket(int domain UNUSED, int type UNUSED, int protocol UNUSED)
{
/* We give a real fd, as it writes to it */
return open("/dev/null", O_WRONLY);
}
int test_connect(int sockfd, const struct sockaddr *addr,
socklen_t addrlen)
int test_connect(int sockfd UNUSED, const struct sockaddr *addr UNUSED,
socklen_t addrlen UNUSED)
{
return 0;
}
@ -47,7 +47,7 @@ int test_getpid(void)
return 9999;
}
int test_printf(const char *fmt, ...)
int test_printf(const char *fmt UNUSED, ...)
{
return 0;
}
@ -55,7 +55,7 @@ int test_printf(const char *fmt, ...)
static char *response;
static size_t response_off, max_read_return;
ssize_t test_read(int fd, void *buf, size_t len)
ssize_t test_read(int fd UNUSED, void *buf, size_t len)
{
if (len > max_read_return)
len = max_read_return;
@ -82,7 +82,7 @@ ssize_t test_read(int fd, void *buf, size_t len)
" {\"type\": \"DEBUG\", \"time\": \"241693.051558854\", \"source\": \"lightning_gossipd(14581):\", \"log\": \"TRACE: nonlocal_gossip_broadcast_done\"},\n"
#define TAILER "] } }"
int main(int argc, char *argv[])
int main(int argc UNUSED, char *argv[])
{
char *fake_argv[] = { argv[0], "--lightning-dir=/tmp/", "test", NULL };

View File

@ -218,7 +218,7 @@ static int append_bt(void *data, uintptr_t pc)
return 0;
}
static void add_backtrace(tal_t *parent, enum tal_notify_type type UNNEEDED,
static void add_backtrace(tal_t *parent UNUSED, enum tal_notify_type type UNNEEDED,
void *child)
{
uintptr_t *bt = tal_alloc_arr_(child, sizeof(uintptr_t), 32, true, true,

View File

@ -112,13 +112,13 @@ u8 *read_peer_msg_(const tal_t *ctx,
/* Helper: sync_crypto_write, with extra args it ignores */
bool sync_crypto_write_arg(struct crypto_state *cs, int fd, const u8 *msg,
void *unused)
void *unused UNUSED)
{
return sync_crypto_write(cs, fd, msg);
}
/* Helper: calls peer_failed_connection_lost. */
void status_fail_io(void *unused)
void status_fail_io(void *unused UNUSED)
{
peer_failed_connection_lost();
}

View File

@ -21,7 +21,7 @@ static struct daemon_conn *status_conn;
const void *trc;
volatile bool logging_io = false;
static void got_sigusr1(int signal)
static void got_sigusr1(int signal UNUSED)
{
logging_io = !logging_io;
}

View File

@ -14,7 +14,7 @@
static struct backtrace_state *backtrace_state;
static int backtrace_status(void *unused, uintptr_t pc,
static int backtrace_status(void *unused UNUSED, uintptr_t pc,
const char *filename, int lineno,
const char *function)
{

View File

@ -40,7 +40,7 @@ static struct privkey privkey;
static bool test_sign(const u5 *u5bytes,
const u8 *hrpu8,
secp256k1_ecdsa_recoverable_signature *rsig,
void *unused)
void *unused UNUSED)
{
struct hash_u5 hu5;
char *hrp;

View File

@ -7,7 +7,7 @@ const char *version(void)
return VERSION;
}
char *version_and_exit(const void *unused)
char *version_and_exit(const void *unused UNUSED)
{
printf("%s\n"
"aka. %s\n"

View File

@ -1,7 +1,7 @@
#include <common/utils.h>
#include <devtools/gen_print_wire.h>
int main(int argc, char *argv[])
int main(int argc UNUSED, char *argv[])
{
u8 *m = tal_hexdata(NULL, argv[1], strlen(argv[1]));
print_message(m);

View File

@ -839,7 +839,7 @@ static struct io_plan *owner_msg_in(struct io_conn *conn,
return daemon_conn_read_next(conn, dc);
}
static void forget_peer(struct io_conn *conn, struct daemon_conn *dc)
static void forget_peer(struct io_conn *conn UNUSED, struct daemon_conn *dc)
{
struct peer *peer = dc->ctx;
@ -2011,7 +2011,7 @@ static struct io_plan *recv_req(struct io_conn *conn, struct daemon_conn *master
}
#ifndef TESTING
static void master_gone(struct io_conn *unused, struct daemon_conn *dc)
static void master_gone(struct io_conn *unused UNUSED, struct daemon_conn *dc UNUSED)
{
/* Can't tell master, it's gone. */
exit(2);

View File

@ -12,7 +12,7 @@
#include <sys/wait.h>
#include <unistd.h>
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;

View File

@ -6,7 +6,7 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED)
return NULL;
}
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;

View File

@ -32,7 +32,7 @@ static struct io_plan *test_read(struct io_conn *conn,
struct handshake *h);
#define SUPERVERBOSE status_trace
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;
@ -174,9 +174,9 @@ static struct io_plan *test_read(struct io_conn *conn,
return next(conn, h);
}
static struct io_plan *success(struct io_conn *conn,
static struct io_plan *success(struct io_conn *conn UNUSED,
const struct pubkey *them,
const struct wireaddr *addr,
const struct wireaddr *addr UNUSED,
const struct crypto_state *cs,
void *ctx)
{

View File

@ -32,7 +32,7 @@ static struct io_plan *test_read(struct io_conn *conn,
struct handshake *h);
#define SUPERVERBOSE status_debug
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;
@ -174,9 +174,9 @@ static struct io_plan *test_read(struct io_conn *conn,
return next(conn, h);
}
static struct io_plan *success(struct io_conn *conn,
const struct pubkey *them,
const struct wireaddr *addr,
static struct io_plan *success(struct io_conn *conn UNUSED,
const struct pubkey *them UNUSED,
const struct wireaddr *addr UNUSED,
const struct crypto_state *cs,
void *ctx)
{

View File

@ -823,11 +823,11 @@ static void sign_node_announcement(struct daemon_conn *master, const u8 *msg)
#ifndef TESTING
/* FIXME: This is used by debug.c, but doesn't apply to us. */
extern void dev_disconnect_init(int fd);
void dev_disconnect_init(int fd)
void dev_disconnect_init(int fd UNUSED)
{
}
static void master_gone(struct io_conn *unused, struct daemon_conn *dc)
static void master_gone(struct io_conn *unused UNUSED, struct daemon_conn *dc UNUSED)
{
/* Can't tell master, it's gone. */
exit(2);

View File

@ -115,7 +115,7 @@ static char *bcli_args(struct bitcoin_cli *bcli)
return ret;
}
static void bcli_finished(struct io_conn *conn, struct bitcoin_cli *bcli)
static void bcli_finished(struct io_conn *conn UNUSED, struct bitcoin_cli *bcli)
{
int ret, status;
struct bitcoind *bitcoind = bcli->bitcoind;
@ -202,7 +202,7 @@ static void next_bcli(struct bitcoind *bitcoind)
io_set_finish(conn, bcli_finished, bcli);
}
static void process_donothing(struct bitcoin_cli *bcli)
static void process_donothing(struct bitcoin_cli *bcli UNUSED)
{
}

View File

@ -417,7 +417,7 @@ static void remove_tip(struct chain_topology *topo)
tal_free(b);
}
static void have_new_block(struct bitcoind *bitcoind,
static void have_new_block(struct bitcoind *bitcoind UNUSED,
struct bitcoin_block *blk,
struct chain_topology *topo)
{
@ -449,7 +449,7 @@ static void try_extend_tip(struct chain_topology *topo)
get_new_block, topo);
}
static void init_topo(struct bitcoind *bitcoind,
static void init_topo(struct bitcoind *bitcoind UNUSED,
struct bitcoin_block *blk,
struct chain_topology *topo)
{
@ -584,7 +584,7 @@ void json_dev_broadcast(struct command *cmd,
}
static void json_dev_blockheight(struct command *cmd,
const char *buffer, const jsmntok_t *params)
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{
struct chain_topology *topo = cmd->ld->topology;
struct json_result *response;

View File

@ -9,7 +9,7 @@
#include <lightningd/peer_control.h>
#include <lightningd/subd.h>
static void ping_reply(struct subd *subd, const u8 *msg, const int *fds,
static void ping_reply(struct subd *subd, const u8 *msg, const int *fds UNUSED,
struct command *cmd)
{
u16 totlen;

View File

@ -188,8 +188,8 @@ void gossip_init(struct lightningd *ld)
tal_free(tmpctx);
}
static void json_getnodes_reply(struct subd *gossip, const u8 *reply,
const int *fds,
static void json_getnodes_reply(struct subd *gossip UNUSED, const u8 *reply,
const int *fds UNUSED,
struct command *cmd)
{
struct gossip_getnodes_entry **nodes;
@ -263,7 +263,7 @@ static const struct json_command listnodes_command = {
};
AUTODATA(json_command, &listnodes_command);
static void json_getroute_reply(struct subd *gossip, const u8 *reply, const int *fds,
static void json_getroute_reply(struct subd *gossip UNUSED, const u8 *reply, const int *fds UNUSED,
struct command *cmd)
{
struct json_result *response;
@ -355,8 +355,8 @@ static const struct json_command getroute_command = {
AUTODATA(json_command, &getroute_command);
/* Called upon receiving a getchannels_reply from `gossipd` */
static void json_listchannels_reply(struct subd *gossip, const u8 *reply,
const int *fds, struct command *cmd)
static void json_listchannels_reply(struct subd *gossip UNUSED, const u8 *reply,
const int *fds UNUSED, struct command *cmd)
{
size_t i;
struct gossip_getchannels_entry *entries;

View File

@ -67,7 +67,7 @@ static const struct json_command help_command = {
AUTODATA(json_command, &help_command);
static void json_stop(struct command *cmd,
const char *buffer, const jsmntok_t *params)
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{
struct json_result *response = new_json_result(cmd);
@ -122,8 +122,8 @@ static const struct json_command dev_rhash_command = {
};
AUTODATA(json_command, &dev_rhash_command);
static void json_crash(struct command *cmd,
const char *buffer, const jsmntok_t *params)
static void json_crash(struct command *cmd UNUSED,
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{
fatal("Crash at user request");
}
@ -137,7 +137,7 @@ AUTODATA(json_command, &dev_crash_command);
#endif /* DEVELOPER */
static void json_getinfo(struct command *cmd,
const char *buffer, const jsmntok_t *params)
const char *buffer UNUSED, const jsmntok_t *params UNUSED)
{
struct json_result *response = new_json_result(cmd);

View File

@ -534,7 +534,7 @@ static void log_crash(int sig)
fprintf(stderr, "\n");
}
void crashlog_activate(const char *argv0, struct log *log)
void crashlog_activate(const char *argv0 UNUSED, struct log *log)
{
struct sigaction sa;
crashlog = log;

View File

@ -66,7 +66,7 @@ static const struct json_command dev_memdump_command = {
};
AUTODATA(json_command, &dev_memdump_command);
static int json_add_syminfo(void *data, uintptr_t pc,
static int json_add_syminfo(void *data, uintptr_t pc UNUSED,
const char *filename, int lineno,
const char *function)
{

View File

@ -138,7 +138,7 @@ static bool IsRFC4843(const struct wireaddr *addr)
return IsIPv6(addr) && (GetByte(addr, 15) == 0x20 && GetByte(addr, 14) == 0x01 && GetByte(addr, 13) == 0x00 && (GetByte(addr, 12) & 0xF0) == 0x10);
}
static bool IsTor(const struct wireaddr *addr)
static bool IsTor(const struct wireaddr *addr UNUSED)
{
/* FIXME */
return false;

View File

@ -139,8 +139,8 @@ static void json_pay_sendpay_resolve(const struct sendpay_result *r,
json_pay_try(pay);
}
static void json_pay_getroute_reply(struct subd *gossip,
const u8 *reply, const int *fds,
static void json_pay_getroute_reply(struct subd *gossip UNUSED,
const u8 *reply, const int *fds UNUSED,
struct pay *pay)
{
struct route_hop *route;

View File

@ -51,7 +51,7 @@ static void destroy_peer(struct peer *peer)
static void copy_to_parent_log(const char *prefix,
enum log_level level,
bool continued,
const struct timeabs *time,
const struct timeabs *time UNUSED,
const char *str,
const u8 *io,
struct log *parent_log)
@ -220,7 +220,7 @@ void channel_errmsg(struct channel *channel,
int peer_fd, int gossip_fd,
const struct crypto_state *cs,
u64 gossip_index,
const struct channel_id *channel_id,
const struct channel_id *channel_id UNUSED,
const char *desc,
const u8 *err_for_them)
{
@ -478,7 +478,7 @@ send_error:
}
static enum watch_result funding_announce_cb(struct channel *channel,
const struct bitcoin_tx *tx,
const struct bitcoin_tx *tx UNUSED,
unsigned int depth)
{
if (depth < ANNOUNCE_MIN_DEPTH) {
@ -584,7 +584,7 @@ struct getpeers_args {
};
static void gossipd_getpeers_complete(struct subd *gossip, const u8 *msg,
const int *fds,
const int *fds UNUSED,
struct getpeers_args *gpa)
{
/* This is a little sneaky... */
@ -927,9 +927,9 @@ static const struct json_command dev_fail_command = {
};
AUTODATA(json_command, &dev_fail_command);
static void dev_reenable_commit_finished(struct subd *channeld,
const u8 *resp,
const int *fds,
static void dev_reenable_commit_finished(struct subd *channeld UNUSED,
const u8 *resp UNUSED,
const int *fds UNUSED,
struct command *cmd)
{
command_success(cmd, null_response(cmd));

View File

@ -330,7 +330,7 @@ static void destroy_hout_subd_died(struct htlc_out *hout)
/* This is where channeld gives us the HTLC id, and also reports if it
* failed immediately. */
static void rcvd_htlc_reply(struct subd *subd, const u8 *msg, const int *fds,
static void rcvd_htlc_reply(struct subd *subd, const u8 *msg, const int *fds UNUSED,
struct htlc_out *hout)
{
u16 failure_code;
@ -515,7 +515,7 @@ struct gossip_resolve {
/* We received a resolver reply, which gives us the node_ids of the
* channel we want to forward over */
static void channel_resolve_reply(struct subd *gossip, const u8 *msg,
const int *fds, struct gossip_resolve *gr)
const int *fds UNUSED, struct gossip_resolve *gr)
{
struct pubkey *nodes, *peer_id;

View File

@ -58,8 +58,8 @@ static void destroy_subd_req(struct subd_req *sr)
}
/* Called when the callback is disabled because caller was freed. */
static void ignore_reply(struct subd *sd, const u8 *msg, const int *fds,
void *arg)
static void ignore_reply(struct subd *sd, const u8 *msg UNUSED, const int *fds,
void *arg UNUSED)
{
size_t i;
@ -68,7 +68,7 @@ static void ignore_reply(struct subd *sd, const u8 *msg, const int *fds,
close(fds[i]);
}
static void disable_cb(void *disabler, struct subd_req *sr)
static void disable_cb(void *disabler UNUSED, struct subd_req *sr)
{
sr->replycb = ignore_reply;
sr->disabler = NULL;
@ -275,7 +275,7 @@ int subd_raw(struct lightningd *ld, const char *name)
static struct io_plan *sd_msg_read(struct io_conn *conn, struct subd *sd);
static void mark_freed(struct subd *unused, bool *freed)
static void mark_freed(struct subd *unused UNUSED, bool *freed)
{
*freed = true;
}

View File

@ -36,7 +36,7 @@ static void do_write(const void *buf, size_t len)
#define io_write(conn, p, len, next, arg) \
(do_write((p), (len)), (next)((conn), (arg)), NULL)
void status_fmt(enum log_level level, const char *fmt, ...)
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{
va_list ap;
@ -46,7 +46,7 @@ void status_fmt(enum log_level level, const char *fmt, ...)
va_end(ap);
}
void status_io(enum log_level dir, const u8 *msg)
void status_io(enum log_level dir UNUSED, const u8 *msg UNUSED)
{
}
@ -60,7 +60,7 @@ void dev_sabotage_fd(int fd UNNEEDED)
{ fprintf(stderr, "dev_sabotage_fd called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
enum dev_disconnect dev_disconnect(int pkt_type)
enum dev_disconnect dev_disconnect(int pkt_type UNUSED)
{
return DEV_DISCONNECT_NORMAL;
}
@ -73,13 +73,13 @@ enum dev_disconnect dev_disconnect(int pkt_type)
const void *trc;
static struct io_plan *check_msg_write(struct io_conn *conn, struct peer *peer)
static struct io_plan *check_msg_write(struct io_conn *conn UNUSED, struct peer *peer UNUSED)
{
assert(tal_count(write_buf) == 2 + 16 + 5 + 16);
return NULL;
}
static struct io_plan *check_msg_read(struct io_conn *conn, struct peer *peer,
static struct io_plan *check_msg_read(struct io_conn *conn UNUSED, struct peer *peer UNUSED,
u8 *msg)
{
assert(tal_count(msg) == 5);

View File

@ -35,7 +35,7 @@ void free_htlcs(struct lightningd *ld UNNEEDED, const struct channel *channel UN
void gossip_init(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "gossip_init called!\n"); abort(); }
/* Generated stub for handle_opts */
bool handle_opts(struct lightningd *ld UNNEEDED, int argc UNNEEDED, char *argv[])
bool handle_opts(struct lightningd *ld UNNEEDED, int argc UNNEEDED, char *argv[] UNUSED)
{ fprintf(stderr, "handle_opts called!\n"); abort(); }
/* Generated stub for hash_htlc_key */
size_t hash_htlc_key(const struct htlc_key *htlc_key UNNEEDED)
@ -78,7 +78,7 @@ void subd_shutdown(struct subd *subd UNNEEDED, unsigned int seconds UNNEEDED)
void timer_expired(tal_t *ctx UNNEEDED, struct timer *timer UNNEEDED)
{ fprintf(stderr, "timer_expired called!\n"); abort(); }
/* Generated stub for txfilter_add_derkey */
void txfilter_add_derkey(struct txfilter *filter UNNEEDED, u8 derkey[PUBKEY_DER_LEN])
void txfilter_add_derkey(struct txfilter *filter UNNEEDED, u8 derkey[PUBKEY_DER_LEN] UNUSED)
{ fprintf(stderr, "txfilter_add_derkey called!\n"); abort(); }
/* Generated stub for txfilter_new */
struct txfilter *txfilter_new(const tal_t *ctx UNNEEDED)
@ -127,7 +127,7 @@ char *opt_subd_dev_disconnect(const char *optarg UNNEEDED, struct lightningd *ld
#endif
#undef main
int main(int argc, char *argv[])
int main(int argc UNUSED, char *argv[] UNUSED)
{
char *tmpctx = tal_tmpctx(NULL);
char *argv0;

View File

@ -1222,7 +1222,7 @@ static void start_clients(int a_to_b[2],
close(a_to_b[1]);
}
static void do_nothing(int sig)
static void do_nothing(int sig UNUSED)
{
}

View File

@ -254,7 +254,7 @@ static void PRINTF_FMT(3, 4)
tal_free(cmd);
}
bool db_exec_prepared_mayfail_(const char *caller, struct db *db, sqlite3_stmt *stmt)
bool db_exec_prepared_mayfail_(const char *caller UNUSED, struct db *db, sqlite3_stmt *stmt)
{
assert(db->in_transaction);
@ -270,7 +270,7 @@ fail:
}
sqlite3_stmt *PRINTF_FMT(3, 4)
db_query(const char *caller, struct db *db, const char *fmt, ...)
db_query(const char *caller UNUSED, struct db *db, const char *fmt, ...)
{
va_list ap;
char *query;

View File

@ -500,7 +500,7 @@ void invoices_waitany(const tal_t *ctx,
void invoices_waitone(const tal_t *ctx,
struct invoices *invoices,
struct invoices *invoices UNUSED,
struct invoice const *cinvoice,
void (*cb)(const struct invoice *, void*),
void *cbarg)

View File

@ -3,7 +3,7 @@
static void db_fatal(const char *fmt, ...);
#define fatal db_fatal
static void db_log_(struct log *log, enum log_level level, const char *fmt, ...)
static void db_log_(struct log *log UNUSED, enum log_level level UNUSED, const char *fmt UNUSED, ...)
{
}
#define log_ db_log_

View File

@ -4,7 +4,7 @@ static void wallet_fatal(const char *fmt, ...);
#define fatal wallet_fatal
#include "test_utils.h"
static void db_log_(struct log *log, enum log_level level, const char *fmt, ...)
static void db_log_(struct log *log UNUSED, enum log_level level UNUSED, const char *fmt UNUSED, ...)
{
}
#define log_ db_log_