From a46b8bd2c2c3683d1aa40656123c7f15d6a53b3c Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Mon, 3 Oct 2011 15:25:26 +0900 Subject: [PATCH] Fix GCC warnings. --- configure.ac | 9 +++++++++ src/config.h.in | 11 +++++++++++ src/connection.c | 3 +-- src/irc.c | 6 ++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 2c36352..c203dc3 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,15 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T +AX_C___ATTRIBUTE__ +AH_BOTTOM([ +/* Unused attributes such as function parameters (GCC extension) */ +#ifdef HAVE___ATTRIBUTE__ +# define UNUSED(ATTRIBUTE) ATTRIBUTE __attribute__((unused)) +#else +# define UNUSED(ATTRIBUTE) ATTRIBUTE +#endif]) + # Checks for library functions. AC_FUNC_FORK AC_FUNC_MALLOC diff --git a/src/config.h.in b/src/config.h.in index 8f0423e..e41200e 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -161,6 +161,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* define if your compiler has __attribute__ */ +#undef HAVE___ATTRIBUTE__ + /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O @@ -263,3 +266,11 @@ /* Define as `fork' if `vfork' does not work. */ #undef vfork + + +/* Unused attributes such as function parameters (GCC extension) */ +#ifdef HAVE___ATTRIBUTE__ +# define UNUSED(ATTRIBUTE) ATTRIBUTE __attribute__((unused)) +#else +# define UNUSED(ATTRIBUTE) ATTRIBUTE +#endif diff --git a/src/connection.c b/src/connection.c index f9cb51d..07ab431 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1090,8 +1090,7 @@ static DH *dh_1024(void) } /* ripped from postfix's tls_dh.c */ -static DH *tmp_dh_cb(SSL *ssl_unused __attribute__((unused)), - int export, int keylength) +static DH *tmp_dh_cb(UNUSED(SSL *ssl_unused), int export, int keylength) { DH *ret; diff --git a/src/irc.c b/src/irc.c index f630940..ebc1b34 100644 --- a/src/irc.c +++ b/src/irc.c @@ -308,8 +308,7 @@ static int irc_352(struct link_server *server, struct line *line) return OK_COPY_WHO; } -static int irc_315(struct link_server *server, - struct line *l __attribute__((unused))) +static int irc_315(struct link_server *server, UNUSED(struct line *l)) { struct link *link = LINK(server); if (link->who_client) { @@ -1455,8 +1454,7 @@ static int irc_367(struct link_server *server, struct line *l) } /* same as irc_315 */ -static int irc_368(struct link_server *server, - struct line *l __attribute__((unused))) +static int irc_368(struct link_server *server, UNUSED(struct line *l)) { struct link *link = LINK(server); if (link->who_client) {