From 460536209b741bc469f1b0857775449abb2102fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= Date: Thu, 12 Dec 2013 02:15:52 +0100 Subject: Don't rely on gcc extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the code more compatible with different compilers. clang doesn't allow extra static qualifiers on template specializations, const qualifiers on function types, or inline attributes on lambda functions, and is more picky about casting away constness with reinterpret_cast. These modifications are compatible with both gcc and clang. Change-Id: I739b10df2780bec537827a13679fd2bcc2cc7188 Signed-off-by: Bernhard Rosenkränzer --- runtime/base/macros.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/base') diff --git a/runtime/base/macros.h b/runtime/base/macros.h index 00a530a..cf7029a 100644 --- a/runtime/base/macros.h +++ b/runtime/base/macros.h @@ -140,6 +140,13 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; #define ALWAYS_INLINE __attribute__ ((always_inline)) #endif +#ifdef __clang__ +/* clang doesn't like attributes on lambda functions */ +#define ALWAYS_INLINE_LAMBDA +#else +#define ALWAYS_INLINE_LAMBDA ALWAYS_INLINE +#endif + #if defined (__APPLE__) #define HOT_ATTR #define COLD_ATTR -- cgit v1.1