Add UNUSED macro that expands to a parameter attribute annotation on
authorMartin Pool <mbp@samba.org>
Sat, 23 Feb 2002 00:17:50 +0000 (00:17 +0000)
committerMartin Pool <mbp@samba.org>
Sat, 23 Feb 2002 00:17:50 +0000 (00:17 +0000)
gcc, to quieten its worries about parameters that must always be
unused.

main.c
rsync.h

diff --git a/main.c b/main.c
index be8d0c2..74d205f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -786,17 +786,17 @@ static int start_client(int argc, char *argv[])
 }
 
 
 }
 
 
-static RETSIGTYPE sigusr1_handler(int val) {
+static RETSIGTYPE sigusr1_handler(int UNUSED(val)) {
        exit_cleanup(RERR_SIGNAL);
 }
 
        exit_cleanup(RERR_SIGNAL);
 }
 
-static RETSIGTYPE sigusr2_handler(int val) {
+static RETSIGTYPE sigusr2_handler(int UNUSED(val)) {
        extern int log_got_error;
        if (log_got_error) _exit(RERR_PARTIAL);
        _exit(0);
 }
 
        extern int log_got_error;
        if (log_got_error) _exit(RERR_PARTIAL);
        _exit(0);
 }
 
-static RETSIGTYPE sigchld_handler(int val) {
+static RETSIGTYPE sigchld_handler(int UNUSED(val)) {
 #ifdef WNOHANG
        while (waitpid(-1, NULL, WNOHANG) > 0) ;
 #endif
 #ifdef WNOHANG
        while (waitpid(-1, NULL, WNOHANG) > 0) ;
 #endif
diff --git a/rsync.h b/rsync.h
index 2bfe250..449ce09 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -609,3 +609,9 @@ inet_ntop(int af, const void *src, char *dst, size_t size);
 #ifndef HAVE_INET_PTON
 int isc_net_pton(int af, const char *src, void *dst);
 #endif
 #ifndef HAVE_INET_PTON
 int isc_net_pton(int af, const char *src, void *dst);
 #endif
+
+#ifdef __GNUC__
+#  define UNUSED(x) x __attribute__((__unused__))
+#else
+#  define UNUSED(x) x
+#endif /* ndef __GNUC__ */