Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86313 - in trunk: boost/predef/os libs/predef/test
From: grafikrobot_at_[hidden]
Date: 2013-10-15 00:23:53


Author: grafik
Date: 2013-10-15 00:23:53 EDT (Tue, 15 Oct 2013)
New Revision: 86313
URL: http://svn.boost.org/trac/boost/changeset/86313

Log:
More stringent testing of OSX BSD like behavior. Fix BSD mis-detection on OSX depending on include order.

Text files modified:
   trunk/boost/predef/os/bsd.h | 7 +++++++
   trunk/libs/predef/test/macos_endian.c | 5 +++--
   trunk/libs/predef/test/macos_vs_bsd.c | 9 ++++-----
   3 files changed, 14 insertions(+), 7 deletions(-)

Modified: trunk/boost/predef/os/bsd.h
==============================================================================
--- trunk/boost/predef/os/bsd.h Tue Oct 15 00:02:57 2013 (r86312)
+++ trunk/boost/predef/os/bsd.h 2013-10-15 00:23:53 EDT (Tue, 15 Oct 2013) (r86313)
@@ -8,6 +8,13 @@
 #ifndef BOOST_PREDEF_OS_BSD_H
 #define BOOST_PREDEF_OS_BSD_H
 
+/* Special case: OSX will define BSD predefs if the sys/param.h
+ * header is included. We can guard against that, but only if we
+ * detect OSX first. Hence we will force include OSX detection
+ * before doing any BSD detection.
+ */
+#include <boost/predef/os/macos.h>
+
 #include <boost/predef/version_number.h>
 #include <boost/predef/make.h>
 

Modified: trunk/libs/predef/test/macos_endian.c
==============================================================================
--- trunk/libs/predef/test/macos_endian.c Tue Oct 15 00:02:57 2013 (r86312)
+++ trunk/libs/predef/test/macos_endian.c 2013-10-15 00:23:53 EDT (Tue, 15 Oct 2013) (r86313)
@@ -12,9 +12,10 @@
  * tests that the sys/param.h include can be included before
  * endian detection and still have it work correctly.
  */
-#include <boost/predef/os/macos.h>
 
-#if BOOST_OS_MACOS
+#if defined(__APPLE__)
 # include <sys/param.h>
+# include <boost/predef/os/bsd.h>
+# include <boost/predef/os/macos.h>
 # include <boost/predef/other/endian.h>
 #endif

Modified: trunk/libs/predef/test/macos_vs_bsd.c
==============================================================================
--- trunk/libs/predef/test/macos_vs_bsd.c Tue Oct 15 00:02:57 2013 (r86312)
+++ trunk/libs/predef/test/macos_vs_bsd.c 2013-10-15 00:23:53 EDT (Tue, 15 Oct 2013) (r86313)
@@ -9,12 +9,11 @@
  * OSX can masquerade as BSD when sys/param.h is previously included.
  * So we test that we only detect OSX in this combination.
  */
-#include <boost/predef/os/macos.h>
-
-#if BOOST_OS_MACOS
+#if defined(__APPLE__)
 # include <sys/param.h>
 # include <boost/predef/os/bsd.h>
-# if BOOST_OS_BSD
-# error "Both BOOST_OS_MACOS and BOOST_OS_BSD defined."
+# include <boost/predef/os/macos.h>
+# if !BOOST_OS_MACOS || BOOST_OS_BSD
+# error "BOOST_OS_MACOS not detected and/or BOOST_OS_BSD mis-detected."
 # endif
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk