Skip to content
Snippets Groups Projects
Commit 4e69da9a authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[CMake] Remove check for several features that are always supported.

Old feature support macros which were tested until 2.4, kept around
for one more release. As these are now always supported due to the
new compiler requirements, they are directly defined without an
explicit test.
parent 6eb0cf39
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,6 @@
# This module internally sets the following variables, which are then
# exported into the config.h of the current dune module.
#
# :code:`HAVE_NULLPTR`
# True if nullptr is available
#
# :code:`HAS_ATTRIBUTE_UNUSED`
# True if attribute unused is supported
#
......@@ -22,18 +19,6 @@
# :code:`HAS_ATTRIBUTE_DEPRECATED_MSG`
# True if attribute deprecated("msg") is supported
#
# :code:`HAVE_CONSTEXPR1`
# True if constexpr is supported
#
# :code:`HAVE_KEYWORD_FINAL`
# True if final is supported.
#
# :code:`HAVE_RANGE_BASED_FOR`
# True if range-based for is supported and working.
#
# :code:`HAVE_NOEXCEPT_SPECIFIER`
# True if nonexcept specifier is supported.
#
# .. cmake_variable:: DISABLE_CXX_VERSION_CHECK
#
# You may set this variable to TRUE to disable checking for
......@@ -122,42 +107,6 @@ endif()
# perform tests
include(CheckCXXSourceCompiles)
# nullptr
check_cxx_source_compiles("
int main(void)
{
char* ch = nullptr;
return 0;
}
" HAVE_NULLPTR
)
if(HAVE_NULLPTR)
check_cxx_source_compiles("
#include <cstddef>
int main(void)
{
std::nullptr_t npt = nullptr;
return 0;
}
" HAVE_NULLPTR_T
)
if (NOT HAVE_NULLPTR_T)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
message(FATAL_ERROR "Your compiler supports the 'nullptr' keyword, but not the type std::nullptr_t.
You are using an Intel compiler, where this error is typically caused by an outdated underlying system GCC.
Check if 'gcc --version' gives you at least GCC 4.6, otherwise please install a newer GCC and point your Intel compiler at it using the '-gcc-name' or '-gxx-name' options (see 'man icc' for further details)."
)
else()
message(FATAL_ERROR "Your compiler supports the 'nullptr' keyword, but not the type std::nullptr_t.
THIS SHOULD NOT HAPPEN FOR YOUR COMPILER!
Please submit a bug at https://dune-project.org/flyspray/"
)
endif()
endif()
endif()
# __attribute__((unused))
check_cxx_source_compiles("
int main(void)
......@@ -232,87 +181,6 @@ check_cxx_source_compiles("
" HAS_ATTRIBUTE_DEPRECATED_MSG
)
# constexpr
check_cxx_source_compiles("
constexpr int foo()
{ return 0; }
template<int v>
struct A
{
static const int value = v;
};
int main(void)
{
return A<foo()>::value;
}
" HAVE_CONSTEXPR
)
# keyword final
check_cxx_source_compiles("
struct Foo
{
virtual void foo() final;
};
int main(void)
{
return 0;
}
" HAVE_KEYWORD_FINAL
)
# range-based for
check_cxx_source_compiles("
int main(void)
{
int arr[3];
for(int &val : arr)
val = 0;
}
" HAVE_RANGE_BASED_FOR
)
# nonexcept specifier
check_cxx_source_compiles("
void func1() noexcept {}
void func2() noexcept(true) {}
template <class T>
void func3() noexcept(noexcept(T())) {}
int main(void)
{
func1();
func2();
func3<int>();
}
" HAVE_NOEXCEPT_SPECIFIER
)
# std::declval()
check_cxx_source_compiles("
#include <utility>
template<typename T>
struct check;
template<>
struct check<int&&>
{
int pass() { return 0; }
};
int main(void)
{
return check<decltype(std::declval<int>())>().pass();
}
" HAVE_STD_DECLVAL
)
# full support for is_indexable (checking whether a type supports operator[])
check_cxx_source_compiles("
#include <utility>
......
......@@ -50,9 +50,6 @@
/* Define to 1 if you have the symbol mprotect. */
#cmakedefine HAVE_MPROTECT 1
/* Define to 1 if nullptr is supported */
#cmakedefine HAVE_NULLPTR 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
......@@ -90,24 +87,19 @@
/* end private */
/* Define to 1 if C++11 constexpr is supported */
#cmakedefine HAVE_CONSTEXPR 1
/* Define to 1 if C++11 range-based for is supported */
#cmakedefine HAVE_RANGE_BASED_FOR 1
/* Define to 1 if C++11 nonexcept specifier is supported */
#cmakedefine HAVE_NOEXCEPT_SPECIFIER 1
/* Define to 1 if C++11 std::declval() is supported */
#cmakedefine HAVE_STD_DECLVAL 1
/* old feature support macros which were tested until 2.4, kept around for one more release */
/* As these are now always supported due to the new compiler requirements, they are directly */
/* defined without an explicit test. */
#define HAVE_NULLPTR 1
#define HAVE_CONSTEXPR 1
#define HAVE_RANGE_BASED_FOR 1
#define HAVE_NOEXCEPT_SPECIFIER 1
#define HAVE_STD_DECLVAL 1
#define HAVE_KEYWORD_FINAL 1
/* Define to 1 if the compiler properly supports testing for operator[] */
#cmakedefine HAVE_IS_INDEXABLE_SUPPORT 1
/* does the compiler support the keyword 'final'? */
#cmakedefine HAVE_KEYWORD_FINAL 1
/* Define to if the UMFPack library is available */
#cmakedefine HAVE_UMFPACK ENABLE_UMFPACK
......
......@@ -170,18 +170,8 @@ namespace Dune
return typename make_index_sequence_impl< sizeof...( T ) >::type();
}
#if HAVE_STD_DECLVAL
using std::declval;
#else
template <class T>
typename std::add_rvalue_reference<T>::type declval() DUNE_NOEXCEPT;
#endif
} // namespace Std
} // namespace Dune
......
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