From 406891c62a4948ddee3c83a18b5d1453b159953d Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 7 Jan 2013 13:05:39 -0500 Subject: scons: Enforce gcc >= 4.4 or clang >= 2.9 and c++0x support This patch checks that the compiler in use is either gcc >= 4.4 or clang >= 2.9. and enables building with --std=c++0x in all cases. As a consequence, we can tidy up the hashmap and always have static_assert available. If anyone wants to use alternative compilers, icc for example supports c++0x to a similar level and could be added if needed. This patch opens up for a more elaborate use of c++0x features that are present in gcc 4.4 and clang 2.9, e.g. auto typed variables, variadic templates, rvalues and move semantics, and strongly typed enums. There will be no going back on this one... --- src/base/compiler.hh | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/base/compiler.hh') diff --git a/src/base/compiler.hh b/src/base/compiler.hh index 33654fc11..7176537d2 100644 --- a/src/base/compiler.hh +++ b/src/base/compiler.hh @@ -43,8 +43,6 @@ #ifndef __BASE_COMPILER_HH__ #define __BASE_COMPILER_HH__ -#include "config/have_static_assert.hh" - // http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html #if defined(__GNUC__) @@ -58,32 +56,4 @@ #error "Need to define compiler options in base/compiler.hh" #endif -/* - * Define a compatibility macro that emulates the behavior of - * static_assert using template magic if the compiler doesn't have - * native support. - */ -#if !HAVE_STATIC_ASSERT - -template -struct static_assert_failure; - -template<> -struct static_assert_failure {}; - -/* The following macro causes the compiler to evaluate the size of the - * static_assert_failure struct. The templates are designed so that - * only static_assert_failure evaluates to a proper size, while - * static_assert_failure generates a compile time error. - */ -#define static_assert(expr, msg) \ - namespace ns_static_assert { \ - enum { \ - static_assert_ ## __LINE__ = \ - sizeof(static_assert_failure) \ - }; \ - } - -#endif - #endif // __BASE_COMPILER_HH__ -- cgit v1.2.3