From: Martin Kronbichler Date: Thu, 1 Feb 2018 10:23:01 +0000 (+0100) Subject: Add macro for __restrict keyword. X-Git-Tag: v9.0.0-rc1~488^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41ae5cbc581cc91379223252ecf8248c703ea0ab;p=dealii.git Add macro for __restrict keyword. --- diff --git a/cmake/checks/check_01_compiler_features.cmake b/cmake/checks/check_01_compiler_features.cmake index d22d786fec..479d274b3b 100644 --- a/cmake/checks/check_01_compiler_features.cmake +++ b/cmake/checks/check_01_compiler_features.cmake @@ -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 diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 89edbc5ae3..151371bdc4 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -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