mirror of
https://github.com/boostorg/predef.git
synced 2026-02-22 03:32:18 +00:00
Add endian.h header for byte order detection. Ensure that headers can be
included individually.
This commit is contained in:
@@ -13,5 +13,6 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/predef/compiler.h>
|
||||
#include <boost/predef/library.h>
|
||||
#include <boost/predef/os.h>
|
||||
#include <boost/predef/endian.h>
|
||||
|
||||
#endif
|
||||
|
||||
130
include/boost/predef/endian.h
Normal file
130
include/boost/predef/endian.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_ENDIAN_H
|
||||
#define BOOST_PREDEF_ENDIAN_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/library/c.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_ENDIAN_BIG_BYTE`, `BOOST_ENDIAN_LITTLE_BYTE`, `BOOST_ENDIAN_BIG_WORD`, `BOOST_ENDIAN_LITTLE_WORD`]
|
||||
|
||||
Detection of endian memory ordering.
|
||||
*/
|
||||
|
||||
#define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
/* GNU libc provides a header defining __BYT_ORDER. */
|
||||
#if BOOST_LIB_C_GNU
|
||||
# include <endian.h>
|
||||
#endif
|
||||
|
||||
/* GNU libc style __BYTE_ORDER macros. */
|
||||
#if defined(__BYTE_ORDER)
|
||||
# if (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
# undef BOOST_ENDIAN_BIG_BYTE
|
||||
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# undef BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
# if (__BYTE_ORDER == __PDP_ENDIAN)
|
||||
# undef BOOST_ENDIAN_LITTLE_WORD
|
||||
# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Built-in byte-swpped big-endian macros. */
|
||||
#if !BOOST_ENDIAN_BIG_BYTE
|
||||
# if defined(__BIG_ENDIAN__) || \
|
||||
defined(__ARMEB__) || \
|
||||
defined(__THUMBEB__) || \
|
||||
defined(__AARCH64EB__) || \
|
||||
defined(_MIPSEB) || \
|
||||
defined(__MIPSEB) || \
|
||||
defined(__MIPSEB__)
|
||||
# undef BOOST_ENDIAN_BIG_BYTE
|
||||
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Built-in byte-swapped little-endian macros. */
|
||||
#if !BOOST_ENDIAN_LITTLE_BYTE
|
||||
# if defined(__LITTLE_ENDIAN__) || \
|
||||
defined(__ARMEL__) || \
|
||||
defined(__THUMBEL__) || \
|
||||
defined(__AARCH64EL__) || \
|
||||
defined(_MIPSEL) || \
|
||||
defined(__MIPSEL) || \
|
||||
defined(__MIPSEL__)
|
||||
# undef BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some architectures are strictly one endianess (as opposed
|
||||
* the current common bi-endianess).
|
||||
*/
|
||||
#if !BOOST_ENDIAN_BIG_BYTE && \
|
||||
!BOOST_ENDIAN_BIG_WORD && \
|
||||
!BOOST_ENDIAN_LITTLE_BYTE && \
|
||||
!BOOST_ENDIAN_LITTLE_WORD
|
||||
# include <boost/predef/architecture.h>
|
||||
# if BOOST_ARCH_M68K || \
|
||||
BOOST_ARCH_PARISK || \
|
||||
BOOST_ARCH_SYS370 || \
|
||||
BOOST_ARCH_SYS390 || \
|
||||
BOOST_ARCH_Z
|
||||
# undef BOOST_ENDIAN_BIG_BYTE
|
||||
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
# if BOOST_ARCH_AMD64 || \
|
||||
BOOST_ARCH_IA64 || \
|
||||
BOOST_ARCH_X86
|
||||
# undef BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_ENDIAN_BIG_BYTE
|
||||
# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE
|
||||
#endif
|
||||
#if BOOST_ENDIAN_BIG_WORD_BYTE
|
||||
# define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE
|
||||
#endif
|
||||
#if BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE
|
||||
#endif
|
||||
#if BOOST_ENDIAN_LITTLE_WORD_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian"
|
||||
#define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian"
|
||||
#define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian"
|
||||
#define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian"
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME)
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME)
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME)
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME)
|
||||
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_H
|
||||
|
||||
#include <boost/predef/detail/_cassert.h>
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#include <boost/predef/library/c/gnu.h>
|
||||
#include <boost/predef/library/c/uc.h>
|
||||
|
||||
13
include/boost/predef/library/c/_prefix.h
Normal file
13
include/boost/predef/library/c/_prefix.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
Copyright Redshift Software, Inc. 2008-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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C__PREFIX_H
|
||||
#define BOOST_PREDEF_LIBRARY_C__PREFIX_H
|
||||
|
||||
#include <boost/predef/detail/_cassert.h>
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#if defined(__STDC__)
|
||||
#include <stddef.h>
|
||||
#elif defined(__cplusplus)
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_UC_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_UC_H
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_VMS_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_VMS_H
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_ZOS_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_ZOS_H
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright Redshift Software, Inc. 2008-2012
|
||||
Copyright Redshift Software, Inc. 2008-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)
|
||||
@@ -7,41 +7,17 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_H
|
||||
|
||||
/*
|
||||
We need to include an STD header to gives us the context
|
||||
of which library we are using. The "smallest" code-wise header
|
||||
seems to be <exception>. Boost uses <utility> but as far
|
||||
as I can tell (RR) it's not a standalone header in most
|
||||
implementations. Using <exception> also has the benefit of
|
||||
being available in EC++, so we get a chance to make this work
|
||||
for embedded users. And since it's not a header impacted by TR1
|
||||
there's no magic needed for inclusion in the face of the
|
||||
Boost.TR1 library.
|
||||
*/
|
||||
#include <boost/predef/detail/_exception.h>
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
/*
|
||||
STLPort library; this _must_ come first, otherwise since
|
||||
STLport typically sits on top of some other library, we
|
||||
can end up detecting that first rather than STLport:
|
||||
*/
|
||||
#include <boost/predef/library/std/stlport.h>
|
||||
|
||||
/*
|
||||
The rest in alpha order, except for Dinkumware.
|
||||
*/
|
||||
#include <boost/predef/library/std/cxx.h>
|
||||
#include <boost/predef/library/std/dinkumware.h>
|
||||
#include <boost/predef/library/std/libcomo.h>
|
||||
#include <boost/predef/library/std/modena.h>
|
||||
#include <boost/predef/library/std/msl.h>
|
||||
#include <boost/predef/library/std/roguewave.h>
|
||||
#include <boost/predef/library/std/sgi.h>
|
||||
#include <boost/predef/library/std/stdcpp3.h>
|
||||
#include <boost/predef/library/std/stlport.h>
|
||||
#include <boost/predef/library/std/vacpp.h>
|
||||
|
||||
/*
|
||||
Dinkumware Library (this has to appear after any possible replacement libraries):
|
||||
*/
|
||||
#include <boost/predef/library/std/dinkumware.h>
|
||||
|
||||
#endif
|
||||
|
||||
23
include/boost/predef/library/std/_prefix.h
Normal file
23
include/boost/predef/library/std/_prefix.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright Redshift Software, Inc. 2008-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)
|
||||
*/
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD__PREFIX_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD__PREFIX_H
|
||||
|
||||
/*
|
||||
We need to include an STD header to gives us the context
|
||||
of which library we are using. The "smallest" code-wise header
|
||||
seems to be <exception>. Boost uses <utility> but as far
|
||||
as I can tell (RR) it's not a stand-alone header in most
|
||||
implementations. Using <exception> also has the benefit of
|
||||
being available in EC++, so we get a chance to make this work
|
||||
for embedded users. And since it's not a header impacted by TR1
|
||||
there's no magic needed for inclusion in the face of the
|
||||
Boost.TR1 library.
|
||||
*/
|
||||
#include <boost/predef/detail/_exception.h>
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_CXX_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_CXX_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_MODENA_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_MODENA_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_MSL_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_MSL_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_SGI_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_SGI_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_STDCPP3_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_STDCPP3_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_STLPORT_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_STLPORT_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_VACPP_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_VACPP_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user