ovr_sdk
diff LibOVR/Src/Kernel/OVR_Compiler.h @ 0:1b39a1b46319
initial 0.4.4
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 14 Jan 2015 06:51:16 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/LibOVR/Src/Kernel/OVR_Compiler.h Wed Jan 14 06:51:16 2015 +0200 1.3 @@ -0,0 +1,1524 @@ 1.4 +/************************************************************************************ 1.5 + 1.6 +PublicHeader: OVR.h 1.7 +Filename : OVR_Compiler.h 1.8 +Content : Compiler-specific feature identification and utilities 1.9 +Created : June 19, 2014 1.10 +Notes : 1.11 + 1.12 +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 1.13 + 1.14 +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 1.15 +you may not use the Oculus VR Rift SDK except in compliance with the License, 1.16 +which is provided at the time of installation or download, or which 1.17 +otherwise accompanies this software in either electronic or hard copy form. 1.18 + 1.19 +You may obtain a copy of the License at 1.20 + 1.21 +http://www.oculusvr.com/licenses/LICENSE-3.2 1.22 + 1.23 +Unless required by applicable law or agreed to in writing, the Oculus VR SDK 1.24 +distributed under the License is distributed on an "AS IS" BASIS, 1.25 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.26 +See the License for the specific language governing permissions and 1.27 +limitations under the License. 1.28 + 1.29 +************************************************************************************/ 1.30 + 1.31 + 1.32 +#ifndef OVR_Compiler_h 1.33 +#define OVR_Compiler_h 1.34 + 1.35 +#pragma once 1.36 + 1.37 + 1.38 +// References 1.39 +// https://gcc.gnu.org/projects/cxx0x.html 1.40 +// https://gcc.gnu.org/projects/cxx1y.html 1.41 +// http://clang.llvm.org/cxx_status.html 1.42 +// http://msdn.microsoft.com/en-us/library/hh567368.aspx 1.43 +// https://docs.google.com/spreadsheet/pub?key=0AoBblDsbooe4dHZuVTRoSTFBejk5eFBfVk1GWlE5UlE&output=html 1.44 +// http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros 1.45 + 1.46 + 1.47 +//----------------------------------------------------------------------------------- 1.48 +// ***** Compiler 1.49 +// 1.50 +// The following compilers are defined: (OVR_CC_x) 1.51 +// 1.52 +// MSVC - Microsoft Visual C/C++ 1.53 +// INTEL - Intel C++ for Linux / Windows 1.54 +// GNU - GNU C++ 1.55 +// ARM - ARM C/C++ 1.56 + 1.57 +#if defined(__INTEL_COMPILER) 1.58 +// Intel 4.0 = 400 1.59 +// Intel 5.0 = 500 1.60 +// Intel 6.0 = 600 1.61 +// Intel 8.0 = 800 1.62 +// Intel 9.0 = 900 1.63 +# define OVR_CC_INTEL __INTEL_COMPILER 1.64 + 1.65 +#elif defined(_MSC_VER) 1.66 +// MSVC 5.0 = 1100 1.67 +// MSVC 6.0 = 1200 1.68 +// MSVC 7.0 (VC2002) = 1300 1.69 +// MSVC 7.1 (VC2003) = 1310 1.70 +// MSVC 8.0 (VC2005) = 1400 1.71 +// MSVC 9.0 (VC2008) = 1500 1.72 +// MSVC 10.0 (VC2010) = 1600 1.73 +// MSVC 11.0 (VC2012) = 1700 1.74 +// MSVC 12.0 (VC2013) = 1800 1.75 +# define OVR_CC_MSVC _MSC_VER 1.76 + 1.77 +#if _MSC_VER == 0x1600 1.78 +# if _MSC_FULL_VER < 160040219 1.79 +# error "Oculus does not support VS2010 without SP1 installed." 1.80 +# endif 1.81 +#endif 1.82 + 1.83 +#elif defined(__GNUC__) 1.84 +# define OVR_CC_GNU 1.85 + 1.86 +#elif defined(__clang__) 1.87 +# define OVR_CC_CLANG 1.88 + 1.89 +#elif defined(__CC_ARM) 1.90 +# define OVR_CC_ARM 1.91 + 1.92 +#else 1.93 +# error "Oculus does not support this Compiler" 1.94 +#endif 1.95 + 1.96 + 1.97 +//----------------------------------------------------------------------------------- 1.98 +// ***** OVR_CC_VERSION 1.99 +// 1.100 +// M = major version 1.101 +// m = minor version 1.102 +// p = patch release 1.103 +// b = build number 1.104 +// 1.105 +// Compiler Format Example 1.106 +// ---------------------------- 1.107 +// OVR_CC_GNU Mmm 408 means GCC 4.8 1.108 +// OVR_CC_CLANG Mmm 305 means clang 3.5 1.109 +// OVR_CC_MSVC MMMM 1700 means VS2012 1.110 +// OVR_CC_ARM Mmpbbb 401677 means 4.0, patch 1, build 677 1.111 +// OVR_CC_INTEL MMmm 1210 means 12.10 1.112 +// OVR_CC_EDG Mmm 407 means EDG 4.7 1.113 +// 1.114 +#if defined(OVR_CC_GNU) 1.115 + #define OVR_CC_VERSION ((__GNUC__ * 100) + __GNUC_MINOR__) 1.116 +#elif defined(OVR_CC_CLANG) 1.117 + #define OVR_CC_VERSION ((__clang_major__ * 100) + __clang_minor__) 1.118 +#elif defined(OVR_CC_MSVC) 1.119 + #define OVR_CC_VERSION _MSC_VER // Question: Should we recognize _MSC_FULL_VER? 1.120 +#elif defined(OVR_CC_ARM) 1.121 + #define OVR_CC_VERSION __ARMCC_VERSION 1.122 +#elif defined(OVR_CC_INTEL) 1.123 + #if defined(__INTEL_COMPILER) 1.124 + #define OVR_CC_VERSION __INTEL_COMPILER 1.125 + #elif defined(__ICL) 1.126 + #define OVR_CC_VERSION __ICL 1.127 + #elif defined(__ICC) 1.128 + #define OVR_CC_VERSION __ICC 1.129 + #elif defined(__ECC) 1.130 + #define OVR_CC_VERSION __ECC 1.131 + #endif 1.132 +#elif defined(OVR_CC_EDG) 1.133 + #define OVR_CC_VERSION __EDG_VERSION__ // This is a generic fallback for EDG-based compilers which aren't specified above (e.g. as OVR_CC_ARM) 1.134 +#endif 1.135 + 1.136 + 1.137 + 1.138 +// ----------------------------------------------------------------------------------- 1.139 +// ***** OVR_DISABLE_OPTIMIZATION / OVR_RESTORE_OPTIMIZATION 1.140 +// 1.141 +// Allows for the dynamic disabling and restoring of compiler optimizations in code. 1.142 +// This is useful for helping deal with potential compiler code generation problems. 1.143 +// With VC++ the usage must be outside of function bodies. This can be used only to 1.144 +// temporarily disable optimization for a block of code and not to temporarily enable 1.145 +// optimization for a block of code. 1.146 +// 1.147 +// Clang doesn't support this as of June 2014, though function __attribute__((optimize(0)) 1.148 +// is supposedly supported by clang in addition to GCC. To consider: Make a wrapper for 1.149 +// this attribute-based functionality. 1.150 +// 1.151 +// Example usage: 1.152 +// OVR_DISABLE_OPTIMIZATION() 1.153 +// void Test() { ... } 1.154 +// OVR_RESTORE_OPTIMIZATION() 1.155 +// 1.156 +#if !defined(OVR_DISABLE_OPTIMIZATION) 1.157 + #if defined(OVR_CC_GNU) && (OVR_CC_VERSION > 404) && (defined(OVR_CPU_X86) || defined(OVR_CPU_X86_64)) 1.158 + #define OVR_DISABLE_OPTIMIZATION() \ 1.159 + _Pragma("GCC push_options") \ 1.160 + _Pragma("GCC optimize 0") 1.161 + #elif defined(OVR_CC_MSVC) 1.162 + #define OVR_DISABLE_OPTIMIZATION() __pragma(optimize("", off)) 1.163 + #else 1.164 + #define OVR_DISABLE_OPTIMIZATION() 1.165 + #endif 1.166 +#endif 1.167 + 1.168 +#if !defined(OVR_RESTORE_OPTIMIZATION) 1.169 + #if defined(OVR_CC_GNU) && (OVR_CC_VERSION > 404) && (defined(OVR_CPU_X86) || defined(OVR_CPU_X86_64)) 1.170 + #define OVR_RESTORE_OPTIMIZATION() _Pragma("GCC pop_options") 1.171 + #elif defined(OVR_CC_MSVC) 1.172 + #define OVR_RESTORE_OPTIMIZATION() __pragma(optimize("", on)) 1.173 + #else 1.174 + #define OVR_RESTORE_OPTIMIZATION() 1.175 + #endif 1.176 +#endif 1.177 + 1.178 + 1.179 +// ----------------------------------------------------------------------------------- 1.180 +// ***** OVR_DISABLE_GNU_WARNING / OVR_RESTORE_GNU_WARNING 1.181 +// 1.182 +// Portable wrapper for disabling GCC compiler warnings, one at a time. See example 1.183 +// usage for usage by example. 1.184 +// 1.185 +// Example usage: 1.186 +// OVR_DISABLE_GNU_WARNING(-Wmissing-braces) // Only one warning per usage. 1.187 +// OVR_DISABLE_GNU_WARNING(-Wunused-variable) 1.188 +// <code> 1.189 +// OVR_RESTORE_GNU_WARNINGS() 1.190 +// OVR_RESTORE_GNU_WARNINGS() // Must match each disable with a restore. 1.191 +// 1.192 +#if !defined(OVR_DISABLE_GNU_WARNING) 1.193 + #if defined(OVR_CC_GNU) 1.194 + #define ODGW1(x) #x 1.195 + #define ODGW2(x) ODGW1(GCC diagnostic ignored x) 1.196 + #define ODGW3(x) ODGW2(#x) 1.197 + #endif 1.198 + 1.199 + #if defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 406) 1.200 + #define OVR_DISABLE_GNU_WARNING(w) \ 1.201 + _Pragma("GCC diagnostic push") \ 1.202 + _Pragma(ODGW3(w)) 1.203 + #elif defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 404) // GCC 4.4 doesn't support diagnostic push, but supports disabling warnings. 1.204 + #define OVR_DISABLE_GNU_WARNING(w) \ 1.205 + _Pragma(ODGW3(w)) 1.206 + #else 1.207 + #define OVR_DISABLE_GNU_WARNING(w) 1.208 + #endif 1.209 +#endif 1.210 + 1.211 +#if !defined(OVR_RESTORE_GNU_WARNING) 1.212 + #if defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 4006) 1.213 + #define OVR_RESTORE_GNU_WARNINGS() \ 1.214 + _Pragma("GCC diagnostic pop") 1.215 + #else 1.216 + #define OVR_RESTORE_GNU_WARNING() 1.217 + #endif 1.218 +#endif 1.219 + 1.220 + 1.221 + 1.222 +// ----------------------------------------------------------------------------------- 1.223 +// ***** OVR_DISABLE_CLANG_WARNING / OVR_RESTORE_CLANG_WARNING 1.224 +// 1.225 +// Portable wrapper for disabling GCC compiler warnings, one at a time. See example 1.226 +// usage for usage by example. 1.227 +// 1.228 +// Example usage: 1.229 +// OVR_DISABLE_CLANG_WARNING(-Wmissing-braces) // Only one warning per usage. 1.230 +// OVR_DISABLE_CLANG_WARNING(-Wunused-variable) 1.231 +// <code> 1.232 +// OVR_RESTORE_CLANG_WARNINGS() 1.233 +// OVR_RESTORE_CLANG_WARNINGS() // Must match each disable with a restore. 1.234 +// 1.235 +// 1.236 +#if !defined(OVR_DISABLE_CLANG_WARNING) 1.237 + #if defined(OVR_CC_CLANG) 1.238 + #define ODCW1(x) #x 1.239 + #define ODCW2(x) ODCW1(clang diagnostic ignored x) 1.240 + #define ODCW3(x) ODCW2(#x) 1.241 + 1.242 + #define OVR_DISABLE_CLANG_WARNING(w) \ 1.243 + _Pragma("clang diagnostic push") \ 1.244 + _Pragma(ODCW3(w)) 1.245 + #else 1.246 + #define OVR_DISABLE_CLANG_WARNING(w) 1.247 + #endif 1.248 +#endif 1.249 + 1.250 +#if !defined(OVR_RESTORE_CLANG_WARNING) 1.251 + #if defined(OVR_CC_CLANG) 1.252 + #define OVR_RESTORE_CLANG_WARNING() \ 1.253 + _Pragma("clang diagnostic pop") 1.254 + #else 1.255 + #define OVR_RESTORE_CLANG_WARNING() 1.256 + #endif 1.257 +#endif 1.258 + 1.259 + 1.260 +// ----------------------------------------------------------------------------------- 1.261 +// ***** OVR_DISABLE_MSVC_WARNING / OVR_RESTORE_MSVC_WARNING 1.262 +// 1.263 +// Portable wrapper for disabling VC++ compiler warnings. See example usage for usage 1.264 +// by example. 1.265 +// 1.266 +// Example usage: 1.267 +// OVR_DISABLE_MSVC_WARNING(4556 4782 4422) 1.268 +// <code> 1.269 +// OVR_RESTORE_MSVC_WARNING() 1.270 +// 1.271 +#if !defined(OVR_DISABLE_MSVC_WARNING) 1.272 + #if defined(OVR_CC_MSVC) 1.273 + #define OVR_DISABLE_MSVC_WARNING(w) \ 1.274 + __pragma(warning(push)) \ 1.275 + __pragma(warning(disable:w)) 1.276 + #else 1.277 + #define OVR_DISABLE_MSVC_WARNING(w) 1.278 + #endif 1.279 +#endif 1.280 + 1.281 +#if !defined(OVR_RESTORE_MSVC_WARNING) 1.282 + #if defined(OVR_CC_MSVC) 1.283 + #define OVR_RESTORE_MSVC_WARNING() \ 1.284 + __pragma(warning(pop)) 1.285 + #else 1.286 + #define OVR_RESTORE_MSVC_WARNING() 1.287 + #endif 1.288 +#endif 1.289 + 1.290 + 1.291 +// ----------------------------------------------------------------------------------- 1.292 +// ***** OVR_DISABLE_ALL_MSVC_WARNINGS / OVR_RESTORE_ALL_MSVC_WARNINGS 1.293 +// 1.294 +// Portable wrapper for disabling all VC++ compiler warnings. 1.295 +// OVR_RESTORE_ALL_MSVC_WARNINGS restores warnings that were disabled by 1.296 +// OVR_DISABLE_ALL_MSVC_WARNINGS. Any previously enabled warnings will still be 1.297 +// enabled after OVR_RESTORE_ALL_MSVC_WARNINGS. 1.298 +// 1.299 +// Example usage: 1.300 +// OVR_DISABLE_ALL_MSVC_WARNINGS() 1.301 +// <code> 1.302 +// OVR_RESTORE_ALL_MSVC_WARNINGS() 1.303 + 1.304 +#if !defined(OVR_DISABLE_ALL_MSVC_WARNINGS) 1.305 + #if defined(OVR_CC_MSVC) 1.306 + #define OVR_DISABLE_ALL_MSVC_WARNINGS() \ 1.307 + __pragma(warning(push, 0)) 1.308 + #else 1.309 + #define OVR_DISABLE_ALL_MSVC_WARNINGS() 1.310 + #endif 1.311 +#endif 1.312 + 1.313 +#if !defined(OVR_RESTORE_ALL_MSVC_WARNINGS) 1.314 + #if defined(OVR_CC_MSVC) 1.315 + #define OVR_RESTORE_ALL_MSVC_WARNINGS() \ 1.316 + __pragma(warning(pop)) 1.317 + #else 1.318 + #define OVR_RESTORE_ALL_MSVC_WARNINGS() 1.319 + #endif 1.320 +#endif 1.321 + 1.322 + 1.323 +//----------------------------------------------------------------------------------- 1.324 +// ***** OVR_CC_HAS_FEATURE 1.325 +// 1.326 +// This is a portable way to use compile-time feature identification available 1.327 +// with some compilers in a clean way. Direct usage of __has_feature in preprocessing 1.328 +// statements of non-supporting compilers results in a preprocessing error. 1.329 +// 1.330 +// Example usage: 1.331 +// #if OVR_CC_HAS_FEATURE(is_pod) 1.332 +// if(__is_pod(T)) // If the type is plain data then we can safely memcpy it. 1.333 +// memcpy(&destObject, &srcObject, sizeof(object)); 1.334 +// #endif 1.335 +// 1.336 +#if !defined(OVR_CC_HAS_FEATURE) 1.337 + #if defined(__clang__) // http://clang.llvm.org/docs/LanguageExtensions.html#id2 1.338 + #define OVR_CC_HAS_FEATURE(x) __has_feature(x) 1.339 + #else 1.340 + #define OVR_CC_HAS_FEATURE(x) 0 1.341 + #endif 1.342 +#endif 1.343 + 1.344 + 1.345 +//----------------------------------------------------------------------------------- 1.346 +// ***** OVR_CC_HAS_BUILTIN 1.347 +// 1.348 +// 1.349 +// This is a portable way to use compile-time builtin identification available 1.350 +// with some compilers in a clean way. Direct usage of __has_builtin in preprocessing 1.351 +// statements of non-supporting compilers results in a preprocessing error. 1.352 +// 1.353 +// Example usage: 1.354 +// #if OVR_CC_HAS_BUILTIN(__builtin_trap) 1.355 +// #define DEBUG_BREAK __builtin_trap 1.356 +// #endif 1.357 +// 1.358 +#if !defined(OVR_CC_HAS_BUILTIN) 1.359 + #if defined(__clang__) 1.360 + #define OVR_CC_HAS_BUILTIN(x) __has_builtin(x) // http://clang.llvm.org/docs/LanguageExtensions.html#id2 1.361 + #else 1.362 + #define OVR_CC_HAS_BUILTIN(x) 0 1.363 + #endif 1.364 +#endif 1.365 + 1.366 + 1.367 +//----------------------------------------------------------------------------------- 1.368 +// ***** OVR_CPP11_ENABLED / OVR_CPP_CPP14_ENABLED 1.369 +// 1.370 +// Defined as 1 if the compiler has its available C++11 support enabled, else undefined. 1.371 +// This does not mean that all of C++11 or any particular feature of C++11 is supported 1.372 +// by the compiler. It means that whatever C++11 support the compiler has is enabled. 1.373 +// This also includes existing and older compilers that still identify C++11 as C++0x. 1.374 +// 1.375 +#if !defined(OVR_CPP11_ENABLED) && defined(__cplusplus) 1.376 + #if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) 1.377 + #define OVR_CPP11_ENABLED 1 1.378 + #elif defined(_MSC_VER) && (_MSC_VER >= 1500) // VS2010+, the first version with any significant C++11 support. 1.379 + #define OVR_CPP11_ENABLED 1 1.380 + #elif (__cplusplus >= 201103L) // 201103 is the first C++11 version. 1.381 + #define OVR_CPP11_ENABLED 1 1.382 + #else 1.383 + // Leave undefined 1.384 + #endif 1.385 +#endif 1.386 + 1.387 +#if !defined(OVR_CPP_CPP14_ENABLED) && defined(__cplusplus) 1.388 + #if defined(_MSC_VER) && (_MSC_VER >= 1800) // VS2013+, the first version with any significant C++14 support. 1.389 + #define OVR_CPP_CPP14_ENABLED 1 1.390 + #elif (__cplusplus > 201103L) 1.391 + #define OVR_CPP_CPP14_ENABLED 1 1.392 + #else 1.393 + // Leave undefined 1.394 + #endif 1.395 +#endif 1.396 + 1.397 + 1.398 +//----------------------------------------------------------------------------------- 1.399 +// ***** OVR_CPP_NO_EXCEPTIONS / OVR_CPP_NO_UNWIND 1.400 +// 1.401 +// OVR_CPP_NO_EXCEPTIONS is defined as 1 if the compiler doesn't support C++ 1.402 +// exceptions or is configured to disable support for them. Else not defined. 1.403 +// If OVR_CPP_NO_EXCEPTIONS is defined then attempts to use try/catch 1.404 +// related C++ statements result in a compilation error with many 1.405 +// compilers. 1.406 +// 1.407 +// OVR_CPP_NO_UNWIND is defined as 1 if the compiler supports exceptions but 1.408 +// doesn't support stack unwinding in the presence of an exception. Else not defined. 1.409 +// For the Microsoft compiler, disabling exceptions means disabling stack unwinding 1.410 +// and not disabling exceptions themselves. 1.411 +// 1.412 +// Example usage: 1.413 +// void Test() { 1.414 +// #if !defined(OVR_CPP_NO_EXCEPTIONS) 1.415 +// try { 1.416 +// #endif 1.417 +// void* ptr = new Object; 1.418 +// #if !defined(OVR_CPP_NO_EXCEPTIONS) 1.419 +// catch(...) { ... } 1.420 +// #endif 1.421 + 1.422 +#if !defined(OVR_CPP_NO_EXCEPTIONS) 1.423 + #if defined(OVR_CPP_GNUC) && defined(_NO_EX) 1.424 + #define OVR_CPP_NO_EXCEPTIONS 1 1.425 + #elif (defined(OVR_CC_GNU) || defined(OVR_CC_CLANG) || defined(OVR_CC_INTEL) || defined(OVR_CC_ARM)) && !defined(__EXCEPTIONS) 1.426 + #define OVR_CPP_NO_EXCEPTIONS 1 1.427 + #elif defined(OVR_CC_MSVC) && !defined(_CPPUNWIND) 1.428 + #define OVR_CPP_NO_UNWIND 1 1.429 + #endif 1.430 +#endif 1.431 + 1.432 + 1.433 +//----------------------------------------------------------------------------------- 1.434 +// ***** OVR_CPP_NO_RTTI 1.435 +// 1.436 +// Defined as 1 if C++ run-time type information support is unavailable or disabled 1.437 +// by the compiler. Else undefined. Allows you to write portable code in the face 1.438 +// of the possibility that RTTI is disabled. 1.439 +// 1.440 +// Example usage: 1.441 +// #if !OVR_CPP_NO_RTTI 1.442 +// #include <typeinfo> 1.443 +// int x = std::dynamic_cast<int>(3.4f); 1.444 +// #endif 1.445 + 1.446 +#if defined(__clang__) && !OVR_CC_HAS_FEATURE(cxx_rtti) 1.447 + #define OVR_CPP_NO_RTTI 1 1.448 +#elif defined(__GNUC__) && !defined(__GXX_RTTI) 1.449 + #define OVR_CPP_NO_RTTI 1 1.450 +#elif defined(_MSC_VER) && !defined(_CPPRTTI) 1.451 + #define OVR_CPP_NO_RTTI 1 1.452 +#elif defined(__CC_ARM) && defined(__TARGET_CPU_MPCORE) && !defined(__RTTI) 1.453 + #define OVR_CPP_NO_RTTI 1 1.454 +#endif 1.455 + 1.456 + 1.457 +//----------------------------------------------------------------------------------- 1.458 +// ***** OVR_CPP_NO_STATIC_ASSERT 1.459 +// 1.460 +// Defined as 1 if C++ run-time type information support is available and enabled 1.461 +// by the compiler. Else undefined. 1.462 +// 1.463 +// Example usage: 1.464 +// #if OVR_CPP_NO_STATIC_ASSERT 1.465 +// #define MY_ASSERT(x) { int zero = 0; switch(zero) {case 0: case (x):;} } 1.466 +// #else 1.467 +// #define MY_ASSERT(x) static_assert((x), #x) 1.468 +// #endif 1.469 + 1.470 +#if !defined(OVR_CPP_NO_STATIC_ASSERT) 1.471 + #if !(defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && (__cplusplus >= 201103L)))) && \ 1.472 + !(defined(__clang__) && defined(__cplusplus) && OVR_CC_HAS_FEATURE(cxx_static_assert)) && \ 1.473 + !(defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)) && /* VS2010+ */ \ 1.474 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) && defined(OVR_CPP11_ENABLED)) /* EDG 4.1+ */ 1.475 + #define OVR_CPP_NO_STATIC_ASSERT 1 1.476 + #endif 1.477 +#endif 1.478 + 1.479 + 1.480 +//----------------------------------------------------------------------------------- 1.481 +// ***** OVR_CPP_NO_NULLPTR 1.482 +// 1.483 +// Defined as 1 if the compiler doesn't support C++11 nullptr built in type. 1.484 +// Otherwise undefined. Does not identify if the standard library defines 1.485 +// std::nullptr_t, as some standard libraries are further behind in standardization 1.486 +// than the compilers using them (e.g. Apple clang with the supplied libstdc++). 1.487 +// 1.488 +// OVR_Nullptr.h provides a portable nullptr and std::nullptr_t for when the 1.489 +// compiler or standard library do not. 1.490 + 1.491 +#if !defined(OVR_CPP_NO_NULLPTR) 1.492 + #if !defined(OVR_CPP11_ENABLED) || \ 1.493 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_nullptr)) /* clang */ && \ 1.494 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.495 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.496 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */ 1.497 + #define OVR_CPP_NO_NULLPTR 1 1.498 + #endif 1.499 +#endif 1.500 + 1.501 + 1.502 +//----------------------------------------------------------------------------------- 1.503 +// ***** OVR_CPP_NO_RVALUE_REFERENCES 1.504 +// 1.505 +// Defined as 1 if the compiler doesn't support C++11 rvalue references and move semantics. 1.506 +// Otherwise undefined. 1.507 + 1.508 +#if !defined(OVR_CPP_NO_RVALUE_REFERENCES) 1.509 + #if !defined(OVR_CPP11_ENABLED) || \ 1.510 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_rvalue_references)) /* clang */ && \ 1.511 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.512 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.513 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */ 1.514 + #define OVR_CPP_NO_RVALUE_REFERENCES 1 1.515 + #endif 1.516 +#endif 1.517 + 1.518 + 1.519 +//----------------------------------------------------------------------------------- 1.520 +// ***** OVR_CPP_NO_AUTO 1.521 +// 1.522 +// Defined as 1 if the compiler doesn't support C++11 auto keyword. Otherwise undefined. 1.523 + 1.524 +#if !defined(OVR_CPP_NO_AUTO) 1.525 + #if !defined(OVR_CPP11_ENABLED) || \ 1.526 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_auto_type)) /* clang */ && \ 1.527 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.528 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.529 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 309))) /* EDG 3.9+ */ 1.530 + #define OVR_CPP_NO_AUTO 1 1.531 + #endif 1.532 +#endif 1.533 + 1.534 + 1.535 +//----------------------------------------------------------------------------------- 1.536 +// ***** OVR_CPP_NO_RANGE_BASED_FOR_LOOP 1.537 +// 1.538 +// Defined as 1 if the compiler doesn't support C++11 range-based for loops. 1.539 +// Otherwise undefined. 1.540 + 1.541 +#if !defined(OVR_CPP_NO_RANGE_BASED_FOR_LOOP) 1.542 + #if !defined(OVR_CPP11_ENABLED) || \ 1.543 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_range_for)) /* clang */ && \ 1.544 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.545 + !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \ 1.546 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.547 + #define OVR_CPP_NO_RANGE_BASED_FOR_LOOP 1 1.548 + #endif 1.549 +#endif 1.550 + 1.551 + 1.552 +//----------------------------------------------------------------------------------- 1.553 +// ***** OVR_CPP_NO_CONSTEXPR / OVR_CPP_NO_RELAXED_CONSTEXPR 1.554 +// 1.555 +// OVR_CPP_NO_CONSTEXPR is defined as 1 if the compiler doesn't support C++11 constexpr. 1.556 +// OVR_CPP_NO_RELAXED_CONSTEXPR is defined as 1 if the compiler doesn't support C++14 constexpr. 1.557 +// Otherwise undefined. 1.558 +// See the OVR_CONSTEXPR / OVR_CONSTEXPR_OR_CONST macros for portable wrappers of this functionality. 1.559 + 1.560 +#if !defined(OVR_CPP_NO_CONSTEXPR) 1.561 + #if !defined(OVR_CPP11_ENABLED) || \ 1.562 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_constexpr)) /* clang */ && \ 1.563 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.564 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */ 1.565 + // Not supported by VC++ through at least VS2013. 1.566 + #define OVR_CPP_NO_CONSTEXPR 1 1.567 + #endif 1.568 +#endif 1.569 + 1.570 +#if !defined(OVR_CPP_NO_RELAXED_CONSTEXPR) 1.571 + #if !defined(OVR_CPP14_ENABLED) || \ 1.572 + !(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_relaxed_constexpr)) /* clang */ 1.573 + // Supported only by clang as of this writing. 1.574 + #define OVR_CPP_NO_RELAXED_CONSTEXPR 1 1.575 + #endif 1.576 +#endif 1.577 + 1.578 + 1.579 +//----------------------------------------------------------------------------------- 1.580 +// ***** OVR_CPP_NO_LAMBDA_EXPRESSIONS 1.581 +// 1.582 +// Defined as 1 if the compiler doesn't support C++11 lambda expressions. Otherwise undefined. 1.583 +// Some compilers have slightly crippled versions of this. 1.584 + 1.585 +#if !defined(OVR_CPP_NO_LAMBDA_EXPRESSIONS) 1.586 + #if !defined(OVR_CPP11_ENABLED) || \ 1.587 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_lambdas)) /* clang */ && \ 1.588 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.589 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.590 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.591 + // Conversion of lambdas to function pointers is not supported until EDG 4.5. 1.592 + #define OVR_CPP_NO_LAMBDA_EXPRESSIONS 1 1.593 + #endif 1.594 +#endif 1.595 + 1.596 + 1.597 +//----------------------------------------------------------------------------------- 1.598 +// ***** OVR_CPP_NO_ALIGNOF 1.599 +// 1.600 +// Defined as 1 if the compiler supports C++11 alignof. Otherwise undefined. 1.601 +// Some compilers support __alignof__ instead of alignof, so for portability you 1.602 +// should use OVR_ALIGNOF instead of directly using C++11 alignof. 1.603 + 1.604 +#if !defined(OVR_CPP_NO_ALIGNOF) 1.605 + #if !defined(OVR_CPP11_ENABLED) || \ 1.606 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.607 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 300)) /* Apple clang 3.0+ */ && \ 1.608 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 401)) /* GCC 4.1+ */ && \ 1.609 + !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \ 1.610 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 400))) /* EDG 4.0+ */ 1.611 + #define OVR_CPP_NO_ALIGNOF 1 1.612 + #endif 1.613 +#endif 1.614 + 1.615 + 1.616 +//----------------------------------------------------------------------------------- 1.617 +// ***** OVR_CPP_NO_ALIGNAS 1.618 +// 1.619 +// Defined as 1 if the compiler supports C++11 alignas. Otherwise undefined. 1.620 +// See the OVR_ALIGNAS for a portable wrapper for alignas functionality. 1.621 + 1.622 +#if !defined(OVR_CPP_NO_ALIGNAS) 1.623 + #if !defined(OVR_CPP11_ENABLED) || \ 1.624 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \ 1.625 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.626 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \ 1.627 + !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \ 1.628 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.629 + #define OVR_CPP_NO_ALIGNAS 1 1.630 + #endif 1.631 +#endif 1.632 + 1.633 + 1.634 +//----------------------------------------------------------------------------------- 1.635 +// ***** OVR_CPP_NO_OVERRIDE 1.636 +// 1.637 +// Defined as 1 if the compiler doesn't support C++11 override. Otherwise undefined. 1.638 +// See the OVR_OVERRIDE and OVR_FINALOVERRIDE macros for a portable wrapper. 1.639 + 1.640 +#if !defined(OOVR_CPP_NO_OVERRIDE) 1.641 + #if !defined(OVR_CPP11_ENABLED) || \ 1.642 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.643 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \ 1.644 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.645 + !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \ 1.646 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.647 + #define OVR_CPP_NO_OVERRIDE 1 1.648 + #endif 1.649 +#endif 1.650 + 1.651 + 1.652 +//----------------------------------------------------------------------------------- 1.653 +// ***** OVR_CPP_NO_FINAL 1.654 +// 1.655 +// Defined as 1 if the compiler doesn't support C++11 final attribute. Otherwise undefined. 1.656 +// See the OVR_FINAL and OVR_FINALOVERRIDE macros for a portable wrapper. 1.657 + 1.658 +#if !defined(OOVR_CPP_NO_FINAL) 1.659 + #if !defined(OVR_CPP11_ENABLED) || \ 1.660 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.661 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \ 1.662 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.663 + !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \ 1.664 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.665 + #define OVR_CPP_NO_FINAL 1 1.666 + #endif 1.667 +#endif 1.668 + 1.669 + 1.670 +//----------------------------------------------------------------------------------- 1.671 +// ***** OVR_CPP_NO_EXTERN_TEMPLATE 1.672 +// 1.673 +// Defined as 1 if the compiler doesn't support C++11 extern template. 1.674 +// Otherwise undefined. See OVR_EXTERN_TEMPLATE for wrapper macro. 1.675 + 1.676 +#if !defined(OVR_CPP_NO_EXTERN_TEMPLATE) 1.677 + #if !defined(OVR_CPP11_ENABLED) || \ 1.678 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.679 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.680 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.681 + !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \ 1.682 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.683 + #define OVR_CPP_NO_EXTERN_TEMPLATE 1 1.684 + #endif 1.685 +#endif 1.686 + 1.687 + 1.688 +//----------------------------------------------------------------------------------- 1.689 +// ***** OVR_CPP_NO_VARIADIC_TEMPLATES 1.690 +// 1.691 +// Defined as 1 if the compiler doesn't support C++11 variadic templates. Otherwise undefined. 1.692 + 1.693 +#if !defined(OVR_CPP_NO_VARIADIC_TEMPLATES) 1.694 + #if !defined(OVR_CPP11_ENABLED) || \ 1.695 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_variadic_templates)) /* clang */ && \ 1.696 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.697 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.698 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */ 1.699 + #define OVR_CPP_NO_VARIADIC_TEMPLATES 1 1.700 + #endif 1.701 +#endif 1.702 + 1.703 + 1.704 +//----------------------------------------------------------------------------------- 1.705 +// ***** OVR_CPP_NO_NOEXCEPT 1.706 +// 1.707 +// Defined as 1 if the compiler supports C++11 noexcept. Otherwise undefined. 1.708 +// http://en.cppreference.com/w/cpp/language/noexcept 1.709 +// See OVR_NOEXCEPT / OVR_NOEXCEPT_IF / OVR_NOEXCEPT_EXPR for a portable wrapper 1.710 +// for noexcept functionality. 1.711 + 1.712 +#if !defined(OVR_CPP_NO_NOEXCEPT) 1.713 + #if !defined(OVR_CPP11_ENABLED) || \ 1.714 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_noexcept)) /* clang */ && \ 1.715 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.716 + !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \ 1.717 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.718 + #define OVR_CPP_NO_NOEXCEPT 1 1.719 + #endif 1.720 +#endif 1.721 + 1.722 + 1.723 +//----------------------------------------------------------------------------------- 1.724 +// ***** OVR_CPP_NO_DECLTYPE 1.725 +// 1.726 +// Defined as 1 if the compiler doesn't support C++11 decltype. Otherwise undefined. 1.727 +// Some compilers (e.g. VS2012) support most uses of decltype but don't support 1.728 +// decltype with incomplete types (which is an uncommon usage seen usually in 1.729 +// template metaprogramming). We don't include this support as a requirement for 1.730 +// our definition of decltype support here. 1.731 + 1.732 +#if !defined(OVR_CPP_NO_DECLTYPE) 1.733 + #if !defined(OVR_CPP11_ENABLED) || \ 1.734 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_decltype)) /* clang */ && \ 1.735 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \ 1.736 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.737 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */ 1.738 + // VC++ fails to support decltype for incomplete types until VS2013. 1.739 + // EDG fails to support decltype for incomplete types until v4.8. 1.740 + #define OVR_CPP_NO_DECLTYPE 1 1.741 + #endif 1.742 +#endif 1.743 + 1.744 + 1.745 +//----------------------------------------------------------------------------------- 1.746 +// ***** OVR_CPP_NO_DEFAULTED_FUNCTIONS 1.747 +// 1.748 +// Defined as 1 if the compiler doesn't support C++11 defaulted functions. Otherwise undefined. 1.749 +// Some compilers have slightly crippled versions of this. 1.750 + 1.751 +#if !defined(OVR_CPP_NO_DEFAULTED_FUNCTIONS) 1.752 + #if !defined(OVR_CPP11_ENABLED) || \ 1.753 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_defaulted_functions))/* clang */ && \ 1.754 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.755 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.756 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.757 + // Up through at least VS2013 it's unsupported for defaulted move constructors and move assignment operators. 1.758 + // Until EDG 4.8 it's unsupported for defaulted move constructors and move assigment operators. 1.759 + #define OVR_CPP_NO_DEFAULTED_FUNCTIONS 1 1.760 + #endif 1.761 +#endif 1.762 + 1.763 + 1.764 +//----------------------------------------------------------------------------------- 1.765 +// ***** OVR_CPP_NO_DELETED_FUNCTIONS 1.766 +// 1.767 +// Defined as 1 if the compiler doesn't support C++11 deleted functions. Otherwise undefined. 1.768 +// Some compilers have slightly crippled versions of this. 1.769 + 1.770 +#if !defined(OVR_CPP_NO_DELETED_FUNCTIONS) 1.771 + #if !defined(OVR_CPP11_ENABLED) || \ 1.772 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_defaulted_functions)) /* clang */ && \ 1.773 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.774 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.775 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.776 + // Up through at least VS2013 it's unsupported for defaulted move constructors and move assignment operators. 1.777 + // Until EDG 4.8 it's unsupported for defaulted move constructors and move assigment operators. 1.778 + #define OVR_CPP_NO_DELETED_FUNCTIONS 1 1.779 + #endif 1.780 +#endif 1.781 + 1.782 + 1.783 +//----------------------------------------------------------------------------------- 1.784 +// ***** OVR_CPP_NO_STANDARD_LAYOUT_TYPES 1.785 +// 1.786 +// Defined as 1 if the compiler doesn't support C++11 standard layout (relaxed POD). Otherwise undefined. 1.787 +// http://en.cppreference.com/w/cpp/types/is_standard_layout 1.788 + 1.789 +#if !defined(OVR_CPP_NO_STANDARD_LAYOUT_TYPES) 1.790 + #if !defined(OVR_CPP11_ENABLED) || \ 1.791 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \ 1.792 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.793 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.794 + !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2013+ */ && \ 1.795 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */ 1.796 + #define OVR_CPP_NO_STANDARD_LAYOUT_TYPES 1 1.797 + #endif 1.798 +#endif 1.799 + 1.800 + 1.801 +//----------------------------------------------------------------------------------- 1.802 +// ***** OVR_CPP_NO_FORWARD_DECLARED_ENUMS 1.803 +// 1.804 +// Defined as 1 if the compiler doesn't support C++11 forward declared enums. Otherwise undefined. 1.805 + 1.806 +#if !defined(OVR_CPP_NO_FORWARD_DECLARED_ENUMS) 1.807 + #if !defined(OVR_CPP11_ENABLED) || \ 1.808 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.809 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.810 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.811 + !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \ 1.812 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.813 + #define OVR_CPP_NO_FORWARD_DECLARED_ENUMS 1 1.814 + #endif 1.815 +#endif 1.816 + 1.817 + 1.818 +//----------------------------------------------------------------------------------- 1.819 +// ***** OVR_CPP_NO_STRONGLY_TYPED_ENUMS 1.820 +// 1.821 +// Defined as 1 if the compiler doesn't support C++11 strongly typed enums. Otherwise undefined. 1.822 + 1.823 +#if !defined(OVR_CPP_NO_STRONGLY_TYPED_ENUMS) 1.824 + #if !defined(OVR_CPP11_ENABLED) || \ 1.825 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_strong_enums)) /* clang */ && \ 1.826 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.827 + !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \ 1.828 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 400))) /* EDG 4.0+ */ 1.829 + #define OVR_CPP_NO_STRONGLY_TYPED_ENUMS 1 1.830 + #endif 1.831 +#endif 1.832 + 1.833 + 1.834 +//----------------------------------------------------------------------------------- 1.835 +// ***** OVR_CPP_NO_TRAILING_RETURN_TYPES 1.836 +// 1.837 +// Defined as 1 if the compiler doesn't support C++11 trailing return types. Otherwise undefined. 1.838 +// http://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax 1.839 + 1.840 +#if !defined(OVR_CPP_NO_TRAILING_RETURN_TYPES) 1.841 + #if !defined(OVR_CPP11_ENABLED) || \ 1.842 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_trailing_return)) /* clang */ && \ 1.843 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.844 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.845 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.846 + #define OVR_CPP_NO_TRAILING_RETURN_TYPES 1 1.847 + #endif 1.848 +#endif 1.849 + 1.850 + 1.851 +//----------------------------------------------------------------------------------- 1.852 +// ***** OVR_CPP_NO_TEMPLATE_ALIASES 1.853 +// 1.854 +// Defined as 1 if the compiler doesn't support C++11 template aliases. Otherwise undefined. 1.855 + 1.856 +#if !defined(OVR_CPP_NO_TEMPLATE_ALIASES) 1.857 + #if !defined(OVR_CPP11_ENABLED) || \ 1.858 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_alias_templates)) /* clang */ && \ 1.859 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.860 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.861 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */ 1.862 + #define OVR_CPP_NO_TEMPLATE_ALIASES 1 1.863 + #endif 1.864 +#endif 1.865 + 1.866 + 1.867 +//----------------------------------------------------------------------------------- 1.868 +// ***** OVR_CPP_NO_INITIALIZER_LISTS 1.869 +// 1.870 +// Defined as 1 if the compiler doesn't support C++11 initializer lists. Otherwise undefined. 1.871 +// This refers to the compiler support for this and not the Standard Library support for std::initializer_list, 1.872 +// as a new compiler with an old standard library (e.g. Apple clang with libstdc++) may not support std::initializer_list. 1.873 + 1.874 +#if !defined(OVR_CPP_NO_INITIALIZER_LISTS) 1.875 + #if !defined(OVR_CPP11_ENABLED) || \ 1.876 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_generalized_initializers)) /* clang */ && \ 1.877 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.878 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.879 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.880 + #define OVR_CPP_NO_INITIALIZER_LISTS 1 1.881 + #endif 1.882 +#endif 1.883 + 1.884 + 1.885 +//----------------------------------------------------------------------------------- 1.886 +// ***** OVR_CPP_NO_NORETURN 1.887 +// 1.888 +// Defined as 1 if the compiler doesn't support the C++11 noreturn attribute. Otherwise undefined. 1.889 +// http://en.cppreference.com/w/cpp/language/attributes 1.890 +// 1.891 +#if !defined(OVR_CPP_NO_NORETURN) 1.892 + #if !defined(OVR_CPP11_ENABLED) || \ 1.893 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.894 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.895 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \ 1.896 + !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \ 1.897 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */ 1.898 + // Supported with VC++ only via __declspec(noreturn) (see OVR_NORETURN). 1.899 + #define OVR_CPP_NO_NORETURN 1 1.900 + #endif 1.901 +#endif 1.902 + 1.903 + 1.904 +//----------------------------------------------------------------------------------- 1.905 +// ***** OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS 1.906 +// 1.907 +// Defined as 1 if the compiler doesn't support C++11 in-class non-static member initializers. Otherwise undefined. 1.908 +// http://en.cppreference.com/w/cpp/language/data_members 1.909 + 1.910 +#if !defined(OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS) 1.911 + #if !defined(OVR_CPP11_ENABLED) || \ 1.912 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.913 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.914 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.915 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.916 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */ 1.917 + #define OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS 1 1.918 + #endif 1.919 +#endif 1.920 + 1.921 + 1.922 +//----------------------------------------------------------------------------------- 1.923 +// ***** OVR_CPP_NO_DOUBLE_TEMPLATE_BRACKETS 1.924 +// 1.925 +// Defined as 1 if the compiler supports nested template declarations with >>, 1.926 +// as supported by C++11. Otherwise undefined. 1.927 + 1.928 +#if !defined(OVR_CPP_NO_DOUBLE_TEMPLATE_ANGLE_BRACKETS) 1.929 + #if !defined(OVR_CPP11_ENABLED) || \ 1.930 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.931 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \ 1.932 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \ 1.933 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.934 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.935 + #define OVR_CPP_NO_DOUBLE_TEMPLATE_BRACKETS 1 1.936 + #endif 1.937 +#endif 1.938 + 1.939 + 1.940 + 1.941 +//----------------------------------------------------------------------------------- 1.942 +// ***** OVR_CPP_NO_INHERITING_CONSTRUCTORS 1.943 +// 1.944 +// Defined as 1 if the compiler supports C++11 inheriting constructors. Otherwise undefined. 1.945 +// Example usage: 1.946 +// struct A { explicit A(int x){} }; 1.947 +// struct B : public A { using A::A; }; // As if B redeclared A::A(int). 1.948 + 1.949 +#if !defined(OVR_CPP_NO_INHERITING_CONSTRUCTORS) 1.950 + #if !defined(OVR_CPP11_ENABLED) || \ 1.951 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_inheriting_constructors)) /* clang */ && \ 1.952 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \ 1.953 + !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \ 1.954 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.955 + #define OVR_CPP_NO_INHERITING_CONSTRUCTORS 1 1.956 + #endif 1.957 +#endif 1.958 + 1.959 + 1.960 +//----------------------------------------------------------------------------------- 1.961 +// ***** OVR_CPP_NO_DELEGATING_CONSTRUCTORS 1.962 +// 1.963 +// Defined as 1 if the compiler supports C++11 delegating constructors. Otherwise undefined. 1.964 + 1.965 +#if !defined(OVR_CPP_NO_DELEGATING_CONSTRUCTORS) 1.966 + #if !defined(OVR_CPP11_ENABLED) || \ 1.967 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \ 1.968 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.969 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.970 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.971 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */ 1.972 + #define OVR_CPP_NO_DELEGATING_CONSTRUCTORS 1 1.973 + #endif 1.974 +#endif 1.975 + 1.976 + 1.977 +//----------------------------------------------------------------------------------- 1.978 +// ***** OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS 1.979 +// 1.980 +// Defined as 1 if the compiler supports C++11 function template default arguments. Otherwise undefined. 1.981 + 1.982 +#if !defined(OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) 1.983 + #if !defined(OVR_CPP11_ENABLED) || \ 1.984 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.985 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.0+ */ && \ 1.986 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \ 1.987 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.988 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */ 1.989 + #define OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS 1 1.990 + #endif 1.991 +#endif 1.992 + 1.993 + 1.994 +//----------------------------------------------------------------------------------- 1.995 +// ***** OVR_CPP_NO_UNRESTRICTED_UNIONS 1.996 +// 1.997 +// Defined as 1 if the compiler supports C++11 unrestricted unions. Otherwise undefined. 1.998 + 1.999 +#if !defined(OVR_CPP_NO_UNRESTRICTED_UNIONS) 1.1000 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1001 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.1002 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.1003 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \ 1.1004 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */ 1.1005 + // Not supported by VC++ as of VS2013. 1.1006 + #define OVR_CPP_NO_UNRESTRICTED_UNIONS 1 1.1007 + #endif 1.1008 +#endif 1.1009 + 1.1010 + 1.1011 + 1.1012 +//----------------------------------------------------------------------------------- 1.1013 +// ***** OVR_CPP_NO_EXTENDED_SIZEOF 1.1014 +// 1.1015 +// Defined as 1 if the compiler supports C++11 class sizeof extensions (e.g. sizeof SomeClass::someMember). 1.1016 +// Otherwise undefined. 1.1017 + 1.1018 +#if !defined(OVR_CPP_NO_EXTENDED_SIZEOF) 1.1019 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1020 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.1021 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.1022 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.1023 + !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \ 1.1024 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.1025 + #define OVR_CPP_NO_EXTENDED_SIZEOF 1 1.1026 + #endif 1.1027 +#endif 1.1028 + 1.1029 + 1.1030 +//----------------------------------------------------------------------------------- 1.1031 +// ***** OVR_CPP_NO_INLINE_NAMESPACES 1.1032 +// 1.1033 +// Defined as 1 if the compiler supports C++11 inlined namespaces. Otherwise undefined. 1.1034 +// http://en.cppreference.com/w/cpp/language/namespace#Inline_namespaces 1.1035 + 1.1036 +#if !defined(OVR_CPP_NO_INLINE_NAMESPACES) 1.1037 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1038 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.1039 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \ 1.1040 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.1041 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */ 1.1042 + // Not supported by VC++ as of VS2013. 1.1043 + #define OVR_CPP_NO_INLINE_NAMESPACES 1 1.1044 + #endif 1.1045 +#endif 1.1046 + 1.1047 + 1.1048 +//----------------------------------------------------------------------------------- 1.1049 +// ***** OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS 1.1050 +// 1.1051 +// Defined as 1 if the compiler supports C++11 explicit conversion operators. Otherwise undefined. 1.1052 +// http://en.cppreference.com/w/cpp/language/explicit 1.1053 + 1.1054 +#if !defined(OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS) 1.1055 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1056 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_explicit_conversions)) /* clang */ && \ 1.1057 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.1058 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.1059 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404))) /* EDG 4.4+ */ 1.1060 + #define OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS 1 1.1061 + #endif 1.1062 +#endif 1.1063 + 1.1064 + 1.1065 +//----------------------------------------------------------------------------------- 1.1066 +// ***** OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS 1.1067 +// 1.1068 +// Defined as 1 if the compiler supports C++11 local class template parameters. Otherwise undefined. 1.1069 +// Example: 1.1070 +// void Test() { 1.1071 +// struct LocalClass{ }; 1.1072 +// SomeTemplateClass<LocalClass> t; // Allowed only in C++11 1.1073 +// } 1.1074 + 1.1075 +#if !defined(OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) 1.1076 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1077 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_local_type_template_args)) /* clang */ && \ 1.1078 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.1079 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.1080 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */ 1.1081 + #define OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS 1 1.1082 + #endif 1.1083 +#endif 1.1084 + 1.1085 + 1.1086 +//----------------------------------------------------------------------------------- 1.1087 +// ***** OVR_CPP_NO_NEW_CHARACTER_TYPES 1.1088 +// 1.1089 +// Defined as 1 if the compiler natively supports C++11 char16_t and char32_t. Otherwise undefined. 1.1090 +// VC++ through at least VS2013 defines char16_t as unsigned short in its standard library, 1.1091 +// but it is not a native type or unique type, nor can you for a string literal with it. 1.1092 + 1.1093 +#if !defined(OVR_CPP_NO_NEW_CHARACTER_TYPES) 1.1094 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1095 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_unicode_literals)) /* clang */ && \ 1.1096 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.1097 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */ 1.1098 + // Not supported by VC++ as of VS2013. 1.1099 + #define OVR_CPP_NO_NEW_CHARACTER_TYPES 1 1.1100 + #endif 1.1101 +#endif 1.1102 + 1.1103 + 1.1104 +//----------------------------------------------------------------------------------- 1.1105 +// ***** OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS 1.1106 +// 1.1107 +// Defined as 1 if the compiler supports C++11 \u and \U character literals for 1.1108 +// native char16_t and char32_t types. 1.1109 +// 1.1110 +#if !defined(OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS) 1.1111 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1112 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.1113 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.1114 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.1115 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.1116 + // Not supported by VC++ as of VS2013. VC++'s existing \U and \u are non-conforming. 1.1117 + #define OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS 1 1.1118 + #endif 1.1119 +#endif 1.1120 + 1.1121 + 1.1122 +//----------------------------------------------------------------------------------- 1.1123 +// ***** OVR_CPP_NO_USER_DEFINED_LITERALS 1.1124 +// 1.1125 +// Defined as 1 if the compiler supports C++11 user-defined literals. Otherwise undefined. 1.1126 + 1.1127 +#if !defined(OVR_CPP_NO_USER_DEFINED_LITERALS) 1.1128 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1129 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \ 1.1130 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \ 1.1131 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.1132 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.1133 + // Not supported by VC++ as of VS2013. 1.1134 + #define OVR_CPP_NO_USER_DEFINED_LITERALS 1 1.1135 + #endif 1.1136 +#endif 1.1137 + 1.1138 + 1.1139 +//----------------------------------------------------------------------------------- 1.1140 +// ***** OVR_CPP_NO_UNICODE_STRING_LITERALS 1.1141 +// 1.1142 +// Defined as 1 if the compiler supports C++11 Unicode string literals. Otherwise undefined. 1.1143 +// http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals 1.1144 + 1.1145 +#if !defined(OVR_CPP_NO_UNICODE_STRING_LITERALS) 1.1146 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1147 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_unicode_literals)) /* clang */ && \ 1.1148 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.1149 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */ 1.1150 + // Not supported by VC++ as of VS2013. 1.1151 + #define OVR_CPP_NO_UNICODE_STRING_LITERALS 1 1.1152 + #endif 1.1153 +#endif 1.1154 + 1.1155 + 1.1156 +//----------------------------------------------------------------------------------- 1.1157 +// ***** OVR_CPP_NO_RAW_STRING_LITERALS 1.1158 +// 1.1159 +// Defined as 1 if the compiler supports C++11 raw literals. Otherwise undefined. 1.1160 +// http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals 1.1161 + 1.1162 +#if !defined(OVR_CPP_NO_RAW_STRING_LITERALS) 1.1163 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1164 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_raw_string_literals)) /* clang */ && \ 1.1165 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \ 1.1166 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */ 1.1167 + // Not supported by VC++ as of VS2013. 1.1168 + #define OVR_CPP_NO_RAW_STRING_LITERALS 1 1.1169 + #endif 1.1170 +#endif 1.1171 + 1.1172 + 1.1173 +//----------------------------------------------------------------------------------- 1.1174 +// ***** OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX 1.1175 +// 1.1176 +// Defined as 1 if the compiler supports C++11 unified initialization. 1.1177 +// http://en.wikipedia.org/wiki/C%2B%2B11#Uniform_initialization 1.1178 + 1.1179 +#if !defined(OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX) 1.1180 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1181 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_generalized_initializers)) /* clang */ && \ 1.1182 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \ 1.1183 + !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \ 1.1184 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */ 1.1185 + #define OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX 1 1.1186 + #endif 1.1187 +#endif 1.1188 + 1.1189 + 1.1190 +//----------------------------------------------------------------------------------- 1.1191 +// ***** OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS 1.1192 +// 1.1193 +// Defined as 1 if the compiler supports C++11 extended friends. 1.1194 + 1.1195 +#if !defined(OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS) 1.1196 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1197 + (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \ 1.1198 + !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \ 1.1199 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \ 1.1200 + !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \ 1.1201 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */ 1.1202 + #define OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS 1 1.1203 + #endif 1.1204 +#endif 1.1205 + 1.1206 + 1.1207 +//----------------------------------------------------------------------------------- 1.1208 +// ***** OVR_CPP_NO_THREAD_LOCAL 1.1209 +// 1.1210 +// Defined as 1 if the compiler supports C++11 thread_local. Else undefined. Does not 1.1211 +// indicate if the compiler supports C thread-local compiler extensions such as __thread 1.1212 +// and declspec(thread). Use OVR_THREAD_LOCAL if you want to declare a thread-local 1.1213 +// variable that supports C++11 thread_local when available but the C extension when 1.1214 +// it's available. The primary difference between C++11 thread_local and C extensions is 1.1215 +// that C++11 thread_local supports non-PODs and calls their constructors and destructors. 1.1216 +// 1.1217 +// Note that thread_local requires both compiler and linker support, and so it's possible 1.1218 +// that the compiler may support thread_local but the linker does not. 1.1219 + 1.1220 +#if !defined(OVR_CPP_NO_THREAD_LOCAL) 1.1221 + #if !defined(OVR_CPP11_ENABLED) || \ 1.1222 + (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_thread_local)) /* clang */ && \ 1.1223 + !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \ 1.1224 + !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */ 1.1225 + #define OVR_CPP_NO_THREAD_LOCAL 1 1.1226 + #endif 1.1227 +#endif 1.1228 + 1.1229 + 1.1230 +// ----------------------------------------------------------------------------------- 1.1231 +// ***** OVR_ALIGNAS / OVR_ALIGNOF 1.1232 +// 1.1233 +// OVR_ALIGNAS(n) // Specifies a size_t power of two alignment for a type or instance. 1.1234 +// OVR_ALIGNOF(type) // Returns the size_t alignment of a type or instance. 1.1235 +// 1.1236 +// Example usage: 1.1237 +// OVR_ALIGNAS(8) char c = 'c'; // Specifies that the instance c be aligned to an 8 byte boundary. 1.1238 +// typedef OVR_ALIGNAS(8) char C; // Specifies that the type C be aligned to an 8 byte boundary. 1.1239 +// struct OVR_ALIGNAS(64) S{ char array[16]; }; // Specfies that the struct S have a natural alignment of 64. 1.1240 +// OVR_ALIGNAS(32) S s; // Specifies that the instance s of struct S be aligned to an 32 byte boundary. 1.1241 +// OVR_ALIGNAS(32) struct T{ char array[16]; } t; // Specfies that the instance t of struct T have a natural alignment of 32. 1.1242 +// struct OVR_ALIGNAS(T) U{}; // Specifes that U be aligned the same as T. Supported only by C++11 compilers (see OVR_CPP_NO_ALIGNAS). 1.1243 +// 1.1244 +// size_t a = OVR_ALIGNOF(double); // Returns the natural alignment of the double type. 1.1245 +// size_t a = OVR_ALIGNOF(S); // Returns the natural alignment of the struct S type. 1.1246 +// 1.1247 +// Note: If C++11 alignas is supported, then alignas/OVR_ALIGNAS may take a const expression in addition to a constant. 1.1248 +// Note: The C11 Standard species the _Alignas keyword and alignas as a macro for it in <stdalign.h> 1.1249 + 1.1250 +#if !defined(OVR_ALIGNAS) 1.1251 + #if defined(OVR_CC_GNU) && !defined(OVR_CPP_NO_ALIGNAS) // If C++11 alignas is supported... 1.1252 + #define OVR_ALIGNAS(n) alignas(n) 1.1253 + #elif defined(__clang__) && !defined(OVR_CPP_NO_ALIGNAS) 1.1254 + #define OVR_ALIGNAS(n) alignas(n) 1.1255 + #elif defined(OVR_CC_GNU) || defined(__clang__) 1.1256 + #define OVR_ALIGNAS(n) __attribute__((aligned(n))) 1.1257 + #elif defined(OVR_CC_MSVC) || defined(OVR_CC_INTEL) 1.1258 + #define OVR_ALIGNAS(n) __declspec(align(n)) // For Microsoft the alignment must be a literal integer. 1.1259 + #elif defined(OVR_CC_ARM) 1.1260 + #define OVR_ALIGNAS(n) __align(n) 1.1261 + #else 1.1262 + #error Need to define OVR_ALIGNAS 1.1263 + #endif 1.1264 +#endif 1.1265 + 1.1266 +#if !defined(OVR_ALIGNOF) 1.1267 + #if defined(OVR_CC_GNU) && !defined(OVR_CPP_NO_ALIGNOF) // If C++11 alignof is supported... 1.1268 + #define OVR_ALIGNOF(type) alignof(type) 1.1269 + #elif defined(__clang__) && !defined(OVR_CPP_NO_ALIGNOF) 1.1270 + #define OVR_ALIGNOF(type) alignof(type) 1.1271 + #elif defined(OVR_CC_GNU) || defined(__clang__) 1.1272 + #define OVR_ALIGNOF(type) ((size_t)__alignof__(type)) 1.1273 + #elif defined(OVR_CC_MSVC) || defined(OVR_CC_INTEL) 1.1274 + #define OVR_ALIGNOF(type) ((size_t)__alignof(type)) 1.1275 + #elif defined(OVR_CC_ARM) 1.1276 + #define OVR_ALIGNOF(type) ((size_t)__ALIGNOF__(type)) 1.1277 + #else 1.1278 + #error Need to define OVR_ALIGNOF 1.1279 + #endif 1.1280 +#endif 1.1281 + 1.1282 + 1.1283 +// ----------------------------------------------------------------------------------- 1.1284 +// ***** OVR_ASSUME / OVR_ANALYSIS_ASSUME 1.1285 +// 1.1286 +// This is a portable wrapper for VC++'s __assume and __analysis_assume. 1.1287 +// __analysis_assume is typically used to quell VC++ static analysis warnings. 1.1288 +// 1.1289 +// Example usage: 1.1290 +// void Test(char c){ 1.1291 +// switch(c){ 1.1292 +// case 'a': 1.1293 +// case 'b': 1.1294 +// case 'c': 1.1295 +// case 'd': 1.1296 +// break; 1.1297 +// default: 1.1298 +// OVR_ASSUME(0); // Unreachable code. 1.1299 +// } 1.1300 +// } 1.1301 +// 1.1302 +// size_t Test(char* str){ 1.1303 +// OVR_ANALYSIS_ASSUME(str != nullptr); 1.1304 +// return strlen(str); 1.1305 +// } 1.1306 + 1.1307 +#if !defined(OVR_ASSUME) 1.1308 + #if defined(OVR_CC_MSVC) 1.1309 + #define OVR_ASSUME(x) __assume(x) 1.1310 + #define OVR_ANALYSIS_ASSUME(x) __analysis_assume(!!(x)) 1.1311 + #else 1.1312 + #define OVR_ASSUME(x) 1.1313 + #define OVR_ANALYSIS_ASSUME(x) 1.1314 + #endif 1.1315 +#endif 1.1316 + 1.1317 + 1.1318 +// ----------------------------------------------------------------------------------- 1.1319 +// ***** OVR_RESTRICT 1.1320 +// 1.1321 +// Wraps the C99 restrict keyword in a portable way. 1.1322 +// C++11 and C++14 don't have restrict but this functionality is supported by 1.1323 +// all C++ compilers. 1.1324 +// 1.1325 +// Example usage: 1.1326 +// void* memcpy(void* OVR_RESTRICT s1, const void* OVR_RESTRICT s2, size_t n); 1.1327 + 1.1328 +#if !defined(OVR_RESTRICT) 1.1329 + #define OVR_RESTRICT __restrict // Currently supported by all compilers of significance to us. 1.1330 +#endif 1.1331 + 1.1332 + 1.1333 +// ----------------------------------------------------------------------------------- 1.1334 +// ***** OVR_NOEXCEPT / OVR_NOEXCEPT_IF(predicate) / OVR_NOEXCEPT_EXPR(expression) 1.1335 +// 1.1336 +// Implements a portable wrapper for C++11 noexcept. 1.1337 +// http://en.cppreference.com/w/cpp/language/noexcept 1.1338 +// 1.1339 +// Example usage: 1.1340 +// void Test() OVR_NOEXCEPT {} // This function doesn't throw. 1.1341 +// 1.1342 +// template <typename T> 1.1343 +// void DoNothing() OVR_NOEXCEPT_IF(OVR_NOEXCEPT_EXPR(T())) // Throws an if and only if T::T(int) throws. 1.1344 +// { T t(3); } 1.1345 +// 1.1346 +#if !defined(OVR_NOEXCEPT) 1.1347 + #if defined(OVR_CPP_NOEXCEPT) 1.1348 + #define OVR_NOEXCEPT 1.1349 + #define OVR_NOEXCEPT_IF(predicate) 1.1350 + #define OVR_NOEXCEPT_EXPR(expression) false 1.1351 + #else 1.1352 + #define OVR_NOEXCEPT noexcept 1.1353 + #define OVR_NOEXCEPT_IF(predicate) noexcept((predicate)) 1.1354 + #define OVR_NOEXCEPT_EXPR(expression) noexcept((expression)) 1.1355 + #endif 1.1356 +#endif 1.1357 + 1.1358 + 1.1359 +// ----------------------------------------------------------------------------------- 1.1360 +// ***** OVR_FINAL 1.1361 +// 1.1362 +// Wraps the C++11 final keyword in a portable way. 1.1363 +// http://en.cppreference.com/w/cpp/language/final 1.1364 +// 1.1365 +// Example usage: 1.1366 +// struct Test { virtual int GetValue() OVR_FINAL; }; 1.1367 + 1.1368 +#if !defined(OVR_FINAL) 1.1369 + #if defined(OVR_CC_MSVC) && (OVR_CC_VERSION < 1700) // VC++ 2012 and earlier 1.1370 + #define OVR_FINAL sealed 1.1371 + #elif defined(OVR_CPP_INHERITANCE_FINAL) 1.1372 + #define OVR_FINAL 1.1373 + #else 1.1374 + #define OVR_FINAL final 1.1375 + #endif 1.1376 +#endif 1.1377 + 1.1378 + 1.1379 +// ----------------------------------------------------------------------------------- 1.1380 +// ***** OVR_OVERRIDE 1.1381 +// 1.1382 +// Wraps the C++11 override keyword in a portable way. 1.1383 +// http://en.cppreference.com/w/cpp/language/override 1.1384 +// 1.1385 +// Example usage: 1.1386 +// struct Parent { virtual void Func(int); }; 1.1387 +// struct Child : public Parent { void Func(int) OVR_OVERRIDE; }; 1.1388 + 1.1389 +#if !defined(OVR_CPP11_ENABLED) 1.1390 +#define OVR_OVERRIDE 1.1391 +#elif !defined(OVR_OVERRIDE) 1.1392 + #if defined(OVR_CPP_OVERRIDE) 1.1393 + #define OVR_OVERRIDE 1.1394 + #else 1.1395 + #if (defined(_MSC_VER) && (_MSC_VER <= 1600)) 1.1396 + #pragma warning(disable : 4481) 1.1397 + #endif 1.1398 + #define OVR_OVERRIDE override 1.1399 + #endif 1.1400 +#endif 1.1401 + 1.1402 + 1.1403 +// ----------------------------------------------------------------------------------- 1.1404 +// ***** OVR_FINAL_OVERRIDE 1.1405 +// 1.1406 +// Wraps the C++11 final+override keywords (a common combination) in a portable way. 1.1407 +// 1.1408 +// Example usage: 1.1409 +// struct Parent { virtual void Func(); }; 1.1410 +// struct Child : public Parent { virtual void Func() OVR_FINAL_OVERRIDE; }; 1.1411 + 1.1412 +#if !defined(OVR_FINAL_OVERRIDE) 1.1413 + #define OVR_FINAL_OVERRIDE OVR_FINAL OVR_OVERRIDE 1.1414 +#endif 1.1415 + 1.1416 + 1.1417 +// ----------------------------------------------------------------------------------- 1.1418 +// ***** OVR_EXTERN_TEMPLATE 1.1419 +// 1.1420 +// Portable wrapper for C++11 extern template. This tells the compiler to not instantiate 1.1421 +// the template in the current translation unit, which can significantly speed up 1.1422 +// compilation and avoid problems due to two translation units compiling code with 1.1423 +// different settings. 1.1424 +// 1.1425 +// Example usage: 1.1426 +// OVR_EXTERN_TEMPLATE(class basic_string<char>); // Nothing to do for non-C++11 compilers. 1.1427 + 1.1428 +#if !defined(OVR_EXTERN_TEMPLATE) 1.1429 + #if defined(OVR_CPP_EXTERN_TEMPLATE) 1.1430 + #define OVR_EXTERN_TEMPLATE(decl) 1.1431 + #else 1.1432 + #define OVR_EXTERN_TEMPLATE(decl) extern template decl 1.1433 + #endif 1.1434 +#endif 1.1435 + 1.1436 + 1.1437 +// ----------------------------------------------------------------------------------- 1.1438 +// ***** OVR_CONSTEXPR / OVR_CONSTEXPR_OR_CONST 1.1439 +// 1.1440 +// Portable wrapper for C++11 constexpr. Doesn't include C++14 relaxed constexpr, 1.1441 +// for which a different wrapper name is reserved. 1.1442 +// 1.1443 +// Example usage: 1.1444 +// OVR_CONSTEXPR int Test() { return 15; } // This can be optimized better by a C++11 compiler that supports constexpr. 1.1445 +// OVR_CONSTEXPR_OR_CONST float x = 3.14159f; // This can be optimized better by a C++11 compiler, but if not then at least make it const. 1.1446 + 1.1447 +#if !defined(OVR_CONSTEXPR) 1.1448 + #if defined(OVR_CPP_NO_CONSTEXPR) 1.1449 + #define OVR_CONSTEXPR 1.1450 + #else 1.1451 + #define OVR_CONSTEXPR constexpr 1.1452 + #endif 1.1453 +#endif 1.1454 + 1.1455 +#if !defined(OVR_CONSTEXPR_OR_CONST) 1.1456 + #if defined(OVR_CPP_NO_CONSTEXPR) 1.1457 + #define OVR_CONSTEXPR_OR_CONST const 1.1458 + #else 1.1459 + #define OVR_CONSTEXPR_OR_CONST constexpr 1.1460 + #endif 1.1461 +#endif 1.1462 + 1.1463 + 1.1464 + 1.1465 +// ----------------------------------------------------------------------------------- 1.1466 +// ***** OVR_FUNCTION_DELETE / OVR_FUNCTION_DEFAULT 1.1467 +// 1.1468 +// Wraps the C++11 delete and default keywords in a way that allows for cleaner code 1.1469 +// while making for a better version of uncallable or default functions. 1.1470 +// 1.1471 +// Example usage: 1.1472 +// struct Test{ 1.1473 +// Test() OVR_FUNCTION_DEFAULT; // Non-C++11 compilers will require a separate definition for Test(). 1.1474 +// private: // Users should put OVR_FUNCTION_DELETE usage in a private 1.1475 +// void Uncallable() OVR_FUNCTION_DELETE; // area for compatibility with pre-C++11 compilers. 1.1476 +// }; 1.1477 + 1.1478 +#if defined(OVR_CPP_NO_DELETED_FUNCTIONS) 1.1479 + #define OVR_FUNCTION_DELETE 1.1480 +#else 1.1481 + #define OVR_FUNCTION_DELETE = delete 1.1482 +#endif 1.1483 + 1.1484 +#if defined(OVR_CPP_NO_DEFAULTED_FUNCTIONS) 1.1485 + #define OVR_FUNCTION_DEFAULT 1.1486 +#else 1.1487 + #define OVR_FUNCTION_DEFAULT = default 1.1488 +#endif 1.1489 + 1.1490 + 1.1491 + 1.1492 +// ----------------------------------------------------------------------------------- 1.1493 +// ***** OVR_NON_COPYABLE 1.1494 +// 1.1495 +// Allows you to specify a class as being neither copy-constructible nor assignable, 1.1496 +// which is a commonly needed pattern in C++ programming. Classes with this declaration 1.1497 +// are required to be default constructible (as are most classes). For pre-C++11 1.1498 +// compilers this macro declares a private section for the class, which will be 1.1499 +// inherited by whatever code is directly below the macro invocation by default. 1.1500 +// 1.1501 +// Example usage: 1.1502 +// struct Test { 1.1503 +// Test(); 1.1504 +// ... 1.1505 +// OVR_NON_COPYABLE(Test) 1.1506 +// }; 1.1507 + 1.1508 +#if !defined(OVR_NON_COPYABLE) 1.1509 + #if defined(OVR_CPP_NO_DELETED_FUNCTIONS) 1.1510 + #define OVR_NON_COPYABLE(Type) \ 1.1511 + private: \ 1.1512 + Type(const Type&); \ 1.1513 + void operator=(const Type&); 1.1514 + #else 1.1515 + #define OVR_NON_COPYABLE(Type) \ 1.1516 + Type(const Type&) = delete; \ 1.1517 + void operator=(const Type&) = delete; 1.1518 + #endif 1.1519 +#endif 1.1520 + 1.1521 + 1.1522 + 1.1523 +#endif // header include guard 1.1524 + 1.1525 + 1.1526 + 1.1527 +