mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-02 14:24:30 +02:00
Integrate GCC fixes from RC_1_34_0
[SVN r35896]
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#ifndef BOOST_MPL_ASSERT_HPP_INCLUDED
|
#ifndef BOOST_MPL_ASSERT_HPP_INCLUDED
|
||||||
#define BOOST_MPL_ASSERT_HPP_INCLUDED
|
#define BOOST_MPL_ASSERT_HPP_INCLUDED
|
||||||
|
|
||||||
// Copyright Aleksey Gurtovoy 2000-2004
|
// Copyright Aleksey Gurtovoy 2000-2006
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -25,10 +25,15 @@
|
|||||||
#include <boost/mpl/aux_/config/dtp.hpp>
|
#include <boost/mpl/aux_/config/dtp.hpp>
|
||||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||||
|
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||||
|
|
||||||
#include <boost/preprocessor/cat.hpp>
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
|
||||||
|
#include <boost/config.hpp> // make sure 'size_t' is placed into 'std'
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
|
#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
|
||||||
|| (BOOST_MPL_CFG_GCC != 0)
|
|| (BOOST_MPL_CFG_GCC != 0)
|
||||||
# define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
# define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
||||||
@@ -48,7 +53,7 @@ struct failed {};
|
|||||||
|
|
||||||
// agurt, 24/aug/04: MSVC 7.1 workaround here and below: return/accept
|
// agurt, 24/aug/04: MSVC 7.1 workaround here and below: return/accept
|
||||||
// 'assert<false>' by reference; can't apply it unconditionally -- apparently it
|
// 'assert<false>' by reference; can't apply it unconditionally -- apparently it
|
||||||
// degrades quality of GCC diagnostics
|
// degrades the quality of GCC diagnostics
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||||
# define AUX778076_ASSERT_ARG(x) x&
|
# define AUX778076_ASSERT_ARG(x) x&
|
||||||
#else
|
#else
|
||||||
@@ -129,7 +134,7 @@ template< typename P > struct assert_arg_pred
|
|||||||
template< typename P > struct assert_arg_pred_not
|
template< typename P > struct assert_arg_pred_not
|
||||||
{
|
{
|
||||||
typedef typename P::type p_type;
|
typedef typename P::type p_type;
|
||||||
enum { p = !p_type::value };
|
BOOST_STATIC_CONSTANT( bool, p = !p_type::value );
|
||||||
typedef typename assert_arg_pred_impl<p>::type type;
|
typedef typename assert_arg_pred_impl<p>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -198,13 +203,14 @@ BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
|||||||
// BOOST_MPL_ASSERT((pred<x,...>))
|
// BOOST_MPL_ASSERT((pred<x,...>))
|
||||||
|
|
||||||
#define BOOST_MPL_ASSERT(pred) \
|
#define BOOST_MPL_ASSERT(pred) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<false>( \
|
boost::mpl::assertion_failed<false>( \
|
||||||
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
|
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
}\
|
) \
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
// BOOST_MPL_ASSERT_NOT((pred<x,...>))
|
// BOOST_MPL_ASSERT_NOT((pred<x,...>))
|
||||||
@@ -221,13 +227,14 @@ enum { \
|
|||||||
/**/
|
/**/
|
||||||
#else
|
#else
|
||||||
# define BOOST_MPL_ASSERT_NOT(pred) \
|
# define BOOST_MPL_ASSERT_NOT(pred) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<false>( \
|
boost::mpl::assertion_failed<false>( \
|
||||||
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
}\
|
) \
|
||||||
/**/
|
/**/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -237,8 +244,9 @@ enum { \
|
|||||||
|
|
||||||
# if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
# if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<(x rel y)>( \
|
boost::mpl::assertion_failed<(x rel y)>( \
|
||||||
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
|
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
|
||||||
boost::mpl::assert_::relations( sizeof( \
|
boost::mpl::assert_::relations( sizeof( \
|
||||||
@@ -248,13 +256,19 @@ enum { \
|
|||||||
, y \
|
, y \
|
||||||
>::************)) 0 ) \
|
>::************)) 0 ) \
|
||||||
) \
|
) \
|
||||||
} \
|
) \
|
||||||
/**/
|
/**/
|
||||||
# else
|
# else
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof(boost::mpl::assert_::arg rel boost::mpl::assert_::arg) \
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) \
|
, BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof( \
|
||||||
|
boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
|
||||||
|
) \
|
||||||
|
); \
|
||||||
|
BOOST_STATIC_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) ); \
|
||||||
|
BOOST_STATIC_CONSTANT( \
|
||||||
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
|
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
|
||||||
boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
|
boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
|
||||||
@@ -264,7 +278,7 @@ enum { \
|
|||||||
>() ) \
|
>() ) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
} \
|
) \
|
||||||
/**/
|
/**/
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -272,22 +286,24 @@ enum { \
|
|||||||
|
|
||||||
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \
|
boost::mpl::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \
|
||||||
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
|
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
|
||||||
) ) \
|
) ) \
|
||||||
) \
|
) \
|
||||||
}\
|
) \
|
||||||
/**/
|
/**/
|
||||||
# else
|
# else
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
|
boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
|
||||||
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
|
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
|
||||||
) \
|
) \
|
||||||
}\
|
) \
|
||||||
/**/
|
/**/
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -298,32 +314,34 @@ enum { \
|
|||||||
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
|
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
|
||||||
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
||||||
struct msg; \
|
struct msg; \
|
||||||
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
|
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
|
||||||
{ \
|
{ \
|
||||||
using boost::mpl::assert_::types; \
|
using boost::mpl::assert_::types; \
|
||||||
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
||||||
{ return 0; } \
|
{ return 0; } \
|
||||||
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
) \
|
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
||||||
}\
|
) \
|
||||||
|
) \
|
||||||
/**/
|
/**/
|
||||||
#else
|
#else
|
||||||
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
||||||
struct msg; \
|
struct msg; \
|
||||||
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
|
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
|
||||||
{ \
|
{ \
|
||||||
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
||||||
{ return 0; } \
|
{ return 0; } \
|
||||||
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
||||||
enum { \
|
BOOST_STATIC_CONSTANT( \
|
||||||
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
std::size_t \
|
||||||
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
||||||
) \
|
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
||||||
}\
|
) \
|
||||||
|
) \
|
||||||
/**/
|
/**/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user