]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add macro for __restrict keyword. 5838/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 1 Feb 2018 10:23:01 +0000 (11:23 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 1 Feb 2018 10:23:01 +0000 (11:23 +0100)
cmake/checks/check_01_compiler_features.cmake
include/deal.II/base/config.h.in

index d22d786fecc846d2d91a516518a4121fbc7796a3..479d274b3b920b77a450aaa48fbcca7451c98e96 100644 (file)
@@ -33,6 +33,7 @@
 #   DEAL_II_COMPILER_HAS_ATTRIBUTE_ALWAYS_INLINE
 #   DEAL_II_DEPRECATED
 #   DEAL_II_ALWAYS_INLINE
+#   DEAL_II_RESTRICT
 #   DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA
 #   DEAL_II_COMPILER_HAS_FUSE_LD_GOLD
 #
@@ -363,6 +364,23 @@ ELSE()
   SET(DEAL_II_ALWAYS_INLINE " ")
 ENDIF()
 
+#
+# Check whether the compiler understands the __restrict keyword.
+#
+CHECK_CXX_SOURCE_COMPILES(
+  "
+          void fn (double *__restrict a, double *__restrict b) { a[0] = b[0]; a[1] = b[0]; }
+          int main() { }
+  "
+  DEAL_II_COMPILER_HAS_RESTRICT_KEYWORD
+  )
+
+IF(DEAL_II_COMPILER_HAS_RESTRICT_KEYWORD)
+  SET(DEAL_II_RESTRICT "__restrict")
+ELSE()
+  SET(DEAL_II_RESTRICT " ")
+ENDIF()
+
 
 #
 # GCC and Clang allow fine grained control of diagnostics via the "GCC
index 89edbc5ae300078aa995c2a52612be612cf696de..151371bdc47e22bfa07ea326f386fd5ad2d316bc 100644 (file)
@@ -93,6 +93,7 @@
 #cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@
 #cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@
 #cmakedefine DEAL_II_ALWAYS_INLINE @DEAL_II_ALWAYS_INLINE@
+#cmakedefine DEAL_II_RESTRICT @DEAL_II_RESTRICT@
 #cmakedefine DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA
 
 

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.