Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/spirit/home/support/assert_msg.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //  Copyright (c) 2001-2013 Hartmut Kaiser
0002 //
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_ASSERT_MSG_JUN_23_2009_0836AM)
0007 #define BOOST_SPIRIT_ASSERT_MSG_JUN_23_2009_0836AM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/config.hpp>
0014 
0015 // Work around the MPL problem in BOOST_MPL_ASSERT_MSG generating
0016 // multiple definition linker errors for certain compilers (VC++ 8).
0017 // BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG can also be defined by user.
0018 #if !defined(BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG)
0019 # if defined(BOOST_MSVC) && BOOST_MSVC < 1500
0020 #  define BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG 1
0021 # endif
0022 #endif
0023 
0024 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG != 0
0025 #include <boost/static_assert.hpp>
0026 #define BOOST_SPIRIT_ASSERT_MSG(Cond, Msg, Types)                             \
0027         BOOST_STATIC_ASSERT_MSG(Cond, # Msg)
0028 #else
0029 #include <boost/mpl/assert.hpp>
0030 #define BOOST_SPIRIT_ASSERT_MSG(Cond, Msg, Types)                             \
0031         BOOST_MPL_ASSERT_MSG(Cond, Msg, Types)
0032 #endif
0033 
0034 #define BOOST_SPIRIT_ASSERT_MATCH(Domain, Expr)                               \
0035         BOOST_SPIRIT_ASSERT_MSG((                                             \
0036             boost::spirit::traits::matches< Domain, Expr >::value             \
0037         ), error_invalid_expression, (Expr))
0038 
0039 // GCC 4.7 will overeagerly instantiate static_asserts in template functions,
0040 // if the assert condition does not depend on template parameters
0041 // (see https://svn.boost.org/trac/boost/ticket/8381).
0042 // There are places where we want to use constant false as the condition in
0043 // template functions to indicate that these function overloads should never
0044 // be called. This allows to generate better error messages. To solve this
0045 // problem we make the condition dependent on the template argument and use
0046 // the following macro in such places.
0047 #include <boost/type_traits/is_same.hpp>
0048 
0049 #define BOOST_SPIRIT_ASSERT_FAIL(TemplateParam, Msg, Types)                   \
0050         BOOST_SPIRIT_ASSERT_MSG((!boost::is_same<                             \
0051             TemplateParam, TemplateParam >::value), Msg, Types)
0052 
0053 #endif
0054