]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/mpl/assert.hpp
Don't allow newline characters in document settings.
[lyx.git] / boost / boost / mpl / assert.hpp
index d4b888d6dfc84b38cdcdbe47db0f20b4615f366b..33b82f3ffa11ab3a49cef1d93ac3f00b611d9d2d 100644 (file)
@@ -10,9 +10,9 @@
 //
 // See http://www.boost.org/libs/mpl for documentation.
 
-// $Source: /cvsroot/boost/boost/boost/mpl/assert.hpp,v $
-// $Date: 2006/11/10 21:31:19 $
-// $Revision: 1.13.14.6 $
+// $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
+// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
+// $Revision: 49267 $
 
 #include <boost/mpl/not.hpp>
 #include <boost/mpl/aux_/value_wknd.hpp>
@@ -26,6 +26,7 @@
 #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/pp_counter.hpp>
 #include <boost/mpl/aux_/config/workaround.hpp>
 
 #include <boost/preprocessor/cat.hpp>
@@ -34,7 +35,7 @@
 #include <cstddef>
 
 
-#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
     || (BOOST_MPL_CFG_GCC != 0) \
     || BOOST_WORKAROUND(__IBMCPP__, <= 600)
 #   define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
@@ -42,7 +43,7 @@
 
 #if BOOST_WORKAROUND(__MWERKS__, < 0x3202) \
     || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
-    || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+    || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
     || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
 #   define BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER
 #endif
@@ -50,7 +51,7 @@
 // agurt, 10/nov/06: use enums for Borland (which cannot cope with static constants) 
 // and GCC (which issues "unused variable" warnings when static constants are used 
 // at a function scope)
-#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
     || (BOOST_MPL_CFG_GCC != 0)
 #   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
 #else
@@ -216,7 +217,7 @@ BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
 #define BOOST_MPL_ASSERT(pred) \
 BOOST_MPL_AUX_ASSERT_CONSTANT( \
       std::size_t \
-    , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
           boost::mpl::assertion_failed<false>( \
               boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
             ) \
@@ -229,7 +230,7 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
 #   define BOOST_MPL_ASSERT_NOT(pred) \
 enum { \
-    BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+      BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
           boost::mpl::assertion<false>::failed( \
               boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
             ) \
@@ -240,7 +241,7 @@ enum { \
 #   define BOOST_MPL_ASSERT_NOT(pred) \
 BOOST_MPL_AUX_ASSERT_CONSTANT( \
       std::size_t \
-    , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
           boost::mpl::assertion_failed<false>( \
               boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
             ) \
@@ -255,12 +256,12 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
 
 #   if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
 // agurt, 9/nov/06: 'enum' below is a workaround for gcc 4.0.4/4.1.1 bugs #29522 and #29518
-#   define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
-enum { BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) }; \
+#   define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y)      \
+enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \
 BOOST_MPL_AUX_ASSERT_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_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+        boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
             (boost::mpl::failed ************ ( boost::mpl::assert_relation< \
                   boost::mpl::assert_::relations( sizeof( \
                       boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
@@ -272,20 +273,20 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
     ) \
 /**/
 #   else
-#   define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
+#   define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y)    \
 BOOST_MPL_AUX_ASSERT_CONSTANT( \
       std::size_t \
-    , BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof( \
+    , BOOST_PP_CAT(mpl_assert_rel,counter) = sizeof( \
           boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
         ) \
     ); \
-BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) ); \
+BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) ); \
 BOOST_MPL_AUX_ASSERT_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_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+        boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
               boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
-                  boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,__LINE__)) \
+                  boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,counter)) \
                 , x \
                 , y \
                 >() ) \
@@ -295,13 +296,17 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
 /**/
 #   endif
 
+#   define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
+BOOST_MPL_ASSERT_RELATION_IMPL(BOOST_MPL_AUX_PP_COUNTER(), x, rel, y) \
+/**/
+
 #else // !BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
 
 #   if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
 #   define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
 BOOST_MPL_AUX_ASSERT_CONSTANT( \
       std::size_t \
-    , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = 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))() \
             ) ) \
@@ -312,7 +317,7 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
 #   define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
 BOOST_MPL_AUX_ASSERT_CONSTANT( \
       std::size_t \
-    , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = 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 ) \
         ) \
@@ -326,36 +331,40 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
 // BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) ) 
 
 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
-#   define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+#   define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
 struct msg; \
-typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
+typedef struct BOOST_PP_CAT(msg,counter) : 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_PP_CAT(mpl_assert_arg,counter); \
 BOOST_MPL_AUX_ASSERT_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() ) \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+        boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
         ) \
     ) \
 /**/
 #else
-#   define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+#   define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ )  \
 struct msg; \
-typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
+typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \
 { \
     static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
     { return 0; } \
-} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
+} BOOST_PP_CAT(mpl_assert_arg,counter); \
 BOOST_MPL_AUX_ASSERT_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() ) \
+    , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+        boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
         ) \
     ) \
 /**/
 #endif
 
+#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \
+/**/
+
 #endif // BOOST_MPL_ASSERT_HPP_INCLUDED