diff mbox

[RFC,for-2.0] bswap: Fix build on FreeBSD 10.0

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

Commit Message

Andreas Färber April 2, 2014, 2:06 p.m. UTC
FreeBSD 10.0-RELEASE has bswap16() etc. macros defined in sys/endian.h,
which leads to a conflict with our static inline definitions.

Force using the system version of the macros.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 On 9.0-RELEASE I did not have this issue, so unsure if some version check
 is needed or some more generic configure check?

 include/qemu/bswap.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Richard Henderson April 2, 2014, 6:52 p.m. UTC | #1
On 04/02/2014 07:06 AM, Andreas Färber wrote:
> FreeBSD 10.0-RELEASE has bswap16() etc. macros defined in sys/endian.h,
> which leads to a conflict with our static inline definitions.
> 
> Force using the system version of the macros.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  On 9.0-RELEASE I did not have this issue, so unsure if some version check
>  is needed or some more generic configure check?

Looks plausible, but I have no bsd specific experience.
I'd say if it works for both 9.0 and 10.0, let it go in as is.


r~
Ed Maste April 2, 2014, 8:57 p.m. UTC | #2
On 2 April 2014 14:52, Richard Henderson <rth@twiddle.net> wrote:
> On 04/02/2014 07:06 AM, Andreas Färber wrote:
>> FreeBSD 10.0-RELEASE has bswap16() etc. macros defined in sys/endian.h,
>> which leads to a conflict with our static inline definitions.
>>
>> Force using the system version of the macros.
>>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> ---
>>  On 9.0-RELEASE I did not have this issue, so unsure if some version check
>>  is needed or some more generic configure check?
>
> Looks plausible, but I have no bsd specific experience.
> I'd say if it works for both 9.0 and 10.0, let it go in as is.

This change builds fine for me on FreeBSD 9.

-Ed
diff mbox

Patch

diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index 0cb7c05..0f9c6cf 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -11,6 +11,8 @@ 
 # include <sys/endian.h>
 # include <sys/types.h>
 # include <machine/bswap.h>
+#elif defined(__FreeBSD__)
+# include <sys/endian.h>
 #elif defined(CONFIG_BYTESWAP_H)
 # include <byteswap.h>