Integrate GCC fixes from RC_1_34_0

[SVN r35896]
This commit is contained in:
Aleksey Gurtovoy
2006-11-07 09:03:36 +00:00
parent 5b3bbab314
commit 99c280e3c8

View File

@@ -2,7 +2,7 @@
#ifndef 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.
// (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/gcc.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/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) \
|| (BOOST_MPL_CFG_GCC != 0)
# 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
// '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)
# define AUX778076_ASSERT_ARG(x) x&
#else
@@ -129,7 +134,7 @@ template< typename P > struct assert_arg_pred
template< typename P > struct assert_arg_pred_not
{
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;
};
@@ -198,13 +203,14 @@ BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
// BOOST_MPL_ASSERT((pred<x,...>))
#define BOOST_MPL_ASSERT(pred) \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<false>( \
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
) \
) \
}\
) \
/**/
// BOOST_MPL_ASSERT_NOT((pred<x,...>))
@@ -221,13 +227,14 @@ enum { \
/**/
#else
# define BOOST_MPL_ASSERT_NOT(pred) \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<false>( \
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
) \
) \
}\
) \
/**/
#endif
@@ -237,8 +244,9 @@ enum { \
# if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<(x rel y)>( \
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
boost::mpl::assert_::relations( sizeof( \
@@ -248,13 +256,19 @@ enum { \
, y \
>::************)) 0 ) \
) \
} \
) \
/**/
# else
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
enum { \
BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof(boost::mpl::assert_::arg rel boost::mpl::assert_::arg) \
, BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) \
BOOST_STATIC_CONSTANT( \
std::size_t \
, 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::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
@@ -264,7 +278,7 @@ enum { \
>() ) \
) \
) \
} \
) \
/**/
# endif
@@ -272,22 +286,24 @@ enum { \
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
BOOST_STATIC_CONSTANT( \
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::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
) ) \
) \
}\
) \
/**/
# else
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
) \
}\
) \
/**/
# endif
@@ -298,32 +314,34 @@ enum { \
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
struct msg; \
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
{ \
using boost::mpl::assert_::types; \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
) \
}\
struct msg; \
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
{ \
using boost::mpl::assert_::types; \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
) \
) \
/**/
#else
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
struct msg; \
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
{ \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
enum { \
BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
) \
}\
struct msg; \
typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
{ \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
BOOST_STATIC_CONSTANT( \
std::size_t \
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
) \
) \
/**/
#endif