From e300436fe55b9d9c359fb99f5fbe9391150fddd0 Mon Sep 17 00:00:00 2001 From: Philipp Tölke Date: Wed, 15 Jun 2011 07:15:40 +0000 Subject: Stop gcc from treating unused arguments as error when compiling with -Wextra --- src/mesh/mesh_api.c | 6 ++--- src/vpn/gnunet-daemon-exit.c | 46 +++++++++++++++++++------------------- src/vpn/gnunet-daemon-vpn-dns.c | 6 ++--- src/vpn/gnunet-daemon-vpn-helper.c | 6 ++--- src/vpn/gnunet-daemon-vpn.c | 29 +++++++++++++----------- src/vpn/gnunet-service-dns.c | 42 +++++++++++++++++----------------- 6 files changed, 69 insertions(+), 66 deletions(-) diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index c1875854e..81260c81f 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -164,9 +164,9 @@ call_connect_handler (void *cls, static void core_startup (void *cls, - struct GNUNET_CORE_Handle *core, + struct GNUNET_CORE_Handle *core __attribute__((unused)), const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey __attribute__((unused))) { struct GNUNET_MESH_Handle *handle = cls; memcpy (&handle->myself, my_identity, sizeof (struct GNUNET_PeerIdentity)); @@ -620,7 +620,7 @@ GNUNET_MESH_notify_transmit_ready (struct struct GNUNET_TIME_Relative maxdelay, - const struct GNUNET_PeerIdentity *target, + const struct GNUNET_PeerIdentity *target __attribute__((unused)), size_t notify_size, GNUNET_CONNECTION_TransmitReadyNotify diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index 0ee07fead..eaa50d2e1 100644 --- a/src/vpn/gnunet-daemon-exit.c +++ b/src/vpn/gnunet-daemon-exit.c @@ -157,7 +157,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *tcp_services; * Function that frees everything from a hashmap */ static int -free_iterate(void* cls, const GNUNET_HashCode* hash, void* value) +free_iterate(void* cls __attribute__((unused)), const GNUNET_HashCode* hash __attribute__((unused)), void* value) { GNUNET_free(value); return GNUNET_YES; @@ -167,7 +167,7 @@ free_iterate(void* cls, const GNUNET_HashCode* hash, void* value) * Function scheduled as very last function, cleans up after us */ static void -cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { +cleanup(void* cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext* tskctx) { GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); GNUNET_CONTAINER_multihashmap_iterate(udp_connections, @@ -407,8 +407,8 @@ tcp_from_helper (struct tcp_pkt *tcp, unsigned char *dadr, size_t addrlen, * Receive packets from the helper-process */ static void -message_token (void *cls, - void *client, const struct GNUNET_MessageHeader *message) +message_token (void *cls __attribute__((unused)), + void *client __attribute__((unused)), const struct GNUNET_MessageHeader *message) { GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_HELPER); @@ -459,7 +459,7 @@ message_token (void *cls, * "OFFERED-PORT:HOSTNAME:HOST-PORT" (SPACE <more of those>)* */ static void -read_service_conf (void *cls, const char *section, const char *option, +read_service_conf (void *cls __attribute__((unused)), const char *section, const char *option, const char *value) { char *cpy; @@ -831,12 +831,12 @@ prepare_ipv6_packet (ssize_t len, ssize_t pktlen, void *payload, * The messages are one GNUNET_HashCode for the service followed by a struct tcp_pkt */ static int -receive_tcp_service (void *cls, +receive_tcp_service (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n"); GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); @@ -932,12 +932,12 @@ receive_tcp_service (void *cls, } static int -receive_tcp_remote (void *cls, +receive_tcp_remote (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); @@ -1000,12 +1000,12 @@ receive_tcp_remote (void *cls, } static int -receive_udp_remote (void *cls, +receive_udp_remote (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); @@ -1078,12 +1078,12 @@ receive_udp_remote (void *cls, * The messages are one GNUNET_HashCode for the service, followed by a struct udp_pkt */ static int -receive_udp_service (void *cls, +receive_udp_service (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); @@ -1184,8 +1184,8 @@ receive_udp_service (void *cls, */ static void run (void *cls, - char *const *args, - const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_) + char *const *args __attribute__((unused)), + const char *cfgfile __attribute__((unused)), const struct GNUNET_CONFIGURATION_Handle *cfg_) { static const struct GNUNET_MESH_MessageHandler handlers[] = { {receive_udp_service, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0}, diff --git a/src/vpn/gnunet-daemon-vpn-dns.c b/src/vpn/gnunet-daemon-vpn-dns.c index 07e2d6059..46ec6d659 100644 --- a/src/vpn/gnunet-daemon-vpn-dns.c +++ b/src/vpn/gnunet-daemon-vpn-dns.c @@ -52,7 +52,7 @@ struct answer_packet_list *answer_proc_tail; * {{{ */ size_t -send_query(void* cls, size_t size, void* buf) { +send_query(void* cls __attribute__((unused)), size_t size, void* buf) { size_t len; /* * Send the rehijack-message @@ -109,7 +109,7 @@ send_query(void* cls, size_t size, void* buf) { * Connect to the service-dns */ void -connect_to_service_dns (void *cls, +connect_to_service_dns (void *cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -142,7 +142,7 @@ connect_to_service_dns (void *cls, * handle it */ void -dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { +dns_answer_handler(void* cls __attribute__((unused)), const struct GNUNET_MessageHeader *msg) { /* the service disconnected, reconnect after short wait */ if (msg == NULL) { diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 100f08c97..b2119ecbb 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c @@ -132,7 +132,7 @@ start_helper_and_schedule(void *cls, * Send an dns-answer-packet to the helper */ void -helper_write(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) { +helper_write(void* cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) { if (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) return; @@ -205,8 +205,8 @@ helper_write(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tsdkctx) { * Receive packets from the helper-process */ void -message_token (void *cls, - void *client, const struct GNUNET_MessageHeader *message) +message_token (void *cls __attribute__((unused)), + void *client __attribute__((unused)), const struct GNUNET_MessageHeader *message) { GNUNET_assert (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_HELPER); diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 1be010685..a085f8065 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -65,7 +65,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *udp_connections; *{{{ */ static void -cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { +cleanup(void* cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext* tskctx) { GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); /* stop the helper */ @@ -108,7 +108,7 @@ address_mapping_exists(unsigned char addr[]) { } static void -collect_mappings(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { +collect_mappings(void* cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext* tc) { if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; @@ -126,6 +126,9 @@ collect_mappings(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tc) { void send_icmp_response(void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { + if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) + return; + struct ip6_icmp* request = cls; struct ip6_icmp* response = alloca(ntohs(request->shdr.size)); @@ -188,7 +191,7 @@ port_in_ports (uint64_t ports, uint16_t port) void send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { /* peer == NULL means that all peers in this request are connected */ if (peer == NULL) return; @@ -526,11 +529,11 @@ add_additional_port (struct map_entry *me, uint16_t port) } static int -receive_udp_back (void *cls, struct GNUNET_MESH_Tunnel* tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, +receive_udp_back (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel* tunnel, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct remote_addr* s = (struct remote_addr*)desc; @@ -609,11 +612,11 @@ receive_udp_back (void *cls, struct GNUNET_MESH_Tunnel* tunnel, } static int -receive_tcp_back (void *cls, struct GNUNET_MESH_Tunnel* tunnel, - void **tunnel_ctx, - const struct GNUNET_PeerIdentity *sender, +receive_tcp_back (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel* tunnel, + void **tunnel_ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1); struct remote_addr* s = (struct remote_addr*)desc; @@ -700,8 +703,8 @@ receive_tcp_back (void *cls, struct GNUNET_MESH_Tunnel* tunnel, */ static void run (void *cls, - char *const *args, - const char *cfgfile, + char *const *args __attribute__((unused)), + const char *cfgfilep __attribute__((unused)), const struct GNUNET_CONFIGURATION_Handle *cfg_) { static const struct GNUNET_MESH_MessageHandler handlers[] = { diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index 7b96a180d..b8edcce16 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -111,7 +111,7 @@ struct receive_dht_cls { * Hijack all outgoing DNS-Traffic but for traffic leaving "our" port. */ static void -hijack (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +hijack (void *cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; @@ -242,7 +242,7 @@ mesh_send (void *cls, size_t size, void *buf) } -void mesh_connect (void* cls, const struct GNUNET_PeerIdentity* peer, const struct GNUNET_TRANSPORT_ATS_Information *atsi) { +void mesh_connect (void* cls, const struct GNUNET_PeerIdentity* peer, const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %x\n", *((unsigned long*)peer)); struct tunnel_cls *cls_ = (struct tunnel_cls*)cls; @@ -276,12 +276,12 @@ send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } static int -receive_mesh_query (void *cls, +receive_mesh_query (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **ctx, - const struct GNUNET_PeerIdentity *sender, + void **ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { struct dns_pkt *dns = (struct dns_pkt*)(message + 1); @@ -304,12 +304,12 @@ receive_mesh_query (void *cls, } static int -receive_mesh_answer (void *cls, +receive_mesh_answer (void *cls __attribute__((unused)), struct GNUNET_MESH_Tunnel *tunnel, - void **ctx, - const struct GNUNET_PeerIdentity *sender, + void **ctx __attribute__((unused)), + const struct GNUNET_PeerIdentity *sender __attribute__((unused)), const struct GNUNET_MessageHeader *message, - const struct GNUNET_TRANSPORT_ATS_Information *atsi) + const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__((unused))) { /* TODo: size check */ struct dns_pkt *dns = (struct dns_pkt *) (message + 1); @@ -485,10 +485,10 @@ send_rev_query(void * cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { */ static void receive_dht(void *cls, - struct GNUNET_TIME_Absolute exp, - const GNUNET_HashCode *key, - const struct GNUNET_PeerIdentity *const *get_path, - const struct GNUNET_PeerIdentity *const *put_path, + struct GNUNET_TIME_Absolute exp __attribute__((unused)), + const GNUNET_HashCode *key __attribute__((unused)), + const struct GNUNET_PeerIdentity *const *get_path __attribute__((unused)), + const struct GNUNET_PeerIdentity *const *put_path __attribute__((unused)), enum GNUNET_BLOCK_Type type, size_t size, const void *data) { @@ -592,9 +592,9 @@ receive_dht(void *cls, * This receives a GNUNET_MESSAGE_TYPE_REHIJACK and rehijacks the DNS */ static void -rehijack(void *cls, +rehijack(void *cls __attribute__((unused)), struct GNUNET_SERVER_Client *client, - const struct GNUNET_MessageHeader *message) { + const struct GNUNET_MessageHeader *message __attribute__((unused))) { unhijack(dnsoutport); GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, hijack, NULL); @@ -605,7 +605,7 @@ rehijack(void *cls, * This receives the dns-payload from the daemon-vpn and sends it on over the udp-socket */ static void -receive_query(void *cls, +receive_query(void *cls __attribute__((unused)), struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { struct query_packet* pkt = (struct query_packet*)message; @@ -806,7 +806,7 @@ open_port () * Read a response-packet of the UDP-Socket */ static void -read_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +read_response (void *cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext *tc) { struct sockaddr_in addr; socklen_t addrlen = sizeof (addr); @@ -899,7 +899,7 @@ read_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param tc unused */ static void -cleanup_task (void *cls, +cleanup_task (void *cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_assert(0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); @@ -1041,7 +1041,7 @@ publish_name (const char *name, uint64_t ports, uint32_t service_type, * @param section the current section */ void -publish_iterate (void *cls, const char *section) +publish_iterate (void *cls __attribute__((unused)), const char *section) { char *udp_redirects, *tcp_redirects, *alternative_names, *alternative_name, *keyfile; @@ -1105,7 +1105,7 @@ publish_iterate (void *cls, const char *section) * Publish a DNS-record in the DHT. This is up to now just for testing. */ static void -publish_names (void *cls, +publish_names (void *cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskContext *tc) { char *services; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) -- cgit v1.2.3