]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for the availability of the always_inline attribute.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 7 Jan 2016 22:27:32 +0000 (16:27 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 Jan 2016 13:18:48 +0000 (07:18 -0600)
If not available, simply set DEAL_II_ALWAYS_INLINE to the empty string.

cmake/checks/check_01_compiler_features.cmake
include/deal.II/base/config.h.in

index d26a2f21e17bc8914d9c5b3280e2c92a955b9a37..62f6e0d8669c48c7be9c69fc8ca750ef73123d01 100644 (file)
@@ -1,6 +1,6 @@
 ## ---------------------------------------------------------------------
 ##
-## Copyright (C) 2012 - 2015 by the deal.II authors
+## Copyright (C) 2012 - 2016 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -30,7 +30,9 @@
 #   DEAL_II_HAVE_LIBSTDCXX_DEMANGLER
 #   DEAL_II_COMPILER_HAS_ATTRIBUTE_PRETTY_FUNCTION
 #   DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED
+#   DEAL_II_COMPILER_HAS_ATTRIBUTE_ALWAYS_INLINE
 #   DEAL_II_DEPRECATED
+#   DEAL_II_ALWAYS_INLINE
 #   DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA
 #   DEAL_II_COMPILER_HAS_FUSE_LD_GOLD
 #
@@ -316,6 +318,24 @@ ELSE()
 ENDIF()
 
 
+#
+# Do a similar check with the always_inline attribute on functions.
+#
+CHECK_CXX_SOURCE_COMPILES(
+  "
+          __attribute__((always_inline)) int fn () { return 0; }
+          int main () { return fn(); }
+  "
+  DEAL_II_COMPILER_HAS_ATTRIBUTE_ALWAYS_INLINE
+  )
+
+IF(DEAL_II_COMPILER_HAS_ATTRIBUTE_ALWAYS_INLINE)
+  SET(DEAL_II_ALWAYS_INLINE "__attribute__((always_inline))")
+ELSE()
+  SET(DEAL_II_ALWAYS_INLINE " ")
+ENDIF()
+
+
 #
 # GCC and Clang allow fine grained control of diagnostics via the "GCC
 # diagnostic" pragma. Check whether the compiler supports the "push" and
index f3b30859197e783ac954a6af5f82f427dd8b6421..c4dea5d5191f6dcdc1974084ec1ba503fe70536b 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2012 - 2015 by the deal.II authors
+// Copyright (C) 2012 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -86,6 +86,7 @@
 #cmakedefine DEAL_II_HAVE_LIBSTDCXX_DEMANGLER
 #cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@
 #cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@
+#cmakedefine DEAL_II_ALWAYS_INLINE @DEAL_II_ALWAYS_INLINE@
 #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.