diff mbox

[for-1.1,v3] slirp: Avoid statements without effect on Big Endian host

Message ID 1338226460-87965-1-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber May 28, 2012, 5:34 p.m. UTC
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.

Undefine the macros in the HOST_WORDS_BIGENDIAN code path to redefine
these macros as no-op, as already done when they were undefined.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 slirp/ip.h |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

Comments

Jan Kiszka May 28, 2012, 8:40 p.m. UTC | #1
On 2012-05-28 19:34, Andreas Färber wrote:
> 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.
> 
> Undefine the macros in the HOST_WORDS_BIGENDIAN code path to redefine
> these macros as no-op, as already done when they were undefined.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  slirp/ip.h |   20 ++++++++------------
>  1 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/slirp/ip.h b/slirp/ip.h
> index 88c903f..e2ee5e3 100644
> --- a/slirp/ip.h
> +++ b/slirp/ip.h
> @@ -34,18 +34,14 @@
>  #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)
> -# endif
> +# undef NTOHL
> +# undef NTOHS
> +# undef HTONL
> +# undef HTONS
> +# define NTOHL(d)
> +# define NTOHS(d)
> +# define HTONL(d)
> +# define HTONS(d)
>  #else
>  # ifndef NTOHL
>  #  define NTOHL(d) ((d) = ntohl((d)))

Thanks, queued for 1.1.

Jan
diff mbox

Patch

diff --git a/slirp/ip.h b/slirp/ip.h
index 88c903f..e2ee5e3 100644
--- a/slirp/ip.h
+++ b/slirp/ip.h
@@ -34,18 +34,14 @@ 
 #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)
-# endif
+# undef NTOHL
+# undef NTOHS
+# undef HTONL
+# undef HTONS
+# define NTOHL(d)
+# define NTOHS(d)
+# define HTONL(d)
+# define HTONS(d)
 #else
 # ifndef NTOHL
 #  define NTOHL(d) ((d) = ntohl((d)))