From 9a9bbcfb2e27d9ae937d8b6c39ccbe2a519bc449 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Mon, 8 Feb 2021 22:35:35 +0300 Subject: [PATCH] Disable Boost.Math real_concept on C++03 (it now requires C++11) --- classic/test/Jamfile | 10 +++++----- test/karma/real.hpp | 7 ++++++- test/karma/real3.cpp | 8 ++------ test/qi/real.hpp | 7 ++++++- test/qi/real4.cpp | 2 ++ test/qi/real5.cpp | 2 ++ 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/classic/test/Jamfile b/classic/test/Jamfile index 725f53d40..0f034e565 100644 --- a/classic/test/Jamfile +++ b/classic/test/Jamfile @@ -8,10 +8,10 @@ # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) #============================================================================== -# -# Spirit regression test boost-jam file -# Joel de Guzman [Sept 27, 2002] -# + +import config : requires ; + +############################################################################### project spirit-classic : requirements @@ -71,7 +71,7 @@ local multi-threading = boost_thread [ spirit-run char_strings_test.cpp ] [ compile-fail char_strings_test_fail.cpp ] [ spirit-run numerics_tests.cpp : : : $(opt) ] - [ spirit-run custom_real_parser.cpp ] + [ spirit-run custom_real_parser.cpp : : : [ requires cxx11_sfinae_expr ] ] ; test-suite "spirit.classic.core.composite" diff --git a/test/karma/real.hpp b/test/karma/real.hpp index 0acc7ed89..0ac774c42 100644 --- a/test/karma/real.hpp +++ b/test/karma/real.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -22,6 +21,12 @@ #include #include "test.hpp" +#ifndef BOOST_NO_CXX11_SFINAE_EXPR +# include +#else +# define BOOST_SPIRIT_NO_MATH_REAL_CONCEPT +#endif + using namespace spirit_test; /////////////////////////////////////////////////////////////////////////////// diff --git a/test/karma/real3.cpp b/test/karma/real3.cpp index 8bbbf454f..475845d97 100644 --- a/test/karma/real3.cpp +++ b/test/karma/real3.cpp @@ -11,8 +11,7 @@ #include "real.hpp" /////////////////////////////////////////////////////////////////////////////// -// the customization points below have been added only recently -#if SPIRIT_VERSION >= 0x2050 +#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT // does not provide proper std::numeric_limits, we need to roll our own namespace boost { namespace spirit { namespace traits { @@ -78,10 +77,7 @@ int main() BOOST_TEST(test("-123420000000000000000.0", fixed, -1.23420e20)); } -// support for using real_concept with a Karma generator has been implemented -// in Boost versions > 1.36 only, additionally real_concept is available only -// if BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is not defined -#if BOOST_VERSION > 103600 && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT { using boost::math::concepts::real_concept; typedef karma::real_generator custom_type; diff --git a/test/qi/real.hpp b/test/qi/real.hpp index 462e83a16..8df9053a9 100644 --- a/test/qi/real.hpp +++ b/test/qi/real.hpp @@ -10,7 +10,6 @@ #define BOOST_SPIRIT_TEST_QI_REAL_HPP #include -#include #include #include #include @@ -20,6 +19,12 @@ #include "test.hpp" +#ifndef BOOST_NO_CXX11_SFINAE_EXPR +# include +#else +# define BOOST_SPIRIT_NO_MATH_REAL_CONCEPT +#endif + /////////////////////////////////////////////////////////////////////////////// // These policies can be used to parse thousand separated // numbers with at most 2 decimal digits after the decimal diff --git a/test/qi/real4.cpp b/test/qi/real4.cpp index 45d1ca7ed..504eb6ef4 100644 --- a/test/qi/real4.cpp +++ b/test/qi/real4.cpp @@ -19,6 +19,7 @@ main() /////////////////////////////////////////////////////////////////////////// // Custom data type /////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT { using boost::math::concepts::real_concept; using boost::spirit::qi::real_parser; @@ -58,6 +59,7 @@ main() BOOST_TEST(!test("-1.2e", custom_real)); BOOST_TEST(!test_attr("-1.2e", custom_real, d)); } +#endif /////////////////////////////////////////////////////////////////////////// // custom real tests diff --git a/test/qi/real5.cpp b/test/qi/real5.cpp index af17004d4..f00b1853f 100644 --- a/test/qi/real5.cpp +++ b/test/qi/real5.cpp @@ -76,6 +76,7 @@ main() /////////////////////////////////////////////////////////////////////////// // parameterized custom data type /////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT { using boost::math::concepts::real_concept; using boost::spirit::qi::real_parser; @@ -96,6 +97,7 @@ main() BOOST_TEST(compare(d, 1.2e3)); BOOST_TEST(!test_attr("1.2e3", custom_real(-3.2e1), d)); } +#endif /////////////////////////////////////////////////////////////////////////// // parameterized lazy tests