[ovs-dev] [PATCH 1/2] osx: Fix OS X build issues

Lance Richardson lrichard at redhat.com
Wed Mar 23 20:04:46 UTC 2016


Newer versions of OS X define ntohll() and htonll() macros,
while older versions (including the version used for travis-ci
builds) do not.  Adjust conditional compilation test to work
for both cases.

Eliminate an unused variable warning in lib/rtbsd.c.

Signed-off-by: Lance Richardson <lrichard at redhat.com>
---
 lib/byte-order.h | 4 ++--
 lib/rtbsd.c      | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/byte-order.h b/lib/byte-order.h
index 41c3931..0437d4e 100644
--- a/lib/byte-order.h
+++ b/lib/byte-order.h
@@ -22,7 +22,7 @@
 #include "openvswitch/types.h"
 
 #ifndef __CHECKER__
-#if !(defined(_WIN32) || defined(__MACH__))
+#if !(defined(_WIN32) || defined(htonll))
 static inline ovs_be64
 htonll(uint64_t n)
 {
@@ -34,7 +34,7 @@ ntohll(ovs_be64 n)
 {
     return htonl(1) == 1 ? n : ((uint64_t) ntohl(n) << 32) | ntohl(n >> 32);
 }
-#endif /* !(defined(_WIN32) || defined(__MACH__)) */
+#endif /* !(defined(_WIN32) || defined(htonll)) */
 #else
 /* Making sparse happy with these functions also makes them unreadable, so
  * don't bother to show it their implementations. */
diff --git a/lib/rtbsd.c b/lib/rtbsd.c
index fe4c55c..df708c5 100644
--- a/lib/rtbsd.c
+++ b/lib/rtbsd.c
@@ -170,7 +170,9 @@ rtbsd_report_change(const struct if_msghdr *msg)
 {
     struct rtbsd_notifier *notifier;
     struct rtbsd_change change;
+#ifndef __MACH__
     const struct if_announcemsghdr *ahdr;
+#endif
 
     COVERAGE_INC(rtbsd_changed);
 
-- 
2.5.5




More information about the dev mailing list