Skip to content

Commit

Permalink
Improve error detection further.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Nov 6, 2023
1 parent d7048ec commit 90c5093
Show file tree
Hide file tree
Showing 31 changed files with 180 additions and 111 deletions.
7 changes: 4 additions & 3 deletions include/boost/math/ccmath/abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
#ifndef BOOST_MATH_CCMATH_ABS
#define BOOST_MATH_CCMATH_ABS

#include <boost/math/tools/assert.hpp>
#include <boost/math/ccmath/detail/config.hpp>
#include <boost/math/ccmath/isnan.hpp>
#include <boost/math/ccmath/isinf.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/abs.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/tools/assert.hpp>
#include <boost/math/ccmath/isnan.hpp>
#include <boost/math/ccmath/isinf.hpp>

namespace boost::math::ccmath {

namespace detail {
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/ceil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_CEIL_HPP
#define BOOST_MATH_CCMATH_CEIL_HPP

#include <cmath>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/ceil.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/floor.hpp>
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
Expand Down
6 changes: 6 additions & 0 deletions include/boost/math/ccmath/fabs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#ifndef BOOST_MATH_CCMATH_FABS
#define BOOST_MATH_CCMATH_FABS

#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fabs.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/abs.hpp>

namespace boost::math::ccmath {
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/fdim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_FDIM_HPP
#define BOOST_MATH_CCMATH_FDIM_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fdim.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/tools/promotion.hpp>
#include <boost/math/ccmath/isnan.hpp>

Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/floor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_FLOOR_HPP
#define BOOST_MATH_CCMATH_FLOOR_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/floor.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
5 changes: 3 additions & 2 deletions include/boost/math/ccmath/fma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
#define BOOST_MATH_CCMATH_FMA_HPP

#include <boost/math/ccmath/detail/config.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fma.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {

namespace detail {
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/fmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_FMAX_HPP
#define BOOST_MATH_CCMATH_FMAX_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fmax.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/tools/promotion.hpp>
#include <boost/math/ccmath/isnan.hpp>

Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/fmin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_FMIN_HPP
#define BOOST_MATH_CCMATH_FMIN_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fmin.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/tools/promotion.hpp>
#include <boost/math/ccmath/isnan.hpp>

Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/fmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
#ifndef BOOST_MATH_CCMATH_FMOD_HPP
#define BOOST_MATH_CCMATH_FMOD_HPP

#include <cmath>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fmod.hpp> can only be used in C++17 and later."
#endif

#include <cstdint>
#include <limits>
#include <type_traits>
#include <boost/math/tools/promotion.hpp>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/fpclassify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_FPCLASSIFY
#define BOOST_MATH_CCMATH_FPCLASSIFY

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/fpclassify.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/frexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
#ifndef BOOST_MATH_CCMATH_FREXP_HPP
#define BOOST_MATH_CCMATH_FREXP_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/frexp.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
#include <boost/math/ccmath/isfinite.hpp>
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/hypot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
#ifndef BOOST_MATH_CCMATH_HYPOT_HPP
#define BOOST_MATH_CCMATH_HYPOT_HPP

#include <cmath>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/hypot.hpp> can only be used in C++17 and later."
#endif

#include <array>
#include <limits>
#include <type_traits>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/math/ccmath/sqrt.hpp>
#include <boost/math/ccmath/abs.hpp>
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/ilogb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ILOGB_HPP
#define BOOST_MATH_CCMATH_ILOGB_HPP

#include <cmath>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/ilogb.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/logb.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
17 changes: 6 additions & 11 deletions include/boost/math/ccmath/isfinite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@
#ifndef BOOST_MATH_CCMATH_ISFINITE
#define BOOST_MATH_CCMATH_ISFINITE

#include <cmath>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#include <boost/math/tools/is_standalone.hpp>
#ifndef BOOST_MATH_STANDALONE
#include <boost/config.hpp>
#ifdef BOOST_NO_CXX17_IF_CONSTEXPR
#error "The header <boost/math/norms.hpp> can only be used in C++17 and later."
#endif
#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/isfinite.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {

template <typename T>
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/isgreater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ISGREATER_HPP
#define BOOST_MATH_CCMATH_ISGREATER_HPP

#include <cmath>
#include <limits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/isgreater.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/isgreaterequal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ISGREATEREQUAL_HPP
#define BOOST_MATH_CCMATH_ISGREATEREQUAL_HPP

#include <cmath>
#include <limits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/islessequal.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/isless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ISLESS_HPP
#define BOOST_MATH_CCMATH_ISLESS_HPP

#include <cmath>
#include <limits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/isless.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {
Expand Down
9 changes: 6 additions & 3 deletions include/boost/math/ccmath/islessequal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ISLESSEQUAL_HPP
#define BOOST_MATH_CCMATH_ISLESSEQUAL_HPP

#include <cmath>
#include <limits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/islessequal.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {
Expand Down
9 changes: 5 additions & 4 deletions include/boost/math/ccmath/isnormal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#define BOOST_MATH_ISNORMAL_HPP

#include <boost/math/ccmath/detail/config.hpp>
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/abs.hpp> can only be used in C++17 and later."
#error "The header <boost/math/isnormal.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {

template <typename T>
Expand Down
8 changes: 6 additions & 2 deletions include/boost/math/ccmath/isunordered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#ifndef BOOST_MATH_CCMATH_ISUNORDERED_HPP
#define BOOST_MATH_CCMATH_ISUNORDERED_HPP

#include <cmath>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/isunordered.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/isnan.hpp>

namespace boost::math::ccmath {
Expand Down
7 changes: 6 additions & 1 deletion include/boost/math/ccmath/ldexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
#ifndef BOOST_MATH_CCMATH_LDEXP_HPP
#define BOOST_MATH_CCMATH_LDEXP_HPP

#include <stdexcept>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/ldexp.hpp> can only be used in C++17 and later."
#endif

#include <stdexcept>
#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/logb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_LOGB_HPP
#define BOOST_MATH_CCMATH_LOGB_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/logb.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/frexp.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
10 changes: 6 additions & 4 deletions include/boost/math/ccmath/modf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef BOOST_MATH_CCMATH_MODF_HPP
#define BOOST_MATH_CCMATH_MODF_HPP

#include <cmath>
#include <limits>
#include <type_traits>
#include <boost/math/tools/is_constant_evaluated.hpp>
#include <boost/math/ccmath/detail/config.hpp>

#ifdef BOOST_MATH_NO_CCMATH
#error "The header <boost/math/modf.hpp> can only be used in C++17 and later."
#endif

#include <boost/math/ccmath/abs.hpp>
#include <boost/math/ccmath/isinf.hpp>
#include <boost/math/ccmath/isnan.hpp>
Expand Down
Loading

0 comments on commit 90c5093

Please sign in to comment.