forked from boostorg/predef
Address endian compile errors for OSX in the cases where sys/param.h was
include ahead of the predef headers. The solution was to: use the OSX machine/endian.h header, and only allow a single OS to be detected at once. Test cases added for both conditions on OSX.
This commit is contained in:
@@ -43,4 +43,6 @@ test-suite predef :
|
||||
[ run info_as_objc.m : : : <test-info>always_show_run_output ]
|
||||
[ run version.cpp ]
|
||||
[ run make.cpp ]
|
||||
[ compile macos_endian.c ]
|
||||
[ compile macos_vs_bsd.c ]
|
||||
;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright Redshift Software Inc. 2013
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSX can define the BSD symbols if sys/param.h is included
|
||||
* before detection. This causes the endian detection to misfire
|
||||
* as both MACOS and BSD are "detected" (currently). This just
|
||||
* 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
|
||||
# include <sys/param.h>
|
||||
# include <boost/predef/other/endian.h>
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright Redshift Software Inc. 2013
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
# include <sys/param.h>
|
||||
# include <boost/predef/os/bsd.h>
|
||||
# if BOOST_OS_BSD
|
||||
# error "Both BOOST_OS_MACOS and BOOST_OS_BSD defined."
|
||||
# endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user