summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 388dfe0)
raw | patch | inline | side by side (parent: 388dfe0)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 11 Feb 2009 09:43:25 +0000 (10:43 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 11 Feb 2009 09:43:25 +0000 (10:43 +0100) |
In all cases where unused parameters have to exist either because some API
requires it or for more consistency, they now have been documented using
__attribute__((unused)) (which is automatically disabled in case GCC is not
used to prevent problems with compilers not supporting attributes). In a few
other cases, the parameters have been removed.
This allows the use of -Wunused-parameter (which is enabled by -Wextra as
well, when using -Wall).
requires it or for more consistency, they now have been documented using
__attribute__((unused)) (which is automatically disabled in case GCC is not
used to prevent problems with compilers not supporting attributes). In a few
other cases, the parameters have been removed.
This allows the use of -Wunused-parameter (which is enabled by -Wextra as
well, when using -Wall).
30 files changed:
diff --git a/src/apache.c b/src/apache.c
index 7dc34f5bf6a2b450c1a6542ba75108b7eed575f8..091d594741612e3f12d99f3852af58bf90785fbd 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb,
- void *stream)
+ void __attribute__((unused)) *stream)
{
size_t len = size * nmemb;
diff --git a/src/ascent.c b/src/ascent.c
index bf1e9f4a8ab078dd01091e05078abe475725a029..54341c7733cfa116cfe79d463eb7fec81159f50e 100644 (file)
--- a/src/ascent.c
+++ b/src/ascent.c
} /* }}} int ascent_submit_gauge */
static size_t ascent_curl_callback (void *buf, size_t size, size_t nmemb, /* {{{ */
- void *stream)
+ void __attribute__((unused)) *stream)
{
size_t len = size * nmemb;
diff --git a/src/battery.c b/src/battery.c
index d142982df4c7926a08bee11bf778a405d8253c19..272193ee507b742d78ac30de98cfe7466b697f45 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
#endif /* HAVE_IOKIT_IOKITLIB_H */
#if KERNEL_LINUX
-static int battery_read_acpi (const char *dir, const char *name,
- void *user_data)
+static int battery_read_acpi (const char __attribute__((unused)) *dir,
+ const char *name, void __attribute__((unused)) *user_data)
{
double current = INVALID_VALUE;
double voltage = INVALID_VALUE;
diff --git a/src/bind.c b/src/bind.c
index f9de8e6a87c2029c1dbc7bdf9add36338e331532..8cd111652bbbe774f0c1a518d695a58d26adce55 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
@@ -281,7 +281,7 @@ static void submit_counter(time_t ts, const char *plugin_instance, const char *t
} /* void submit_counter */
static size_t bind_curl_callback (void *buf, size_t size, size_t nmemb,
- void *stream)
+ void __attribute__((unused)) *stream)
{
size_t len = size * nmemb;
diff --git a/src/collectd.c b/src/collectd.c
index 17905c74f95a674eddee10958077ff43bd44c469..576abef48c7110575d3a7452008c4a28970db3c4 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
static int loop = 0;
-static void *do_flush (void *arg)
+static void *do_flush (void __attribute__((unused)) *arg)
{
INFO ("Flushing all data.");
plugin_flush (NULL, -1, NULL);
return NULL;
}
-static void sig_int_handler (int signal)
+static void sig_int_handler (int __attribute__((unused)) signal)
{
loop++;
}
-static void sig_term_handler (int signal)
+static void sig_term_handler (int __attribute__((unused)) signal)
{
loop++;
}
-static void sig_usr1_handler (int signal)
+static void sig_usr1_handler (int __attribute__((unused)) signal)
{
pthread_t thread;
pthread_attr_t attr;
diff --git a/src/collectdmon.c b/src/collectdmon.c
index 015344f96a8e07b0fabf1dba614b559b280e0397..078b2eb1d2b1422acc50370406ebf48558677a18 100644 (file)
--- a/src/collectdmon.c
+++ b/src/collectdmon.c
* Sebastian Harl <sh at tokkee.org>
**/
+#if !defined(__GNUC__) || !__GNUC__
+# define __attribute__(x) /**/
+#endif
+
#include "config.h"
#include <assert.h>
return 0;
} /* collectd_stop */
-static void sig_int_term_handler (int signo)
+static void sig_int_term_handler (int __attribute__((unused)) signo)
{
++loop;
return;
} /* sig_int_term_handler */
-static void sig_hup_handler (int signo)
+static void sig_hup_handler (int __attribute__((unused)) signo)
{
++restart;
return;
diff --git a/src/dns.c b/src/dns.c
index d82cbd86cc19809f7ff4180868534911a9049dc7..ab38789ff858fc9842c50fed4f8e58e05cbe3184 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
pthread_mutex_unlock (&opcode_mutex);
}
-static void *dns_child_loop (void *dummy)
+static void *dns_child_loop (void __attribute__((unused)) *dummy)
{
pcap_t *pcap_obj;
char pcap_error[PCAP_ERRBUF_SIZE];
diff --git a/src/email.c b/src/email.c
index ff9d439423124f9f4cba93e6d0cb606c551bd879..f79217cbd89b373f42e84b2a10ea98bb193b3b19 100644 (file)
--- a/src/email.c
+++ b/src/email.c
pthread_exit ((void *)0);
} /* static void *collect (void *) */
-static void *open_connection (void *arg)
+static void *open_connection (void __attribute__((unused)) *arg)
{
struct sockaddr_un addr;
diff --git a/src/exec.c b/src/exec.c
index a78f902fdef5634b11baaae07045a8ea85578ee5..8add480e3e548c5e62dc0f37bf49ab6e6c45dd4a 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
/*
* Functions
*/
-static void sigchld_handler (int signal) /* {{{ */
+static void sigchld_handler (int __attribute__((unused)) signal) /* {{{ */
{
pid_t pid;
int status;
diff --git a/src/filter_chain.c b/src/filter_chain.c
index 6d0bca7b99380a5c13675c89dfc7275e0cb616c1..4c324a80a54a3a76a2706f604fe95bccaacbb1bc 100644 (file)
--- a/src/filter_chain.c
+++ b/src/filter_chain.c
} /* }}} int fc_bit_jump_destroy */
static int fc_bit_jump_invoke (const data_set_t *ds, /* {{{ */
- value_list_t *vl, notification_meta_t **meta, void **user_data)
+ value_list_t *vl, notification_meta_t __attribute__((unused)) **meta,
+ void **user_data)
{
char *chain_name;
fc_chain_t *chain;
return (FC_TARGET_CONTINUE);
} /* }}} int fc_bit_jump_invoke */
-static int fc_bit_stop_invoke (const data_set_t *ds, /* {{{ */
- value_list_t *vl, notification_meta_t **meta, void **user_data)
+static int fc_bit_stop_invoke (const data_set_t __attribute__((unused)) *ds, /* {{{ */
+ value_list_t __attribute__((unused)) *vl,
+ notification_meta_t __attribute__((unused)) **meta,
+ void __attribute__((unused)) **user_data)
{
return (FC_TARGET_STOP);
} /* }}} int fc_bit_stop_invoke */
-static int fc_bit_return_invoke (const data_set_t *ds, /* {{{ */
- value_list_t *vl, notification_meta_t **meta, void **user_data)
+static int fc_bit_return_invoke (const data_set_t __attribute__((unused)) *ds, /* {{{ */
+ value_list_t __attribute__((unused)) *vl,
+ notification_meta_t __attribute__((unused)) **meta,
+ void __attribute__((unused)) **user_data)
{
return (FC_TARGET_RETURN);
} /* }}} int fc_bit_return_invoke */
} /* }}} int fc_bit_write_destroy */
static int fc_bit_write_invoke (const data_set_t *ds, /* {{{ */
- value_list_t *vl, notification_meta_t **meta, void **user_data)
+ value_list_t *vl, notification_meta_t __attribute__((unused)) **meta,
+ void **user_data)
{
char **plugin_list;
int status;
diff --git a/src/ipmi.c b/src/ipmi.c
index 105907055824c883dc1b473674cb179cdc3e9f18..0b79823d50a13c1d497b540fc1c343c3e308779f 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
static void sensor_read_handler (ipmi_sensor_t *sensor,
int err,
enum ipmi_value_present_e value_present,
- unsigned int raw_value,
+ unsigned int __attribute__((unused)) raw_value,
double value,
- ipmi_states_t *states,
+ ipmi_states_t __attribute__((unused)) *states,
void *user_data)
{
value_t values[1];
* Entity handlers
*/
static void entity_sensor_update_handler (enum ipmi_update_e op,
- ipmi_entity_t *entity,
+ ipmi_entity_t __attribute__((unused)) *entity,
ipmi_sensor_t *sensor,
- void *user_data)
+ void __attribute__((unused)) *user_data)
{
/* TODO: Ignore sensors we cannot read */
* Domain handlers
*/
static void domain_entity_update_handler (enum ipmi_update_e op,
- ipmi_domain_t *domain,
+ ipmi_domain_t __attribute__((unused)) *domain,
ipmi_entity_t *entity,
- void *user_data)
+ void __attribute__((unused)) *user_data)
{
int status;
return (0);
} /* int thread_init */
-static void *thread_main (void *user_data)
+static void *thread_main (void __attribute__((unused)) *user_data)
{
int status;
os_handler_t *os_handler = NULL;
diff --git a/src/match_regex.c b/src/match_regex.c
index 9233d803ede5c4113333e38bef74732b6fbb5131..1fca88986331e1c4d30257e7e0e7d73dfb9dc7a2 100644 (file)
--- a/src/match_regex.c
+++ b/src/match_regex.c
return (0);
} /* }}} int mr_destroy */
-static int mr_match (const data_set_t *ds, const value_list_t *vl, /* {{{ */
- notification_meta_t **meta, void **user_data)
+static int mr_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
+ const value_list_t *vl,
+ notification_meta_t __attribute__((unused)) **meta,
+ void **user_data)
{
mr_match_t *m;
diff --git a/src/match_value.c b/src/match_value.c
index a3eeffd49c4813ad32418d702f327cdbb716df7b..9f02226bdae67109f94a4139cb2f6b60f26cdb34 100644 (file)
--- a/src/match_value.c
+++ b/src/match_value.c
} /* }}} int mv_destroy */
static int mv_match (const data_set_t *ds, const value_list_t *vl, /* {{{ */
- notification_meta_t **meta, void **user_data)
+ notification_meta_t __attribute__((unused)) **meta, void **user_data)
{
mv_match_t *m;
gauge_t *values;
diff --git a/src/netlink.c b/src/netlink.c
index d7d1a269f1de93c725b2cc0112bafe5962e103b7..8f45ea2e79334927b3b29942a3f33296bb9f2a6e 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
plugin_dispatch_values (&vl);
} /* void submit_two */
-static int link_filter (const struct sockaddr_nl *sa,
- struct nlmsghdr *nmh, void *args)
+static int link_filter (const struct sockaddr_nl __attribute__((unused)) *sa,
+ struct nlmsghdr *nmh, void __attribute__((unused)) *args)
{
struct ifinfomsg *msg;
int msg_len;
return (0);
} /* int link_filter */
-static int qos_filter (const struct sockaddr_nl *sa,
+static int qos_filter (const struct sockaddr_nl __attribute__((unused)) *sa,
struct nlmsghdr *nmh, void *args)
{
struct tcmsg *msg;
diff --git a/src/network.c b/src/network.c
index 34f89d96a39898cc4e27eb98024245fd686d1a65..e080000442f25f58aa5dda6f8b4c3a0b38d555bd 100644 (file)
--- a/src/network.c
+++ b/src/network.c
return (0);
} /* int network_get_listen_socket */
-static void *dispatch_thread (void *arg)
+static void *dispatch_thread (void __attribute__((unused)) *arg)
{
while (42)
{
return (0);
}
-static void *receive_thread (void *arg)
+static void *receive_thread (void __attribute__((unused)) *arg)
{
return (network_receive () ? (void *) 1 : (void *) 0);
} /* void *receive_thread */
* just send the buffer if `flush' is called - if the requested value was in
* there, good. If not, well, then there is nothing to flush.. -octo
*/
-static int network_flush (int timeout, const char *identifier)
+static int network_flush (int timeout,
+ const char __attribute__((unused)) *identifier)
{
pthread_mutex_lock (&send_buffer_lock);
diff --git a/src/nginx.c b/src/nginx.c
index 8cb762859b9a1f2bdafb521250c1d0b3fff0c664..dfa4f9832f0252acdfe789d5effc7e560ebcaa4c 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
-static size_t nginx_curl_callback (void *buf, size_t size, size_t nmemb, void *stream)
+static size_t nginx_curl_callback (void *buf, size_t size, size_t nmemb,
+ void __attribute__((unused)) *stream)
{
size_t len = size * nmemb;
diff --git a/src/notify_email.c b/src/notify_email.c
index dc4e47f73cc29990a46b3a0f9f6914f11b3e2a21..32bd91647a75f51089011b59e3759ec00c6f7f6a 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
/* Callback to get username and password */
static int authinteract (auth_client_request_t request, char **result,
- int fields, void *arg)
+ int fields, void __attribute__((unused)) *arg)
{
int i;
for (i = 0; i < fields; i++)
/* Callback to print the recipient status */
static void print_recipient_status (smtp_recipient_t recipient,
- const char *mailbox, void *arg)
+ const char *mailbox, void __attribute__((unused)) *arg)
{
const smtp_status_t *status;
} /* void print_recipient_status */
/* Callback to monitor SMTP activity */
-static void monitor_cb (const char *buf, int buflen, int writing, void *arg)
+static void monitor_cb (const char *buf, int buflen, int writing,
+ void __attribute__((unused)) *arg)
{
char log_str[MAXSTRING];
diff --git a/src/plugin.c b/src/plugin.c
index 4aabebe34c4927b7be782a1b7a531f9bd5938ea1..9d558cb1941f54df06ed2523398c0ae61abd4c62 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
return (0);
}
-static void *plugin_read_thread (void *args)
+static void *plugin_read_thread (void __attribute__((unused)) *args)
{
llentry_t *le;
read_func_t *rf;
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 95bde6941e459b03b68ab29da00d31c6b03ab34b..debb7bd4ff4416386d5881ec814e1dbd63f7313a 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
} /* int value_list_to_string */
static int value_list_to_filename (char *buffer, int buffer_len,
- const data_set_t *ds, const value_list_t *vl)
+ const data_set_t __attribute__((unused)) *ds, const value_list_t *vl)
{
int offset = 0;
int status;
return (0);
} /* int value_list_to_filename */
-static void *rrd_queue_thread (void *data)
+static void *rrd_queue_thread (void __attribute__((unused)) *data)
{
struct timeval tv_next_update;
struct timeval tv_now;
diff --git a/src/snmp.c b/src/snmp.c
index 44fce620e4f1d3ddca663237373802567b63fd08..82fd6583b075b5f243d06d6e85b9cb86803302a0 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
return (0);
} /* int csnmp_read_host */
-static void *csnmp_read_thread (void *data)
+static void *csnmp_read_thread (void __attribute__((unused)) *data)
{
host_definition_t *host;
index f77d33872076a901e48ce1fcf2ec624c2c623517..9ee1518a09e7791a89ee535a94a7b7da79ffa69b 100644 (file)
} /* }}} int tn_create */
static int tn_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */
- notification_meta_t **meta, void **user_data)
+ notification_meta_t __attribute__((unused)) **meta, void **user_data)
{
tn_data_t *data;
notification_t n;
diff --git a/src/target_replace.c b/src/target_replace.c
index 6e72f31bacf1613051de321c7eabff3eb0d222bc..3f983c860b0df520862940aca61c9f9b183cfc82 100644 (file)
--- a/src/target_replace.c
+++ b/src/target_replace.c
} /* }}} int tr_create */
static int tr_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */
- notification_meta_t **meta, void **user_data)
+ notification_meta_t __attribute__((unused)) **meta, void **user_data)
{
tr_data_t *data;
diff --git a/src/target_set.c b/src/target_set.c
index 70b0fdfc8c50164f294223336f06e40fa4c6e51f..19ff7b92ada29a39a1ed4da799515b0a57b525d1 100644 (file)
--- a/src/target_set.c
+++ b/src/target_set.c
} /* }}} int ts_create */
static int ts_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */
- notification_meta_t **meta, void **user_data)
+ notification_meta_t __attribute__((unused)) **meta, void **user_data)
{
ts_data_t *data;
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index e81dbe302bf40fa71b4c8880aa9caab8cf95ab8d..d4bf2aa40dcb1d3172fce8f6d4878f19461e296c 100644 (file)
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
@@ -406,7 +406,7 @@ static int tss2_select_vserver (FILE *read_fh, FILE *write_fh, vserver_list_t *v
} /* int tss2_select_vserver */
static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh,
- vserver_list_t *vserver, gauge_t *ret_value)
+ gauge_t *ret_value)
{
/*
* Reads the vserver's average packet loss and submits it to collectd.
* with an error. */
if ((status == 0) && (vserver != NULL))
{
- status = tss2_vserver_gapl (read_fh, write_fh, vserver, &packet_loss);
+ status = tss2_vserver_gapl (read_fh, write_fh, &packet_loss);
if (status == 0)
{
valid |= 0x20;
diff --git a/src/thermal.c b/src/thermal.c
index 79033b171bd393a4f456c4459533887372b69bf3..2ea6a24fb916719937376556f0bc8d3f6d3d7f41 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
plugin_dispatch_values (&vl);
}
-static int thermal_sysfs_device_read (const char *dir, const char *name,
- void *user_data)
+static int thermal_sysfs_device_read (const char __attribute__((unused)) *dir,
+ const char *name, void __attribute__((unused)) *user_data)
{
char filename[256];
char data[1024];
return ok ? 0 : -1;
}
-static int thermal_procfs_device_read (const char *dir, const char *name,
- void *user_data)
+static int thermal_procfs_device_read (const char __attribute__((unused)) *dir,
+ const char *name, void __attribute__((unused)) *user_data)
{
const char str_temp[] = "temperature:";
char filename[256];
diff --git a/src/unixsock.c b/src/unixsock.c
index 3bdd8c27b70cd35d58cee6e89b2f4d49d00252e1..57f34501f8f0dfd423c4c1c8435ea71e9caaf2bc 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
return ((void *) 0);
} /* void *us_handle_client */
-static void *us_server_thread (void *arg)
+static void *us_server_thread (void __attribute__((unused)) *arg)
{
int status;
int *remote_fd;
diff --git a/src/utils_dns.c b/src/utils_dns.c
index c16b3c12f78d6530443aedcc65ae6be2a1024768..b7dc79134ab6e48db7c8fcdc54a067c6061858de 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
@@ -337,9 +337,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
}
static int
-handle_dns(const char *buf, int len,
- const struct in6_addr *s_addr,
- const struct in6_addr *d_addr)
+handle_dns(const char *buf, int len)
{
rfc1035_header_t qh;
uint16_t us;
}
static int
-handle_udp(const struct udphdr *udp, int len,
- const struct in6_addr *s_addr,
- const struct in6_addr *d_addr)
+handle_udp(const struct udphdr *udp, int len)
{
char buf[PCAP_SNAPLEN];
if ((ntohs (udp->UDP_DEST) != 53)
&& (ntohs (udp->UDP_SRC) != 53))
return 0;
memcpy(buf, udp + 1, len - sizeof(*udp));
- if (0 == handle_dns(buf, len - sizeof(*udp), s_addr, d_addr))
+ if (0 == handle_dns(buf, len - sizeof(*udp)))
return 0;
return 1;
}
return (0);
memcpy (buf, (char *) ipv6 + offset, payload_len);
- if (handle_udp ((struct udphdr *) buf, payload_len, &s_addr, &d_addr) == 0)
+ if (handle_udp ((struct udphdr *) buf, payload_len) == 0)
return (0);
return (1); /* Success */
if (IPPROTO_UDP != ip->ip_p)
return 0;
memcpy(buf, (void *) ip + offset, len - offset);
- if (0 == handle_udp((struct udphdr *) buf, len - offset, &s_addr, &d_addr))
+ if (0 == handle_udp((struct udphdr *) buf, len - offset))
return 0;
return 1;
}
diff --git a/src/utils_match.c b/src/utils_match.c
index 9e75e4e2bdfacfe4dee2a67fc117809ac9fd1792..906d7c70d6feb8217f65a375dbfea80499eef622 100644 (file)
--- a/src/utils_match.c
+++ b/src/utils_match.c
return (ret);
} /* char *match_substr */
-static int default_callback (const char *str,
+static int default_callback (const char __attribute__((unused)) *str,
char * const *matches, size_t matches_num, void *user_data)
{
cu_match_value_t *data = (cu_match_value_t *) user_data;
diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c
index 26e9531119e5f0717ecb022ef90e1346bebf5e3b..ae1f4f75d3fa30130151689598ab8dadd6ad5120 100644 (file)
--- a/src/utils_tail_match.c
+++ b/src/utils_tail_match.c
return (0);
} /* int simple_submit_match */
-static int tail_callback (void *data, char *buf, int buflen)
+static int tail_callback (void *data, char *buf,
+ int __attribute__((unused)) buflen)
{
cu_tail_match_t *obj = (cu_tail_match_t *) data;
int i;
diff --git a/src/utils_threshold.c b/src/utils_threshold.c
index fd6257c5a0cb9c2f4a0fc884d88a060c677c85aa..1b211385554b62ed8cec1bbc5f67aadbfb19a149 100644 (file)
--- a/src/utils_threshold.c
+++ b/src/utils_threshold.c
* Does not fail.
*/
static int ut_check_one_data_source (const data_set_t *ds,
- const value_list_t *vl,
+ const value_list_t __attribute__((unused)) *vl,
const threshold_t *th,
const gauge_t *values,
int ds_index)