Check for static_assert support

floating-point
Nicolas Hake 2010-05-29 14:44:16 +02:00
parent b620bc24cf
commit ff2e4e05b0
3 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,7 @@ if(HAVE_NULLPTR)
CHECK_CXX_SOURCE_COMPILES("#include <cstddef>
template<class T> void f(T &&); template<> void f(std::nullptr_t &&) {} int main() { f(NULL); }" NULL_IS_NULLPTR_T)
endif()
CHECK_CXX_SOURCE_COMPILES("int main() { static_assert(true, \"\"); }" HAVE_STATIC_ASSERT)
if(MSVC_VERSION GREATER 1499)
# Activate minimal rebuild

View File

@ -191,3 +191,6 @@
/* Define to 1 if your NULL is an instance of std::nullptr_t. */
#cmakedefine NULL_IS_NULLPTR_T 1
/* Define to 1 if your compiler supports static_assert */
#cmakedefine HAVE_STATIC_ASSERT 1

View File

@ -136,6 +136,13 @@ typedef ptrdiff_t ssize_t;
#ifndef HAVE_STATIC_ASSERT
#include <boost/static_assert.hpp>
#define static_assert(x, y) BOOST_STATIC_ASSERT(x)
#endif
#if defined(__GNUC__)
// Allow checks for correct printf-usage
#define GNUC_FORMAT_ATTRIBUTE __attribute__ ((format (printf, 1, 2)))