Skip to content
Snippets Groups Projects
Commit 5525e37a authored by Oliver Sander's avatar Oliver Sander
Browse files

Test for the 'final' keyword from C++11

This patch adds an AutoTools test that tests whether the compiler
supports the 'final' keyword.  It defines the DUNE_FINAL preprocessor
macro, which expands to 'final' if the keyword is supported, and
is empty otherwise.
parent aad0eac6
No related branches found
No related tags found
No related merge requests found
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_FINAL_HH
#define DUNE_COMMON_FINAL_HH
/** \file
* \brief Definition of the DUNE_FINAL macro, which encapsulates
* the 'final' keyword from C++11
*/
#if ! HAVE_KEYWORD_FINAL
#define DUNE_FINAL
#else
#define DUNE_FINAL final
#endif
#endif // DUNE_COMMON_FINAL_HH
......@@ -28,6 +28,7 @@ ALLM4S = \
dune_common.m4 \
dune_compiler.m4 \
dune_cxa_demangle.m4 \
dune_final.m4 \
dune_fortran.m4 \
dune_deprecated.m4 \
dune_deprecated_cppflags.m4 \
......
......@@ -31,6 +31,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([MAKE_SHARED])
AC_REQUIRE([DUNE_LINKCXX])
AC_REQUIRE([DUNE_CHECKDEPRECATED])
AC_REQUIRE([DUNE_CHECKFINAL])
AC_REQUIRE([DUNE_CHECKUNUSED])
AC_REQUIRE([DUNE_CHECK_CXA_DEMANGLE])
AC_REQUIRE([DUNE_SET_MINIMAL_DEBUG_LEVEL])
......
# Check if the 'final' keyword is supported
AC_DEFUN([DUNE_CHECKFINAL],[
AC_CACHE_CHECK([for keyword 'final'], dune_cv_keyword_final, [
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
struct Foo
{
virtual void foo() final;
};
]],
[])],
dune_cv_keyword_final="yes",
dune_cv_keyword_final="no")
AC_LANG_POP([C++])
])
AS_IF([test "x$dune_cv_keyword_final" = "xyes"],
[AC_DEFINE_UNQUOTED(HAVE_KEYWORD_FINAL,
1,
[does the compiler support the keyword 'final'?])],)
AH_BOTTOM([#include <dune/common/final.hh>])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment