From 11cdc02169ed1ea49a5345f9fa60fda9a119c980 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 27 Aug 2019 15:29:32 -0400 Subject: [PATCH] Use feature tests instead of relying on C++ version flag --- cmake/checks/check_01_cxx_features.cmake | 20 -------------------- include/deal.II/base/config.h.in | 1 - include/deal.II/base/std_cxx17/cmath.h | 8 ++++---- include/deal.II/base/std_cxx17/tuple.h | 14 ++++++-------- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 2285e206fa..e94d944885 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -24,7 +24,6 @@ # DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH # DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE # DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR -# DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS # DEAL_II_HAVE_FP_EXCEPTIONS # DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS # @@ -582,7 +581,6 @@ UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR - DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS DEAL_II_HAVE_FP_EXCEPTIONS DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS ) @@ -766,22 +764,4 @@ ELSE() SET(DEAL_II_CONSTEXPR " ") ENDIF() -# -# Not all compilers with C++17 support include the new special math -# functions. Check this separately so that we can use C++17 compilers that don't -# support it. -# -CHECK_CXX_SOURCE_COMPILES( - " - #include - - int main() - { - std::cyl_bessel_j(1.0, 1.0); - std::cyl_bessel_jf(1.0f, 1.0f); - std::cyl_bessel_jl(1.0, 1.0); - } - " - DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS) - RESET_CMAKE_REQUIRED() diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 18c4f7ecb1..902ac128f9 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -128,7 +128,6 @@ #cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE #cmakedefine DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR -#cmakedefine DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS #cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@ diff --git a/include/deal.II/base/std_cxx17/cmath.h b/include/deal.II/base/std_cxx17/cmath.h index 2a71062981..ce422ad583 100644 --- a/include/deal.II/base/std_cxx17/cmath.h +++ b/include/deal.II/base/std_cxx17/cmath.h @@ -17,16 +17,16 @@ #include -#ifndef DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS +#ifndef __cpp_lib_math_special_functions # include -#endif // DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS +#endif // __cpp_lib_math_special_functions #include DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { -#ifndef DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS +#ifndef __cpp_lib_math_special_functions double (&cyl_bessel_j)(double, double) = boost::math::cyl_bessel_j; float (&cyl_bessel_jf)(float, @@ -37,7 +37,7 @@ namespace std_cxx17 using std::cyl_bessel_j; using std::cyl_bessel_jf; using std::cyl_bessel_jl; -#endif // DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS +#endif // __cpp_lib_math_special_functions } // namespace std_cxx17 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/std_cxx17/tuple.h b/include/deal.II/base/std_cxx17/tuple.h index 5d56d82b05..e3a465a317 100644 --- a/include/deal.II/base/std_cxx17/tuple.h +++ b/include/deal.II/base/std_cxx17/tuple.h @@ -17,18 +17,16 @@ #include -#ifndef DEAL_II_WITH_CXX17 -# include -#else -# include -#endif +#include -#include +#ifndef __cpp_lib_apply +# include +#endif // __cpp_lib_apply DEAL_II_NAMESPACE_OPEN namespace std_cxx17 { -#ifndef DEAL_II_WITH_CXX17 +#ifndef __cpp_lib_apply template auto apply_impl(F &&fn, Tuple &&t, std_cxx14::index_sequence) @@ -53,7 +51,7 @@ namespace std_cxx17 } #else using std::apply; -#endif // DEAL_II_WITH_CXX17 +#endif // __cpp_lib_apply } // namespace std_cxx17 DEAL_II_NAMESPACE_CLOSE -- 2.39.5