From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: "Jan Kiszka" <jan.kiszka@siemens.com>,
"Andreas Färber" <andreas.faerber@web.de>
Subject: [Qemu-devel] [PATCH for-1.1? v2] slirp: Avoid statements without effect on Big Endian host
Date: Sun, 27 May 2012 18:42:19 +0200 [thread overview]
Message-ID: <1338136940-53279-1-git-send-email-andreas.faerber@web.de> (raw)
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 <andreas.faerber@web.de>
---
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
next reply other threads:[~2012-05-27 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-27 16:42 Andreas Färber [this message]
2012-05-27 22:10 ` [Qemu-devel] [PATCH for-1.1? v2] slirp: Avoid statements without effect on Big Endian host Peter Maydell
2012-05-28 11:47 ` Jan Kiszka
2012-05-28 12:00 ` Peter Maydell
2012-05-28 14:06 ` Andreas Färber
2012-05-28 15:18 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338136940-53279-1-git-send-email-andreas.faerber@web.de \
--to=andreas.faerber@web.de \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).