forked from boostorg/predef
Completed all changes from review.
This commit is contained in:
1 parent
c22d44d0ce
commit
b10e3490ec
25 files changed
+639
-1670
No files matched your search
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
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/gnu.h>
|
||||
#include <boost/predef/os/bsd.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_ENDIAN_*`]
|
||||
|
||||
Detection of endian memory ordering. There are four defined macros
|
||||
in this header that define the various generally possible endian
|
||||
memory orderings:
|
||||
|
||||
* `BOOST_ENDIAN_BIG_BYTE`, byte-swapped big-endian.
|
||||
* `BOOST_ENDIAN_BIG_WORD`, word-swapped big-endian.
|
||||
* `BOOST_ENDIAN_LITTLE_BYTE`, byte-swapped little-endian.
|
||||
* `BOOST_ENDIAN_LITTLE_WORD`, word-swapped little-endian.
|
||||
|
||||
The detection is conservative in that it only identifies endianness
|
||||
that it knows for certain. In particular bi-endianness is not
|
||||
indicated as is it not practically possible to determine the
|
||||
endianness from anything but an operating system provided
|
||||
header. And the currently known headers do not define that
|
||||
programatic bi-endianness is available.
|
||||
|
||||
This implementation is a compilation of various publicly available
|
||||
information and acquired knowledge:
|
||||
|
||||
# The indispensable documentation of "Pre-defined Compiler Macros"
|
||||
[@http://sourceforge.net/p/predef/wiki/Endianness Endianness].
|
||||
# The various endian specifications available in the
|
||||
[@http://wikipedia.org/ Wikipedia] computer architecture pages.
|
||||
# Generally available searches for headers that define endianness.
|
||||
*/
|
||||
|
||||
#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 __BYTE_ORDER, or _BYTE_ORDER.
|
||||
*/
|
||||
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
|
||||
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
|
||||
# if BOOST_LIB_C_GNU
|
||||
# include <endian.h>
|
||||
# else
|
||||
# if BOOST_OS_BSD
|
||||
# if BOOST_OS_BSD_OPEN
|
||||
# include <machine/endian.h>
|
||||
# else
|
||||
# include <sys/endian.h>
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# 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
|
||||
# if !defined(__BYTE_ORDER) && 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
|
||||
#endif
|
||||
|
||||
/* Built-in byte-swpped big-endian macros.
|
||||
*/
|
||||
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
|
||||
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
|
||||
# if !BOOST_ENDIAN_BIG_BYTE
|
||||
# if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_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
|
||||
#endif
|
||||
|
||||
/* Built-in byte-swpped little-endian macros.
|
||||
*/
|
||||
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
|
||||
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
|
||||
# if !BOOST_ENDIAN_LITTLE_BYTE
|
||||
# if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_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
|
||||
#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 || \
|
||||
BOOST_ARCH_BLACKFIN
|
||||
# undef BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Windows on ARM, if not otherwise detected/specified, is always
|
||||
* byte-swaped little-endian.
|
||||
*/
|
||||
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
|
||||
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
|
||||
# if BOOST_ARCH_ARM
|
||||
# include <boost/predef/os/windows.h>
|
||||
# if BOOST_OS_WINDOWS
|
||||
# undef BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_ENDIAN_BIG_BYTE
|
||||
# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE
|
||||
#endif
|
||||
#if BOOST_ENDIAN_BIG_WORD
|
||||
# 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
|
||||
# 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
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
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_COMPILER_MINGW_H
|
||||
#define BOOST_PREDEF_COMPILER_MINGW_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_MINGW`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/MinGW MinGW] platform.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__MINGW32__`] [__predef_detection__]]
|
||||
[[`__MINGW64__`] [__predef_detection__]]
|
||||
|
||||
[[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]]
|
||||
[[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_MINGW BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
# include <_mingw.h>
|
||||
# undef BOOST_PLAT_MINGW
|
||||
# if !defined(BOOST_PLAT_MINGW) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR))
|
||||
# define BOOST_PLAT_MINGW \
|
||||
BOOST_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0)
|
||||
# endif
|
||||
# if !defined(BOOST_PLAT_MINGW) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR))
|
||||
# define BOOST_PLAT_MINGW \
|
||||
BOOST_VERSION_NUMBER(__MINGW32_MAJOR_VERSION,__MINGW32_MINOR_VERSION,0)
|
||||
# endif
|
||||
# if !defined(BOOST_PLAT_MINGW)
|
||||
# define BOOST_PLAT_MINGW BOOST_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_PLAT_MINGW
|
||||
# define BOOST_PLAT_MINGW_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_PLAT_MINGW_NAME "MinGW"
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW,BOOST_PLAT_MINGW_NAME)
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user