From 287a0388942ec5a99e12b6331e07798b117e289b Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Mon, 10 Mar 2014 22:36:34 -0500 Subject: [PATCH] Re-enable __restrict modifier for GCC, Clang 3.4, or Apple Clang 5.1. --- public/tier0/platform.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/tier0/platform.h b/public/tier0/platform.h index 6de637e8..8d6ce1b1 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -229,6 +229,10 @@ typedef double float64; // for when we don't care about how many bits we use typedef unsigned int uint; +#if defined(__clang__) +#define CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) +#endif + #ifdef _MSC_VER #pragma once // Ensure that everybody has the right compiler version installed. The version @@ -500,7 +504,12 @@ typedef void * HINSTANCE; #define FMTFUNCTION( a, b ) #elif defined(GNUC) #define SELECTANY __attribute__((weak)) - #define RESTRICT + // Versions of clang older than 3.4 or Apple's 5.1 mangle member function names with the __restrict modifier in a GCC-incompatible way + #if ( defined(LINUX) && !defined(DEDICATED) ) || ( defined(__clang__) && ( ( defined(__apple_build_version__) && CLANG_VERSION < 501 ) || CLANG_VERSION < 304 ) ) + #define RESTRICT + #else + #define RESTRICT __restrict + #endif #define RESTRICT_FUNC // squirrel.h does a #define printf DevMsg which leads to warnings when we try // to use printf as the prototype format function. Using __printf__ instead.