diff --git a/include/boost/math/ccmath/abs.hpp b/include/boost/math/ccmath/abs.hpp index 84e01fba01..c47ac1bac1 100644 --- a/include/boost/math/ccmath/abs.hpp +++ b/include/boost/math/ccmath/abs.hpp @@ -8,20 +8,13 @@ #ifndef BOOST_MATH_CCMATH_ABS #define BOOST_MATH_CCMATH_ABS -#include -#include -#include -#include #include +#include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/detail/config.hpp b/include/boost/math/ccmath/detail/config.hpp new file mode 100644 index 0000000000..5dfbc2d912 --- /dev/null +++ b/include/boost/math/ccmath/detail/config.hpp @@ -0,0 +1,34 @@ +// (C) Copyright John Maddock 2023. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Core configuration for ccmath functions, basically will they work or not? + +#ifndef BOOST_MATH_CCMATH_DETAIL_CONFIG +#define BOOST_MATH_CCMATH_DETAIL_CONFIG + +#include +#include +#include +#include +#include + +#ifndef BOOST_MATH_STANDALONE +#include +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +# define BOOST_MATH_NO_CCMATH +#endif +#endif + +#ifndef _MSC_VER +// +// Don't check here for msvc as they didn't get std lib configuration macros at the same time as C++17 +// +#if (__cpp_lib_bool_constant < 201505L) && !defined(BOOST_MATH_NO_CCMATH) +# define BOOST_MATH_NO_CCMATH +#endif +#endif + + +#endif diff --git a/include/boost/math/ccmath/div.hpp b/include/boost/math/ccmath/div.hpp index a6cb5ce10c..613a22f3f5 100644 --- a/include/boost/math/ccmath/div.hpp +++ b/include/boost/math/ccmath/div.hpp @@ -6,18 +6,12 @@ #ifndef BOOST_MATH_CCMATH_DIV_HPP #define BOOST_MATH_CCMATH_DIV_HPP -#include -#include #include #include -#include +#include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/fma.hpp b/include/boost/math/ccmath/fma.hpp index 7bc12fe7a6..f11985521c 100644 --- a/include/boost/math/ccmath/fma.hpp +++ b/include/boost/math/ccmath/fma.hpp @@ -6,19 +6,12 @@ #ifndef BOOST_MATH_CCMATH_FMA_HPP #define BOOST_MATH_CCMATH_FMA_HPP -#include -#include -#include -#include +#include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/isinf.hpp b/include/boost/math/ccmath/isinf.hpp index 7b942dcf72..dfbd1f00af 100644 --- a/include/boost/math/ccmath/isinf.hpp +++ b/include/boost/math/ccmath/isinf.hpp @@ -6,18 +6,11 @@ #ifndef BOOST_MATH_CCMATH_ISINF #define BOOST_MATH_CCMATH_ISINF -#include -#include -#include -#include #include +#include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/isnan.hpp b/include/boost/math/ccmath/isnan.hpp index a5e121a97f..504fa90d2c 100644 --- a/include/boost/math/ccmath/isnan.hpp +++ b/include/boost/math/ccmath/isnan.hpp @@ -6,17 +6,11 @@ #ifndef BOOST_MATH_CCMATH_ISNAN #define BOOST_MATH_CCMATH_ISNAN -#include -#include -#include #include +#include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/isnormal.hpp b/include/boost/math/ccmath/isnormal.hpp index 8310a65848..96277caf72 100644 --- a/include/boost/math/ccmath/isnormal.hpp +++ b/include/boost/math/ccmath/isnormal.hpp @@ -6,20 +6,13 @@ #ifndef BOOST_MATH_ISNORMAL_HPP #define BOOST_MATH_ISNORMAL_HPP -#include -#include -#include -#include +#include #include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/ldexp.hpp b/include/boost/math/ccmath/ldexp.hpp index 31730b265f..4e5c9a8d21 100644 --- a/include/boost/math/ccmath/ldexp.hpp +++ b/include/boost/math/ccmath/ldexp.hpp @@ -7,11 +7,8 @@ #ifndef BOOST_MATH_CCMATH_LDEXP_HPP #define BOOST_MATH_CCMATH_LDEXP_HPP -#include -#include -#include #include -#include +#include #include #include #include diff --git a/include/boost/math/ccmath/round.hpp b/include/boost/math/ccmath/round.hpp index 6b7947e646..0014c537ae 100644 --- a/include/boost/math/ccmath/round.hpp +++ b/include/boost/math/ccmath/round.hpp @@ -6,21 +6,15 @@ #ifndef BOOST_MATH_CCMATH_ROUND_HPP #define BOOST_MATH_CCMATH_ROUND_HPP -#include -#include #include -#include +#include #include #include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif namespace boost::math::ccmath { diff --git a/include/boost/math/ccmath/signbit.hpp b/include/boost/math/ccmath/signbit.hpp index 4c7bf5b2c5..28ad619930 100644 --- a/include/boost/math/ccmath/signbit.hpp +++ b/include/boost/math/ccmath/signbit.hpp @@ -6,22 +6,15 @@ #ifndef BOOST_MATH_CCMATH_SIGNBIT_HPP #define BOOST_MATH_CCMATH_SIGNBIT_HPP -#include #include -#include -#include -#include #include +#include #include #include #include -#include -#ifndef BOOST_MATH_STANDALONE -#include -#ifdef BOOST_NO_CXX17_IF_CONSTEXPR -#error "The header can only be used in C++17 and later." -#endif +#ifdef BOOST_MATH_NO_CCMATH +#error "The header can only be used in C++17 and later." #endif #ifdef __has_include diff --git a/include/boost/math/special_functions/round.hpp b/include/boost/math/special_functions/round.hpp index b32c8e4347..e74acba85b 100644 --- a/include/boost/math/special_functions/round.hpp +++ b/include/boost/math/special_functions/round.hpp @@ -12,6 +12,7 @@ #endif #include +#include #include #include #include @@ -19,11 +20,9 @@ #include #include -#ifndef BOOST_NO_CXX17_IF_CONSTEXPR +#if !defined(BOOST_MATH_NO_CCMATH) && !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) #include -# if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) # define BOOST_MATH_HAS_CONSTEXPR_LDEXP -# endif #endif namespace boost{ namespace math{ diff --git a/include/boost/math/special_functions/trunc.hpp b/include/boost/math/special_functions/trunc.hpp index 8b4f64eb65..a084de560b 100644 --- a/include/boost/math/special_functions/trunc.hpp +++ b/include/boost/math/special_functions/trunc.hpp @@ -14,15 +14,14 @@ #include #include #include +#include #include #include #include -#ifndef BOOST_NO_CXX17_IF_CONSTEXPR -# if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) -# include +#if !defined(BOOST_MATH_NO_CCMATH) && !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) +#include # define BOOST_MATH_HAS_CONSTEXPR_LDEXP -# endif #endif namespace boost{ namespace math{ namespace detail{