From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYgY4-0000xQ-N7 for qemu-devel@nongnu.org; Sun, 27 May 2012 12:42:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYgY3-0004ni-0C for qemu-devel@nongnu.org; Sun, 27 May 2012 12:42:32 -0400 Received: from mout.web.de ([212.227.15.4]:53695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYgY2-0004nX-NE for qemu-devel@nongnu.org; Sun, 27 May 2012 12:42:30 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 27 May 2012 18:42:19 +0200 Message-Id: <1338136940-53279-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH for-1.1? v2] slirp: Avoid statements without effect on Big Endian host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= Darwin has HTON*/NTOH* macros that on BE simply return the argument. This is incompatible with SLIRP's use of these macros as a statement. Special-case Darwin in the HOST_WORDS_BIGENDIAN code path to redefine these macros as no-op statement to avoid tons of compiler warnings. Also adapt the fallback definitions. Signed-off-by: Andreas Färber --- slirp/ip.h | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/slirp/ip.h b/slirp/ip.h index 88c903f..ddf9e9e 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -34,17 +34,28 @@ #define _IP_H_ #ifdef HOST_WORDS_BIGENDIAN -# ifndef NTOHL -# define NTOHL(d) -# endif -# ifndef NTOHS -# define NTOHS(d) -# endif -# ifndef HTONL -# define HTONL(d) -# endif -# ifndef HTONS -# define HTONS(d) +# if defined(__APPLE__) +# undef NTOHL +# undef NTOHS +# undef HTONL +# undef HTONS +# define NTOHL(d) do { } while (0) +# define NTOHS(d) do { } while (0) +# define HTONL(d) do { } while (0) +# define HTONS(d) do { } while (0) +# else +# ifndef NTOHL +# define NTOHL(d) do { } while (0) +# endif +# ifndef NTOHS +# define NTOHS(d) do { } while (0) +# endif +# ifndef HTONL +# define HTONL(d) do { } while (0) +# endif +# ifndef HTONS +# define HTONS(d) do { } while (0) +# endif # endif #else # ifndef NTOHL -- 1.7.5.3