Skip to contentSkip to conversation

bswap: Fix build on FreeBSD 10.0

RFC In review Andreas Färber 3 participants 3 messages Apr 2, 2014

lore
Share & tools
lore
#0 lore raw

RFC 1/1 bswap: Fix build on FreeBSD 10.0

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.

---
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(+)
include/qemu/bswap.h +2 -0
index 0cb7c05..0f9c6cf 100644
@@ -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>
 
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 9 lines · Andreas Färber

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.

---
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~

#2 lore raw
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Andreas Färber

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.

Quoted 7 lines
Quoted 4 lines

---
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