mirror of
https://github.com/boostorg/detail.git
synced 2025-07-29 20:07:15 +02:00
Compare commits
1 Commits
svn-branch
...
boost-1.52
Author | SHA1 | Date | |
---|---|---|---|
b29b1b764c |
@ -28,12 +28,10 @@
|
||||
#ifndef BOOST_DETAIL_ENDIAN_HPP
|
||||
#define BOOST_DETAIL_ENDIAN_HPP
|
||||
|
||||
//
|
||||
// Special cases come first:
|
||||
//
|
||||
#if defined (__GLIBC__)
|
||||
// GNU libc offers the helpful header <endian.h> which defines
|
||||
// __BYTE_ORDER
|
||||
|
||||
#if defined (__GLIBC__)
|
||||
# include <endian.h>
|
||||
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
@ -45,56 +43,13 @@
|
||||
# error Unknown machine endianness detected.
|
||||
# endif
|
||||
# define BOOST_BYTE_ORDER __BYTE_ORDER
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__) || (__DragonFly__)
|
||||
//
|
||||
// BSD has endian.h, see https://svn.boost.org/trac/boost/ticket/6013
|
||||
# if defined(__OpenBSD__)
|
||||
# include <machine/endian.h>
|
||||
# else
|
||||
# include <sys/endian.h>
|
||||
# endif
|
||||
# if (_BYTE_ORDER == _LITTLE_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# elif (_BYTE_ORDER == _BIG_ENDIAN)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# elif (_BYTE_ORDER == _PDP_ENDIAN)
|
||||
# define BOOST_PDP_ENDIAN
|
||||
# else
|
||||
# error Unknown machine endianness detected.
|
||||
# endif
|
||||
# define BOOST_BYTE_ORDER _BYTE_ORDER
|
||||
|
||||
#elif defined( __ANDROID__ )
|
||||
// Adroid specific code, see: https://svn.boost.org/trac/boost/ticket/7528
|
||||
// Here we can use machine/_types.h, see:
|
||||
// http://stackoverflow.com/questions/6212951/endianness-of-android-ndk
|
||||
# include "machine/_types.h"
|
||||
# ifdef __ARMEB__
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
# else
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
# endif // __ARMEB__
|
||||
|
||||
#elif defined( _XBOX )
|
||||
//
|
||||
// XBox is always big endian??
|
||||
//
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
|
||||
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \
|
||||
defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) || \
|
||||
defined(__BIGENDIAN__) && !defined(__LITTLEENDIAN__) || \
|
||||
defined(_STLP_BIG_ENDIAN) && !defined(_STLP_LITTLE_ENDIAN)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \
|
||||
defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) || \
|
||||
defined(__LITTLEENDIAN__) && !defined(__BIGENDIAN__) || \
|
||||
defined(_STLP_LITTLE_ENDIAN) && !defined(_STLP_BIG_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
@ -102,7 +57,7 @@
|
||||
|| defined(_POWER) || defined(__powerpc__) \
|
||||
|| defined(__ppc__) || defined(__hpux) || defined(__hppa) \
|
||||
|| defined(_MIPSEB) || defined(_POWER) \
|
||||
|| defined(__s390__) || defined(__ARMEB__)
|
||||
|| defined(__s390__)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(__i386__) || defined(__alpha__) \
|
||||
@ -111,9 +66,7 @@
|
||||
|| defined(_M_ALPHA) || defined(__amd64) \
|
||||
|| defined(__amd64__) || defined(_M_AMD64) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) \
|
||||
|| defined(_M_X64) || defined(__bfin__) \
|
||||
|| defined(__ARMEL__) \
|
||||
|| (defined(_WIN32) && defined(__ARM__) && defined(_MSC_VER)) // ARM Windows CE don't define anything reasonably unique, but there are no big-endian Windows versions
|
||||
|| defined(_M_X64) || defined(__bfin__)
|
||||
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
@ -123,4 +76,3 @@
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -112,7 +112,7 @@ boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T
|
||||
#else
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, 25, "boost/detail/is_function_ref_tester.hpp"))
|
||||
(3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif // BOOST_TT_PREPROCESSING_MODE
|
||||
@ -133,4 +133,3 @@ boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i
|
||||
|
||||
#undef i
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
|
||||
|
@ -12,61 +12,21 @@
|
||||
//
|
||||
// Copyright (c) 2002, 2009 Peter Dimov
|
||||
// Copyright (2) Beman Dawes 2010, 2011
|
||||
// Copyright (3) Ion Gaztanaga 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
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If expression is false increases the error count
|
||||
// and outputs a message containing 'expression'
|
||||
//
|
||||
// BOOST_TEST(expression)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// Increases error count and outputs a message containing 'message'
|
||||
//
|
||||
// BOOST_ERROR(message)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If 'expr1' != 'expr2' increases the error count
|
||||
// and outputs a message containing both expressions
|
||||
//
|
||||
// BOOST_TEST_EQ(expr1, expr2)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If 'expr1' == 'expr2' increases the error count
|
||||
// and outputs a message containing both expressions
|
||||
//
|
||||
// BOOST_TEST_NE(expr1, expr2)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If BOOST_NO_EXCEPTIONS is NOT defined and if 'expr' does not
|
||||
// throw an exception of type 'excep', increases the error count
|
||||
// and outputs a message containing the expression.
|
||||
//
|
||||
// If BOOST_NO_EXCEPTIONS is defined, this macro expands to nothing
|
||||
// and 'expr' is not evaluated.
|
||||
//
|
||||
// BOOST_TEST_THROWS(expr, excep)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// Returns the error count
|
||||
//
|
||||
// int boost::report_errors()
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
@ -119,14 +79,6 @@ inline void error_impl(char const * msg, char const * file, int line, char const
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
@ -187,22 +139,5 @@ inline int report_errors()
|
||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
|
||||
try { \
|
||||
EXPR; \
|
||||
::boost::detail::throw_failed_impl \
|
||||
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
|
||||
} \
|
||||
catch(EXCEP const&) { \
|
||||
} \
|
||||
catch(...) { \
|
||||
::boost::detail::throw_failed_impl \
|
||||
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
|
||||
} \
|
||||
//
|
||||
#else
|
||||
#define BOOST_TEST_THROWS( EXPR, EXCEP )
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
|
@ -11,7 +11,7 @@
|
||||
[section:scoped_enums Scoped Enums]
|
||||
|
||||
Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
|
||||
scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
|
||||
macro is used to detect feature support.
|
||||
|
||||
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
|
||||
@ -71,14 +71,14 @@ use
|
||||
|
||||
And instead of
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { };
|
||||
#endif
|
||||
|
||||
use
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type > : public true_type { };
|
||||
#endif
|
||||
@ -130,7 +130,7 @@ Sample usage:
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
/**
|
||||
* Meta-function to get the underlying type of a scoped enum.
|
||||
*
|
||||
@ -193,7 +193,7 @@ namespace boost
|
||||
return e.native_value_();
|
||||
}
|
||||
|
||||
#else // BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#else // BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
template <typename EnumType>
|
||||
struct underlying_type
|
||||
@ -224,9 +224,9 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#ifndef BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
||||
explicit operator underlying_type() const { return get_underlying_value_(); }
|
||||
@ -305,7 +305,7 @@ namespace boost
|
||||
*/
|
||||
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType
|
||||
|
||||
#else // BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#else // BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType
|
||||
#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType
|
||||
@ -315,13 +315,13 @@ namespace boost
|
||||
#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType
|
||||
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType
|
||||
|
||||
#endif // BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif // BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name)
|
||||
#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2()
|
||||
#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name)
|
||||
|
||||
//#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
//#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
//
|
||||
//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
|
||||
//# define BOOST_SCOPED_ENUM_END };
|
||||
|
Reference in New Issue
Block a user