]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make C++17 support independent of the special math functions.
authorDavid Wells <drwells@email.unc.edu>
Tue, 7 Aug 2018 03:02:10 +0000 (23:02 -0400)
committerDavid Wells <drwells@email.unc.edu>
Tue, 7 Aug 2018 03:02:10 +0000 (23:02 -0400)
Clang does not yet have these, but supports a large subset of C++17. Since these
are a library feature its easy enough to just fall back to boost.

cmake/checks/check_01_cxx_features.cmake
include/deal.II/base/config.h.in
include/deal.II/base/std_cxx17/cmath.h

index 32d61d3883c1ff9ca90546bb3a462391a43ef2bb..2236748438b0937d9779fb6923adaf56adc308fb 100644 (file)
@@ -21,7 +21,9 @@
 #   DEAL_II_WITH_CXX14
 #   DEAL_II_WITH_CXX17
 #
+#   DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH
 #   DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
+#   DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS
 #   DEAL_II_HAVE_FP_EXCEPTIONS
 #   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
 #
@@ -176,22 +178,6 @@ IF(NOT DEFINED DEAL_II_WITH_CXX17 OR DEAL_II_WITH_CXX17)
       "
       DEAL_II_HAVE_CXX17_IF_CONSTEXPR)
 
-    #
-    # Not all compilers with C++17 support include the new special math functions:
-    #
-    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)
-
     #
     # Some compilers treat lambdas as constexpr functions when compiling
     # with C++17 support even if they don't fulfill all the constexpr
@@ -567,6 +553,7 @@ UNSET_IF_CHANGED(CHECK_CXX_FEATURES_FLAGS_SAVED
   "${CMAKE_REQUIRED_FLAGS}${DEAL_II_CXX_VERSION_FLAG}${DEAL_II_WITH_CXX14}${DEAL_II_WITH_CXX17}"
   DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH
   DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
+  DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS
   DEAL_II_HAVE_FP_EXCEPTIONS
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
   )
@@ -682,4 +669,22 @@ CHECK_CXX_SOURCE_COMPILES(
   "
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS)
 
+#
+# 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 14d4a0c61fcebcba488807ffe3bb0c1f3e7b36d2..2aaa907e5b9e30f06235594921cac98140b64b77 100644 (file)
  */
 
 #cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
+#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 1245a0be17b655469d67d58d6cdea203af69febb..394a2ac814a4f3bd2a092fb856408d72fd3d33f5 100644 (file)
@@ -26,7 +26,7 @@
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_WITH_CXX17
+#ifdef DEAL_II_HAVE_CXX17_SPECIAL_MATH_FUNCTIONS
   double (&cyl_bessel_j)(double,
                          double) = boost::math::cyl_bessel_j<double, double>;
   float (&cyl_bessel_jf)(float,

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.