]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use feature tests instead of relying on C++ version flag 8659/head
authorDaniel Arndt <arndtd@ornl.gov>
Tue, 27 Aug 2019 19:29:32 +0000 (15:29 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 27 Aug 2019 19:33:46 +0000 (15:33 -0400)
cmake/checks/check_01_cxx_features.cmake
include/deal.II/base/config.h.in
include/deal.II/base/std_cxx17/cmath.h
include/deal.II/base/std_cxx17/tuple.h

index 2285e206fa0763835c31fdcd078b47069672b45e..e94d944885fa38e1de0b3dcd611ddd90d2cfa9e0 100644 (file)
@@ -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 <cmath>
-
-  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()
index 18c4f7ecb151351551c917ee34a81ba3bc345065..902ac128f92634fcb7cb440e74a0f829f125a8bb 100644 (file)
 
 #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@
index 2a7106298172488cf327a58c3386694a40111781..ce422ad583ee5de920a008cfd5b756201761a977 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifndef DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS
+#ifndef __cpp_lib_math_special_functions
 #  include <boost/math/special_functions/bessel.hpp>
-#endif // DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS
+#endif // __cpp_lib_math_special_functions
 
 #include <cmath>
 
 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<double, double>;
   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
 
index 5d56d82b05fd707e53f5f77341ab7d30be758234..e3a465a317c035f90535c003e89f301e3578e3c7 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifndef DEAL_II_WITH_CXX17
-#  include <deal.II/base/std_cxx14/utility.h>
-#else
-#  include <tuple>
-#endif
+#include <tuple>
 
-#include <cmath>
+#ifndef __cpp_lib_apply
+#  include <deal.II/base/std_cxx14/utility.h>
+#endif // __cpp_lib_apply
 
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_WITH_CXX17
+#ifndef __cpp_lib_apply
   template <typename F, typename Tuple, size_t... S>
   auto
   apply_impl(F &&fn, Tuple &&t, std_cxx14::index_sequence<S...>)
@@ -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
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.