From 5ef8f5ead2478defca69e303a47d00d21b16d838 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 25 May 2011 11:19:10 +0200 Subject: [PATCH] compiler warning: fix Fix compiler warning: variable was set but never used Fix compiler warning: clobber ignored --- acountry.c | 1 + adig.c | 1 + ahost.c | 1 + ares_fds.c | 1 + ares_nowarn.c | 30 ++++++++++++++++++++++++++++++ ares_nowarn.h | 21 ++++++++++++++++++++- ares_process.c | 1 + 7 files changed, 55 insertions(+), 1 deletion(-) diff --git a/acountry.c b/acountry.c index 4c2816a..d989018 100644 --- a/acountry.c +++ b/acountry.c @@ -59,6 +59,7 @@ #include "ares_getopt.h" #include "inet_net_pton.h" #include "inet_ntop.h" +#include "ares_nowarn.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" diff --git a/adig.c b/adig.c index 8b5c883..9e3c553 100644 --- a/adig.c +++ b/adig.c @@ -57,6 +57,7 @@ #include "inet_ntop.h" #include "inet_net_pton.h" #include "ares_getopt.h" +#include "ares_nowarn.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" diff --git a/ahost.c b/ahost.c index 6a4843e..fb67f1f 100644 --- a/ahost.c +++ b/ahost.c @@ -42,6 +42,7 @@ #include "inet_net_pton.h" #include "ares_getopt.h" #include "ares_ipv6.h" +#include "ares_nowarn.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" diff --git a/ares_fds.c b/ares_fds.c index b57be92..ac5eedb 100644 --- a/ares_fds.c +++ b/ares_fds.c @@ -21,6 +21,7 @@ #endif #include "ares.h" +#include "ares_nowarn.h" #include "ares_private.h" int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) diff --git a/ares_nowarn.c b/ares_nowarn.c index 0c77771..bc2c5da 100644 --- a/ares_nowarn.c +++ b/ares_nowarn.c @@ -21,6 +21,8 @@ # include #endif +#define BUILDING_ARES_NOWARN_C 1 + #include "ares_nowarn.h" #if (SIZEOF_INT == 2) @@ -111,3 +113,31 @@ unsigned int aresx_sztoui(ssize_t sznum) # pragma warning(pop) #endif } + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int aresx_FD_ISSET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + return FD_ISSET(fd, fdset); + #pragma warning(pop) +} + +void aresx_FD_SET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + FD_SET(fd, fdset); + #pragma warning(pop) +} + +void aresx_FD_ZERO(fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:593) /* variable was set but never used */ + FD_ZERO(fdset); + #pragma warning(pop) +} + +#endif /* __INTEL_COMPILER && __unix__ */ diff --git a/ares_nowarn.h b/ares_nowarn.h index 6aa478f..0cc204c 100644 --- a/ares_nowarn.h +++ b/ares_nowarn.h @@ -2,7 +2,7 @@ #define HEADER_CARES_NOWARN_H -/* Copyright (C) 2010 by Daniel Stenberg +/* Copyright (C) 2010-2011 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -25,4 +25,23 @@ int aresx_sztosi(ssize_t sznum); unsigned int aresx_sztoui(ssize_t sznum); +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int aresx_FD_ISSET(int fd, fd_set *fdset); + +void aresx_FD_SET(int fd, fd_set *fdset); + +void aresx_FD_ZERO(fd_set *fdset); + +#ifndef BUILDING_ARES_NOWARN_C +# undef FD_ISSET +# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b)) +# undef FD_SET +# define FD_SET(a,b) aresx_FD_SET((a),(b)) +# undef FD_ZERO +# define FD_ZERO(a) aresx_FD_ZERO((a)) +#endif + +#endif /* __INTEL_COMPILER && __unix__ */ + #endif /* HEADER_CARES_NOWARN_H */ diff --git a/ares_process.c b/ares_process.c index f5e7d25..e5efa5f 100644 --- a/ares_process.c +++ b/ares_process.c @@ -66,6 +66,7 @@ #include "ares.h" #include "ares_dns.h" +#include "ares_nowarn.h" #include "ares_private.h"