From 24540d506d436bb75904ed9ea4e5b405903c5482 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 7 Jan 2016 16:27:32 -0600 Subject: [PATCH] Check for the availability of the always_inline attribute. If not available, simply set DEAL_II_ALWAYS_INLINE to the empty string. --- cmake/checks/check_01_compiler_features.cmake | 22 ++++++++++++++++++- include/deal.II/base/config.h.in | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cmake/checks/check_01_compiler_features.cmake b/cmake/checks/check_01_compiler_features.cmake index d26a2f21e1..62f6e0d866 100644 --- a/cmake/checks/check_01_compiler_features.cmake +++ b/cmake/checks/check_01_compiler_features.cmake @@ -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 diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index f3b3085919..c4dea5d519 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -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 -- 2.39.5