]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Disable __builtin_expect for Intel compiler with constexpr enabled 8413/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 25 Jul 2019 04:38:19 +0000 (00:38 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 25 Jul 2019 04:38:19 +0000 (00:38 -0400)
cmake/checks/check_02_compiler_features.cmake

index e0f3225214c88f48012d58e7e77de6b6f8f5f956..2ac63a12fb66e62562333d206ba9405218856be6 100644 (file)
@@ -120,14 +120,21 @@ CHECK_CXX_COMPILER_BUG(
 # prediction unit in some cases. We use it in the AssertThrow
 # macros.
 #
+# Intel compilers don't handle __builtin_expect in C++14 constexpr contexts
+# properly so we disable this feature in case we are going to use
+# DEAL_II_CONSTEXPR with an Intel compiler.
+#
 # - Matthias Maier, rewritten 2012
 #
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  bool f() { return true; }
-  int main(){ if (__builtin_expect(f(),false)) {} }
-  "
-  DEAL_II_HAVE_BUILTIN_EXPECT)
+IF(NOT(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND
+       DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR))
+  CHECK_CXX_SOURCE_COMPILES(
+    "
+    bool f() { return true; }
+    int main(){ if (__builtin_expect(f(),false)) {} }
+    "
+    DEAL_II_HAVE_BUILTIN_EXPECT)
+ENDIF()
 
 
 #

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.