* [Qemu-devel] [PATCH for-1.1?] slirp: Avoid statements without effect on Big Endian host
@ 2012-05-27 16:32 Andreas Färber
2012-05-27 16:39 ` Andreas Färber
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2012-05-27 16:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Kiszka, Andreas Färber
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.
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..6e98b1d 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)
+# endif
+# ifndef NTOHS
+# define NTOHS(d)
+# endif
+# ifndef HTONL
+# define HTONL(d)
+# endif
+# ifndef HTONS
+# define HTONS(d)
+# endif
# endif
#else
# ifndef NTOHL
--
1.7.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.1?] slirp: Avoid statements without effect on Big Endian host
2012-05-27 16:32 [Qemu-devel] [PATCH for-1.1?] slirp: Avoid statements without effect on Big Endian host Andreas Färber
@ 2012-05-27 16:39 ` Andreas Färber
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Färber @ 2012-05-27 16:39 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
Am 27.05.2012 18:32, schrieb Andreas Färber:
> 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.
>
> 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..6e98b1d 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)
> +# endif
> +# ifndef NTOHS
> +# define NTOHS(d)
> +# endif
> +# ifndef HTONL
> +# define HTONL(d)
> +# endif
> +# ifndef HTONS
> +# define HTONS(d)
> +# endif
Ahem, these would have the same issue. v2 coming up.
Andreas
> # endif
> #else
> # ifndef NTOHL
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-27 16:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 16:32 [Qemu-devel] [PATCH for-1.1?] slirp: Avoid statements without effect on Big Endian host Andreas Färber
2012-05-27 16:39 ` Andreas Färber
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).