Re-enable __restrict modifier for GCC, Clang 3.4, or Apple Clang 5.1. default tip
authorScott Ehlert <ds@alliedmods.net>
Mon Mar 10 22:36:34 2014 -0500 (2014-03-10)
changeset 33b5690123961c
parent 32 0e3574239649
Re-enable __restrict modifier for GCC, Clang 3.4, or Apple Clang 5.1.
public/tier0/platform.h
     1.1 --- a/public/tier0/platform.h	Fri Feb 28 16:10:02 2014 -0600
     1.2 +++ b/public/tier0/platform.h	Mon Mar 10 22:36:34 2014 -0500
     1.3 @@ -229,6 +229,10 @@
     1.4  // for when we don't care about how many bits we use
     1.5  typedef unsigned int		uint;
     1.6  
     1.7 +#if defined(__clang__)
     1.8 +#define CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
     1.9 +#endif
    1.10 +
    1.11  #ifdef _MSC_VER
    1.12  #pragma once
    1.13  // Ensure that everybody has the right compiler version installed. The version
    1.14 @@ -500,7 +504,12 @@
    1.15  	#define FMTFUNCTION( a, b )
    1.16  #elif defined(GNUC)
    1.17  	#define SELECTANY __attribute__((weak))
    1.18 -	#define RESTRICT
    1.19 +	// 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
    1.20 +	#if ( defined(LINUX) && !defined(DEDICATED) ) || ( defined(__clang__) && ( ( defined(__apple_build_version__) && CLANG_VERSION < 501 ) || CLANG_VERSION < 304 ) )	
    1.21 +		#define RESTRICT
    1.22 +	#else
    1.23 +		#define RESTRICT __restrict
    1.24 +	#endif
    1.25  	#define RESTRICT_FUNC
    1.26  	// squirrel.h does a #define printf DevMsg which leads to warnings when we try
    1.27  	// to use printf as the prototype format function. Using __printf__ instead.