rev |
line source |
nuclear@0
|
1 /************************************************************************************
|
nuclear@0
|
2
|
nuclear@0
|
3 PublicHeader: OVR.h
|
nuclear@0
|
4 Filename : OVR_Compiler.h
|
nuclear@0
|
5 Content : Compiler-specific feature identification and utilities
|
nuclear@0
|
6 Created : June 19, 2014
|
nuclear@0
|
7 Notes :
|
nuclear@0
|
8
|
nuclear@0
|
9 Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
|
nuclear@0
|
10
|
nuclear@0
|
11 Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
|
nuclear@0
|
12 you may not use the Oculus VR Rift SDK except in compliance with the License,
|
nuclear@0
|
13 which is provided at the time of installation or download, or which
|
nuclear@0
|
14 otherwise accompanies this software in either electronic or hard copy form.
|
nuclear@0
|
15
|
nuclear@0
|
16 You may obtain a copy of the License at
|
nuclear@0
|
17
|
nuclear@0
|
18 http://www.oculusvr.com/licenses/LICENSE-3.2
|
nuclear@0
|
19
|
nuclear@0
|
20 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
|
nuclear@0
|
21 distributed under the License is distributed on an "AS IS" BASIS,
|
nuclear@0
|
22 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
nuclear@0
|
23 See the License for the specific language governing permissions and
|
nuclear@0
|
24 limitations under the License.
|
nuclear@0
|
25
|
nuclear@0
|
26 ************************************************************************************/
|
nuclear@0
|
27
|
nuclear@0
|
28
|
nuclear@0
|
29 #ifndef OVR_Compiler_h
|
nuclear@0
|
30 #define OVR_Compiler_h
|
nuclear@0
|
31
|
nuclear@0
|
32 #pragma once
|
nuclear@0
|
33
|
nuclear@0
|
34
|
nuclear@0
|
35 // References
|
nuclear@0
|
36 // https://gcc.gnu.org/projects/cxx0x.html
|
nuclear@0
|
37 // https://gcc.gnu.org/projects/cxx1y.html
|
nuclear@0
|
38 // http://clang.llvm.org/cxx_status.html
|
nuclear@0
|
39 // http://msdn.microsoft.com/en-us/library/hh567368.aspx
|
nuclear@0
|
40 // https://docs.google.com/spreadsheet/pub?key=0AoBblDsbooe4dHZuVTRoSTFBejk5eFBfVk1GWlE5UlE&output=html
|
nuclear@0
|
41 // http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
|
nuclear@0
|
42
|
nuclear@0
|
43
|
nuclear@0
|
44 //-----------------------------------------------------------------------------------
|
nuclear@0
|
45 // ***** Compiler
|
nuclear@0
|
46 //
|
nuclear@0
|
47 // The following compilers are defined: (OVR_CC_x)
|
nuclear@0
|
48 //
|
nuclear@0
|
49 // MSVC - Microsoft Visual C/C++
|
nuclear@0
|
50 // INTEL - Intel C++ for Linux / Windows
|
nuclear@0
|
51 // GNU - GNU C++
|
nuclear@0
|
52 // ARM - ARM C/C++
|
nuclear@0
|
53
|
nuclear@0
|
54 #if defined(__INTEL_COMPILER)
|
nuclear@0
|
55 // Intel 4.0 = 400
|
nuclear@0
|
56 // Intel 5.0 = 500
|
nuclear@0
|
57 // Intel 6.0 = 600
|
nuclear@0
|
58 // Intel 8.0 = 800
|
nuclear@0
|
59 // Intel 9.0 = 900
|
nuclear@0
|
60 # define OVR_CC_INTEL __INTEL_COMPILER
|
nuclear@0
|
61
|
nuclear@0
|
62 #elif defined(_MSC_VER)
|
nuclear@0
|
63 // MSVC 5.0 = 1100
|
nuclear@0
|
64 // MSVC 6.0 = 1200
|
nuclear@0
|
65 // MSVC 7.0 (VC2002) = 1300
|
nuclear@0
|
66 // MSVC 7.1 (VC2003) = 1310
|
nuclear@0
|
67 // MSVC 8.0 (VC2005) = 1400
|
nuclear@0
|
68 // MSVC 9.0 (VC2008) = 1500
|
nuclear@0
|
69 // MSVC 10.0 (VC2010) = 1600
|
nuclear@0
|
70 // MSVC 11.0 (VC2012) = 1700
|
nuclear@0
|
71 // MSVC 12.0 (VC2013) = 1800
|
nuclear@0
|
72 # define OVR_CC_MSVC _MSC_VER
|
nuclear@0
|
73
|
nuclear@0
|
74 #if _MSC_VER == 0x1600
|
nuclear@0
|
75 # if _MSC_FULL_VER < 160040219
|
nuclear@0
|
76 # error "Oculus does not support VS2010 without SP1 installed."
|
nuclear@0
|
77 # endif
|
nuclear@0
|
78 #endif
|
nuclear@0
|
79
|
nuclear@0
|
80 #elif defined(__GNUC__)
|
nuclear@0
|
81 # define OVR_CC_GNU
|
nuclear@0
|
82
|
nuclear@0
|
83 #elif defined(__clang__)
|
nuclear@0
|
84 # define OVR_CC_CLANG
|
nuclear@0
|
85
|
nuclear@0
|
86 #elif defined(__CC_ARM)
|
nuclear@0
|
87 # define OVR_CC_ARM
|
nuclear@0
|
88
|
nuclear@0
|
89 #else
|
nuclear@0
|
90 # error "Oculus does not support this Compiler"
|
nuclear@0
|
91 #endif
|
nuclear@0
|
92
|
nuclear@0
|
93
|
nuclear@0
|
94 //-----------------------------------------------------------------------------------
|
nuclear@0
|
95 // ***** OVR_CC_VERSION
|
nuclear@0
|
96 //
|
nuclear@0
|
97 // M = major version
|
nuclear@0
|
98 // m = minor version
|
nuclear@0
|
99 // p = patch release
|
nuclear@0
|
100 // b = build number
|
nuclear@0
|
101 //
|
nuclear@0
|
102 // Compiler Format Example
|
nuclear@0
|
103 // ----------------------------
|
nuclear@0
|
104 // OVR_CC_GNU Mmm 408 means GCC 4.8
|
nuclear@0
|
105 // OVR_CC_CLANG Mmm 305 means clang 3.5
|
nuclear@0
|
106 // OVR_CC_MSVC MMMM 1700 means VS2012
|
nuclear@0
|
107 // OVR_CC_ARM Mmpbbb 401677 means 4.0, patch 1, build 677
|
nuclear@0
|
108 // OVR_CC_INTEL MMmm 1210 means 12.10
|
nuclear@0
|
109 // OVR_CC_EDG Mmm 407 means EDG 4.7
|
nuclear@0
|
110 //
|
nuclear@0
|
111 #if defined(OVR_CC_GNU)
|
nuclear@0
|
112 #define OVR_CC_VERSION ((__GNUC__ * 100) + __GNUC_MINOR__)
|
nuclear@0
|
113 #elif defined(OVR_CC_CLANG)
|
nuclear@0
|
114 #define OVR_CC_VERSION ((__clang_major__ * 100) + __clang_minor__)
|
nuclear@0
|
115 #elif defined(OVR_CC_MSVC)
|
nuclear@0
|
116 #define OVR_CC_VERSION _MSC_VER // Question: Should we recognize _MSC_FULL_VER?
|
nuclear@0
|
117 #elif defined(OVR_CC_ARM)
|
nuclear@0
|
118 #define OVR_CC_VERSION __ARMCC_VERSION
|
nuclear@0
|
119 #elif defined(OVR_CC_INTEL)
|
nuclear@0
|
120 #if defined(__INTEL_COMPILER)
|
nuclear@0
|
121 #define OVR_CC_VERSION __INTEL_COMPILER
|
nuclear@0
|
122 #elif defined(__ICL)
|
nuclear@0
|
123 #define OVR_CC_VERSION __ICL
|
nuclear@0
|
124 #elif defined(__ICC)
|
nuclear@0
|
125 #define OVR_CC_VERSION __ICC
|
nuclear@0
|
126 #elif defined(__ECC)
|
nuclear@0
|
127 #define OVR_CC_VERSION __ECC
|
nuclear@0
|
128 #endif
|
nuclear@0
|
129 #elif defined(OVR_CC_EDG)
|
nuclear@0
|
130 #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)
|
nuclear@0
|
131 #endif
|
nuclear@0
|
132
|
nuclear@0
|
133
|
nuclear@0
|
134
|
nuclear@0
|
135 // -----------------------------------------------------------------------------------
|
nuclear@0
|
136 // ***** OVR_DISABLE_OPTIMIZATION / OVR_RESTORE_OPTIMIZATION
|
nuclear@0
|
137 //
|
nuclear@0
|
138 // Allows for the dynamic disabling and restoring of compiler optimizations in code.
|
nuclear@0
|
139 // This is useful for helping deal with potential compiler code generation problems.
|
nuclear@0
|
140 // With VC++ the usage must be outside of function bodies. This can be used only to
|
nuclear@0
|
141 // temporarily disable optimization for a block of code and not to temporarily enable
|
nuclear@0
|
142 // optimization for a block of code.
|
nuclear@0
|
143 //
|
nuclear@0
|
144 // Clang doesn't support this as of June 2014, though function __attribute__((optimize(0))
|
nuclear@0
|
145 // is supposedly supported by clang in addition to GCC. To consider: Make a wrapper for
|
nuclear@0
|
146 // this attribute-based functionality.
|
nuclear@0
|
147 //
|
nuclear@0
|
148 // Example usage:
|
nuclear@0
|
149 // OVR_DISABLE_OPTIMIZATION()
|
nuclear@0
|
150 // void Test() { ... }
|
nuclear@0
|
151 // OVR_RESTORE_OPTIMIZATION()
|
nuclear@0
|
152 //
|
nuclear@0
|
153 #if !defined(OVR_DISABLE_OPTIMIZATION)
|
nuclear@0
|
154 #if defined(OVR_CC_GNU) && (OVR_CC_VERSION > 404) && (defined(OVR_CPU_X86) || defined(OVR_CPU_X86_64))
|
nuclear@0
|
155 #define OVR_DISABLE_OPTIMIZATION() \
|
nuclear@0
|
156 _Pragma("GCC push_options") \
|
nuclear@0
|
157 _Pragma("GCC optimize 0")
|
nuclear@0
|
158 #elif defined(OVR_CC_MSVC)
|
nuclear@0
|
159 #define OVR_DISABLE_OPTIMIZATION() __pragma(optimize("", off))
|
nuclear@0
|
160 #else
|
nuclear@0
|
161 #define OVR_DISABLE_OPTIMIZATION()
|
nuclear@0
|
162 #endif
|
nuclear@0
|
163 #endif
|
nuclear@0
|
164
|
nuclear@0
|
165 #if !defined(OVR_RESTORE_OPTIMIZATION)
|
nuclear@0
|
166 #if defined(OVR_CC_GNU) && (OVR_CC_VERSION > 404) && (defined(OVR_CPU_X86) || defined(OVR_CPU_X86_64))
|
nuclear@0
|
167 #define OVR_RESTORE_OPTIMIZATION() _Pragma("GCC pop_options")
|
nuclear@0
|
168 #elif defined(OVR_CC_MSVC)
|
nuclear@0
|
169 #define OVR_RESTORE_OPTIMIZATION() __pragma(optimize("", on))
|
nuclear@0
|
170 #else
|
nuclear@0
|
171 #define OVR_RESTORE_OPTIMIZATION()
|
nuclear@0
|
172 #endif
|
nuclear@0
|
173 #endif
|
nuclear@0
|
174
|
nuclear@0
|
175
|
nuclear@0
|
176 // -----------------------------------------------------------------------------------
|
nuclear@0
|
177 // ***** OVR_DISABLE_GNU_WARNING / OVR_RESTORE_GNU_WARNING
|
nuclear@0
|
178 //
|
nuclear@0
|
179 // Portable wrapper for disabling GCC compiler warnings, one at a time. See example
|
nuclear@0
|
180 // usage for usage by example.
|
nuclear@0
|
181 //
|
nuclear@0
|
182 // Example usage:
|
nuclear@0
|
183 // OVR_DISABLE_GNU_WARNING(-Wmissing-braces) // Only one warning per usage.
|
nuclear@0
|
184 // OVR_DISABLE_GNU_WARNING(-Wunused-variable)
|
nuclear@0
|
185 // <code>
|
nuclear@0
|
186 // OVR_RESTORE_GNU_WARNINGS()
|
nuclear@0
|
187 // OVR_RESTORE_GNU_WARNINGS() // Must match each disable with a restore.
|
nuclear@0
|
188 //
|
nuclear@0
|
189 #if !defined(OVR_DISABLE_GNU_WARNING)
|
nuclear@0
|
190 #if defined(OVR_CC_GNU)
|
nuclear@0
|
191 #define ODGW1(x) #x
|
nuclear@0
|
192 #define ODGW2(x) ODGW1(GCC diagnostic ignored x)
|
nuclear@0
|
193 #define ODGW3(x) ODGW2(#x)
|
nuclear@0
|
194 #endif
|
nuclear@0
|
195
|
nuclear@0
|
196 #if defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 406)
|
nuclear@0
|
197 #define OVR_DISABLE_GNU_WARNING(w) \
|
nuclear@0
|
198 _Pragma("GCC diagnostic push") \
|
nuclear@0
|
199 _Pragma(ODGW3(w))
|
nuclear@0
|
200 #elif defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 404) // GCC 4.4 doesn't support diagnostic push, but supports disabling warnings.
|
nuclear@0
|
201 #define OVR_DISABLE_GNU_WARNING(w) \
|
nuclear@0
|
202 _Pragma(ODGW3(w))
|
nuclear@0
|
203 #else
|
nuclear@0
|
204 #define OVR_DISABLE_GNU_WARNING(w)
|
nuclear@0
|
205 #endif
|
nuclear@0
|
206 #endif
|
nuclear@0
|
207
|
nuclear@0
|
208 #if !defined(OVR_RESTORE_GNU_WARNING)
|
nuclear@0
|
209 #if defined(OVR_CC_GNU) && (OVR_CC_VERSION >= 4006)
|
nuclear@0
|
210 #define OVR_RESTORE_GNU_WARNINGS() \
|
nuclear@0
|
211 _Pragma("GCC diagnostic pop")
|
nuclear@0
|
212 #else
|
nuclear@0
|
213 #define OVR_RESTORE_GNU_WARNING()
|
nuclear@0
|
214 #endif
|
nuclear@0
|
215 #endif
|
nuclear@0
|
216
|
nuclear@0
|
217
|
nuclear@0
|
218
|
nuclear@0
|
219 // -----------------------------------------------------------------------------------
|
nuclear@0
|
220 // ***** OVR_DISABLE_CLANG_WARNING / OVR_RESTORE_CLANG_WARNING
|
nuclear@0
|
221 //
|
nuclear@0
|
222 // Portable wrapper for disabling GCC compiler warnings, one at a time. See example
|
nuclear@0
|
223 // usage for usage by example.
|
nuclear@0
|
224 //
|
nuclear@0
|
225 // Example usage:
|
nuclear@0
|
226 // OVR_DISABLE_CLANG_WARNING(-Wmissing-braces) // Only one warning per usage.
|
nuclear@0
|
227 // OVR_DISABLE_CLANG_WARNING(-Wunused-variable)
|
nuclear@0
|
228 // <code>
|
nuclear@0
|
229 // OVR_RESTORE_CLANG_WARNINGS()
|
nuclear@0
|
230 // OVR_RESTORE_CLANG_WARNINGS() // Must match each disable with a restore.
|
nuclear@0
|
231 //
|
nuclear@0
|
232 //
|
nuclear@0
|
233 #if !defined(OVR_DISABLE_CLANG_WARNING)
|
nuclear@0
|
234 #if defined(OVR_CC_CLANG)
|
nuclear@0
|
235 #define ODCW1(x) #x
|
nuclear@0
|
236 #define ODCW2(x) ODCW1(clang diagnostic ignored x)
|
nuclear@0
|
237 #define ODCW3(x) ODCW2(#x)
|
nuclear@0
|
238
|
nuclear@0
|
239 #define OVR_DISABLE_CLANG_WARNING(w) \
|
nuclear@0
|
240 _Pragma("clang diagnostic push") \
|
nuclear@0
|
241 _Pragma(ODCW3(w))
|
nuclear@0
|
242 #else
|
nuclear@0
|
243 #define OVR_DISABLE_CLANG_WARNING(w)
|
nuclear@0
|
244 #endif
|
nuclear@0
|
245 #endif
|
nuclear@0
|
246
|
nuclear@0
|
247 #if !defined(OVR_RESTORE_CLANG_WARNING)
|
nuclear@0
|
248 #if defined(OVR_CC_CLANG)
|
nuclear@0
|
249 #define OVR_RESTORE_CLANG_WARNING() \
|
nuclear@0
|
250 _Pragma("clang diagnostic pop")
|
nuclear@0
|
251 #else
|
nuclear@0
|
252 #define OVR_RESTORE_CLANG_WARNING()
|
nuclear@0
|
253 #endif
|
nuclear@0
|
254 #endif
|
nuclear@0
|
255
|
nuclear@0
|
256
|
nuclear@0
|
257 // -----------------------------------------------------------------------------------
|
nuclear@0
|
258 // ***** OVR_DISABLE_MSVC_WARNING / OVR_RESTORE_MSVC_WARNING
|
nuclear@0
|
259 //
|
nuclear@0
|
260 // Portable wrapper for disabling VC++ compiler warnings. See example usage for usage
|
nuclear@0
|
261 // by example.
|
nuclear@0
|
262 //
|
nuclear@0
|
263 // Example usage:
|
nuclear@0
|
264 // OVR_DISABLE_MSVC_WARNING(4556 4782 4422)
|
nuclear@0
|
265 // <code>
|
nuclear@0
|
266 // OVR_RESTORE_MSVC_WARNING()
|
nuclear@0
|
267 //
|
nuclear@0
|
268 #if !defined(OVR_DISABLE_MSVC_WARNING)
|
nuclear@0
|
269 #if defined(OVR_CC_MSVC)
|
nuclear@0
|
270 #define OVR_DISABLE_MSVC_WARNING(w) \
|
nuclear@0
|
271 __pragma(warning(push)) \
|
nuclear@0
|
272 __pragma(warning(disable:w))
|
nuclear@0
|
273 #else
|
nuclear@0
|
274 #define OVR_DISABLE_MSVC_WARNING(w)
|
nuclear@0
|
275 #endif
|
nuclear@0
|
276 #endif
|
nuclear@0
|
277
|
nuclear@0
|
278 #if !defined(OVR_RESTORE_MSVC_WARNING)
|
nuclear@0
|
279 #if defined(OVR_CC_MSVC)
|
nuclear@0
|
280 #define OVR_RESTORE_MSVC_WARNING() \
|
nuclear@0
|
281 __pragma(warning(pop))
|
nuclear@0
|
282 #else
|
nuclear@0
|
283 #define OVR_RESTORE_MSVC_WARNING()
|
nuclear@0
|
284 #endif
|
nuclear@0
|
285 #endif
|
nuclear@0
|
286
|
nuclear@0
|
287
|
nuclear@0
|
288 // -----------------------------------------------------------------------------------
|
nuclear@0
|
289 // ***** OVR_DISABLE_ALL_MSVC_WARNINGS / OVR_RESTORE_ALL_MSVC_WARNINGS
|
nuclear@0
|
290 //
|
nuclear@0
|
291 // Portable wrapper for disabling all VC++ compiler warnings.
|
nuclear@0
|
292 // OVR_RESTORE_ALL_MSVC_WARNINGS restores warnings that were disabled by
|
nuclear@0
|
293 // OVR_DISABLE_ALL_MSVC_WARNINGS. Any previously enabled warnings will still be
|
nuclear@0
|
294 // enabled after OVR_RESTORE_ALL_MSVC_WARNINGS.
|
nuclear@0
|
295 //
|
nuclear@0
|
296 // Example usage:
|
nuclear@0
|
297 // OVR_DISABLE_ALL_MSVC_WARNINGS()
|
nuclear@0
|
298 // <code>
|
nuclear@0
|
299 // OVR_RESTORE_ALL_MSVC_WARNINGS()
|
nuclear@0
|
300
|
nuclear@0
|
301 #if !defined(OVR_DISABLE_ALL_MSVC_WARNINGS)
|
nuclear@0
|
302 #if defined(OVR_CC_MSVC)
|
nuclear@0
|
303 #define OVR_DISABLE_ALL_MSVC_WARNINGS() \
|
nuclear@0
|
304 __pragma(warning(push, 0))
|
nuclear@0
|
305 #else
|
nuclear@0
|
306 #define OVR_DISABLE_ALL_MSVC_WARNINGS()
|
nuclear@0
|
307 #endif
|
nuclear@0
|
308 #endif
|
nuclear@0
|
309
|
nuclear@0
|
310 #if !defined(OVR_RESTORE_ALL_MSVC_WARNINGS)
|
nuclear@0
|
311 #if defined(OVR_CC_MSVC)
|
nuclear@0
|
312 #define OVR_RESTORE_ALL_MSVC_WARNINGS() \
|
nuclear@0
|
313 __pragma(warning(pop))
|
nuclear@0
|
314 #else
|
nuclear@0
|
315 #define OVR_RESTORE_ALL_MSVC_WARNINGS()
|
nuclear@0
|
316 #endif
|
nuclear@0
|
317 #endif
|
nuclear@0
|
318
|
nuclear@0
|
319
|
nuclear@0
|
320 //-----------------------------------------------------------------------------------
|
nuclear@0
|
321 // ***** OVR_CC_HAS_FEATURE
|
nuclear@0
|
322 //
|
nuclear@0
|
323 // This is a portable way to use compile-time feature identification available
|
nuclear@0
|
324 // with some compilers in a clean way. Direct usage of __has_feature in preprocessing
|
nuclear@0
|
325 // statements of non-supporting compilers results in a preprocessing error.
|
nuclear@0
|
326 //
|
nuclear@0
|
327 // Example usage:
|
nuclear@0
|
328 // #if OVR_CC_HAS_FEATURE(is_pod)
|
nuclear@0
|
329 // if(__is_pod(T)) // If the type is plain data then we can safely memcpy it.
|
nuclear@0
|
330 // memcpy(&destObject, &srcObject, sizeof(object));
|
nuclear@0
|
331 // #endif
|
nuclear@0
|
332 //
|
nuclear@0
|
333 #if !defined(OVR_CC_HAS_FEATURE)
|
nuclear@0
|
334 #if defined(__clang__) // http://clang.llvm.org/docs/LanguageExtensions.html#id2
|
nuclear@0
|
335 #define OVR_CC_HAS_FEATURE(x) __has_feature(x)
|
nuclear@0
|
336 #else
|
nuclear@0
|
337 #define OVR_CC_HAS_FEATURE(x) 0
|
nuclear@0
|
338 #endif
|
nuclear@0
|
339 #endif
|
nuclear@0
|
340
|
nuclear@0
|
341
|
nuclear@0
|
342 //-----------------------------------------------------------------------------------
|
nuclear@0
|
343 // ***** OVR_CC_HAS_BUILTIN
|
nuclear@0
|
344 //
|
nuclear@0
|
345 //
|
nuclear@0
|
346 // This is a portable way to use compile-time builtin identification available
|
nuclear@0
|
347 // with some compilers in a clean way. Direct usage of __has_builtin in preprocessing
|
nuclear@0
|
348 // statements of non-supporting compilers results in a preprocessing error.
|
nuclear@0
|
349 //
|
nuclear@0
|
350 // Example usage:
|
nuclear@0
|
351 // #if OVR_CC_HAS_BUILTIN(__builtin_trap)
|
nuclear@0
|
352 // #define DEBUG_BREAK __builtin_trap
|
nuclear@0
|
353 // #endif
|
nuclear@0
|
354 //
|
nuclear@0
|
355 #if !defined(OVR_CC_HAS_BUILTIN)
|
nuclear@0
|
356 #if defined(__clang__)
|
nuclear@0
|
357 #define OVR_CC_HAS_BUILTIN(x) __has_builtin(x) // http://clang.llvm.org/docs/LanguageExtensions.html#id2
|
nuclear@0
|
358 #else
|
nuclear@0
|
359 #define OVR_CC_HAS_BUILTIN(x) 0
|
nuclear@0
|
360 #endif
|
nuclear@0
|
361 #endif
|
nuclear@0
|
362
|
nuclear@0
|
363
|
nuclear@0
|
364 //-----------------------------------------------------------------------------------
|
nuclear@0
|
365 // ***** OVR_CPP11_ENABLED / OVR_CPP_CPP14_ENABLED
|
nuclear@0
|
366 //
|
nuclear@0
|
367 // Defined as 1 if the compiler has its available C++11 support enabled, else undefined.
|
nuclear@0
|
368 // This does not mean that all of C++11 or any particular feature of C++11 is supported
|
nuclear@0
|
369 // by the compiler. It means that whatever C++11 support the compiler has is enabled.
|
nuclear@0
|
370 // This also includes existing and older compilers that still identify C++11 as C++0x.
|
nuclear@0
|
371 //
|
nuclear@0
|
372 #if !defined(OVR_CPP11_ENABLED) && defined(__cplusplus)
|
nuclear@0
|
373 #if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
nuclear@0
|
374 #define OVR_CPP11_ENABLED 1
|
nuclear@0
|
375 #elif defined(_MSC_VER) && (_MSC_VER >= 1500) // VS2010+, the first version with any significant C++11 support.
|
nuclear@0
|
376 #define OVR_CPP11_ENABLED 1
|
nuclear@0
|
377 #elif (__cplusplus >= 201103L) // 201103 is the first C++11 version.
|
nuclear@0
|
378 #define OVR_CPP11_ENABLED 1
|
nuclear@0
|
379 #else
|
nuclear@0
|
380 // Leave undefined
|
nuclear@0
|
381 #endif
|
nuclear@0
|
382 #endif
|
nuclear@0
|
383
|
nuclear@0
|
384 #if !defined(OVR_CPP_CPP14_ENABLED) && defined(__cplusplus)
|
nuclear@0
|
385 #if defined(_MSC_VER) && (_MSC_VER >= 1800) // VS2013+, the first version with any significant C++14 support.
|
nuclear@0
|
386 #define OVR_CPP_CPP14_ENABLED 1
|
nuclear@0
|
387 #elif (__cplusplus > 201103L)
|
nuclear@0
|
388 #define OVR_CPP_CPP14_ENABLED 1
|
nuclear@0
|
389 #else
|
nuclear@0
|
390 // Leave undefined
|
nuclear@0
|
391 #endif
|
nuclear@0
|
392 #endif
|
nuclear@0
|
393
|
nuclear@0
|
394
|
nuclear@0
|
395 //-----------------------------------------------------------------------------------
|
nuclear@0
|
396 // ***** OVR_CPP_NO_EXCEPTIONS / OVR_CPP_NO_UNWIND
|
nuclear@0
|
397 //
|
nuclear@0
|
398 // OVR_CPP_NO_EXCEPTIONS is defined as 1 if the compiler doesn't support C++
|
nuclear@0
|
399 // exceptions or is configured to disable support for them. Else not defined.
|
nuclear@0
|
400 // If OVR_CPP_NO_EXCEPTIONS is defined then attempts to use try/catch
|
nuclear@0
|
401 // related C++ statements result in a compilation error with many
|
nuclear@0
|
402 // compilers.
|
nuclear@0
|
403 //
|
nuclear@0
|
404 // OVR_CPP_NO_UNWIND is defined as 1 if the compiler supports exceptions but
|
nuclear@0
|
405 // doesn't support stack unwinding in the presence of an exception. Else not defined.
|
nuclear@0
|
406 // For the Microsoft compiler, disabling exceptions means disabling stack unwinding
|
nuclear@0
|
407 // and not disabling exceptions themselves.
|
nuclear@0
|
408 //
|
nuclear@0
|
409 // Example usage:
|
nuclear@0
|
410 // void Test() {
|
nuclear@0
|
411 // #if !defined(OVR_CPP_NO_EXCEPTIONS)
|
nuclear@0
|
412 // try {
|
nuclear@0
|
413 // #endif
|
nuclear@0
|
414 // void* ptr = new Object;
|
nuclear@0
|
415 // #if !defined(OVR_CPP_NO_EXCEPTIONS)
|
nuclear@0
|
416 // catch(...) { ... }
|
nuclear@0
|
417 // #endif
|
nuclear@0
|
418
|
nuclear@0
|
419 #if !defined(OVR_CPP_NO_EXCEPTIONS)
|
nuclear@0
|
420 #if defined(OVR_CPP_GNUC) && defined(_NO_EX)
|
nuclear@0
|
421 #define OVR_CPP_NO_EXCEPTIONS 1
|
nuclear@0
|
422 #elif (defined(OVR_CC_GNU) || defined(OVR_CC_CLANG) || defined(OVR_CC_INTEL) || defined(OVR_CC_ARM)) && !defined(__EXCEPTIONS)
|
nuclear@0
|
423 #define OVR_CPP_NO_EXCEPTIONS 1
|
nuclear@0
|
424 #elif defined(OVR_CC_MSVC) && !defined(_CPPUNWIND)
|
nuclear@0
|
425 #define OVR_CPP_NO_UNWIND 1
|
nuclear@0
|
426 #endif
|
nuclear@0
|
427 #endif
|
nuclear@0
|
428
|
nuclear@0
|
429
|
nuclear@0
|
430 //-----------------------------------------------------------------------------------
|
nuclear@0
|
431 // ***** OVR_CPP_NO_RTTI
|
nuclear@0
|
432 //
|
nuclear@0
|
433 // Defined as 1 if C++ run-time type information support is unavailable or disabled
|
nuclear@0
|
434 // by the compiler. Else undefined. Allows you to write portable code in the face
|
nuclear@0
|
435 // of the possibility that RTTI is disabled.
|
nuclear@0
|
436 //
|
nuclear@0
|
437 // Example usage:
|
nuclear@0
|
438 // #if !OVR_CPP_NO_RTTI
|
nuclear@0
|
439 // #include <typeinfo>
|
nuclear@0
|
440 // int x = std::dynamic_cast<int>(3.4f);
|
nuclear@0
|
441 // #endif
|
nuclear@0
|
442
|
nuclear@0
|
443 #if defined(__clang__) && !OVR_CC_HAS_FEATURE(cxx_rtti)
|
nuclear@0
|
444 #define OVR_CPP_NO_RTTI 1
|
nuclear@0
|
445 #elif defined(__GNUC__) && !defined(__GXX_RTTI)
|
nuclear@0
|
446 #define OVR_CPP_NO_RTTI 1
|
nuclear@0
|
447 #elif defined(_MSC_VER) && !defined(_CPPRTTI)
|
nuclear@0
|
448 #define OVR_CPP_NO_RTTI 1
|
nuclear@0
|
449 #elif defined(__CC_ARM) && defined(__TARGET_CPU_MPCORE) && !defined(__RTTI)
|
nuclear@0
|
450 #define OVR_CPP_NO_RTTI 1
|
nuclear@0
|
451 #endif
|
nuclear@0
|
452
|
nuclear@0
|
453
|
nuclear@0
|
454 //-----------------------------------------------------------------------------------
|
nuclear@0
|
455 // ***** OVR_CPP_NO_STATIC_ASSERT
|
nuclear@0
|
456 //
|
nuclear@0
|
457 // Defined as 1 if C++ run-time type information support is available and enabled
|
nuclear@0
|
458 // by the compiler. Else undefined.
|
nuclear@0
|
459 //
|
nuclear@0
|
460 // Example usage:
|
nuclear@0
|
461 // #if OVR_CPP_NO_STATIC_ASSERT
|
nuclear@0
|
462 // #define MY_ASSERT(x) { int zero = 0; switch(zero) {case 0: case (x):;} }
|
nuclear@0
|
463 // #else
|
nuclear@0
|
464 // #define MY_ASSERT(x) static_assert((x), #x)
|
nuclear@0
|
465 // #endif
|
nuclear@0
|
466
|
nuclear@0
|
467 #if !defined(OVR_CPP_NO_STATIC_ASSERT)
|
nuclear@0
|
468 #if !(defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && (__cplusplus >= 201103L)))) && \
|
nuclear@0
|
469 !(defined(__clang__) && defined(__cplusplus) && OVR_CC_HAS_FEATURE(cxx_static_assert)) && \
|
nuclear@0
|
470 !(defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)) && /* VS2010+ */ \
|
nuclear@0
|
471 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) && defined(OVR_CPP11_ENABLED)) /* EDG 4.1+ */
|
nuclear@0
|
472 #define OVR_CPP_NO_STATIC_ASSERT 1
|
nuclear@0
|
473 #endif
|
nuclear@0
|
474 #endif
|
nuclear@0
|
475
|
nuclear@0
|
476
|
nuclear@0
|
477 //-----------------------------------------------------------------------------------
|
nuclear@0
|
478 // ***** OVR_CPP_NO_NULLPTR
|
nuclear@0
|
479 //
|
nuclear@0
|
480 // Defined as 1 if the compiler doesn't support C++11 nullptr built in type.
|
nuclear@0
|
481 // Otherwise undefined. Does not identify if the standard library defines
|
nuclear@0
|
482 // std::nullptr_t, as some standard libraries are further behind in standardization
|
nuclear@0
|
483 // than the compilers using them (e.g. Apple clang with the supplied libstdc++).
|
nuclear@0
|
484 //
|
nuclear@0
|
485 // OVR_Nullptr.h provides a portable nullptr and std::nullptr_t for when the
|
nuclear@0
|
486 // compiler or standard library do not.
|
nuclear@0
|
487
|
nuclear@0
|
488 #if !defined(OVR_CPP_NO_NULLPTR)
|
nuclear@0
|
489 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
490 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_nullptr)) /* clang */ && \
|
nuclear@0
|
491 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
492 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
493 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */
|
nuclear@0
|
494 #define OVR_CPP_NO_NULLPTR 1
|
nuclear@0
|
495 #endif
|
nuclear@0
|
496 #endif
|
nuclear@0
|
497
|
nuclear@0
|
498
|
nuclear@0
|
499 //-----------------------------------------------------------------------------------
|
nuclear@0
|
500 // ***** OVR_CPP_NO_RVALUE_REFERENCES
|
nuclear@0
|
501 //
|
nuclear@0
|
502 // Defined as 1 if the compiler doesn't support C++11 rvalue references and move semantics.
|
nuclear@0
|
503 // Otherwise undefined.
|
nuclear@0
|
504
|
nuclear@0
|
505 #if !defined(OVR_CPP_NO_RVALUE_REFERENCES)
|
nuclear@0
|
506 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
507 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_rvalue_references)) /* clang */ && \
|
nuclear@0
|
508 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
509 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
510 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */
|
nuclear@0
|
511 #define OVR_CPP_NO_RVALUE_REFERENCES 1
|
nuclear@0
|
512 #endif
|
nuclear@0
|
513 #endif
|
nuclear@0
|
514
|
nuclear@0
|
515
|
nuclear@0
|
516 //-----------------------------------------------------------------------------------
|
nuclear@0
|
517 // ***** OVR_CPP_NO_AUTO
|
nuclear@0
|
518 //
|
nuclear@0
|
519 // Defined as 1 if the compiler doesn't support C++11 auto keyword. Otherwise undefined.
|
nuclear@0
|
520
|
nuclear@0
|
521 #if !defined(OVR_CPP_NO_AUTO)
|
nuclear@0
|
522 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
523 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_auto_type)) /* clang */ && \
|
nuclear@0
|
524 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
525 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
526 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 309))) /* EDG 3.9+ */
|
nuclear@0
|
527 #define OVR_CPP_NO_AUTO 1
|
nuclear@0
|
528 #endif
|
nuclear@0
|
529 #endif
|
nuclear@0
|
530
|
nuclear@0
|
531
|
nuclear@0
|
532 //-----------------------------------------------------------------------------------
|
nuclear@0
|
533 // ***** OVR_CPP_NO_RANGE_BASED_FOR_LOOP
|
nuclear@0
|
534 //
|
nuclear@0
|
535 // Defined as 1 if the compiler doesn't support C++11 range-based for loops.
|
nuclear@0
|
536 // Otherwise undefined.
|
nuclear@0
|
537
|
nuclear@0
|
538 #if !defined(OVR_CPP_NO_RANGE_BASED_FOR_LOOP)
|
nuclear@0
|
539 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
540 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_range_for)) /* clang */ && \
|
nuclear@0
|
541 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
542 !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \
|
nuclear@0
|
543 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
544 #define OVR_CPP_NO_RANGE_BASED_FOR_LOOP 1
|
nuclear@0
|
545 #endif
|
nuclear@0
|
546 #endif
|
nuclear@0
|
547
|
nuclear@0
|
548
|
nuclear@0
|
549 //-----------------------------------------------------------------------------------
|
nuclear@0
|
550 // ***** OVR_CPP_NO_CONSTEXPR / OVR_CPP_NO_RELAXED_CONSTEXPR
|
nuclear@0
|
551 //
|
nuclear@0
|
552 // OVR_CPP_NO_CONSTEXPR is defined as 1 if the compiler doesn't support C++11 constexpr.
|
nuclear@0
|
553 // OVR_CPP_NO_RELAXED_CONSTEXPR is defined as 1 if the compiler doesn't support C++14 constexpr.
|
nuclear@0
|
554 // Otherwise undefined.
|
nuclear@0
|
555 // See the OVR_CONSTEXPR / OVR_CONSTEXPR_OR_CONST macros for portable wrappers of this functionality.
|
nuclear@0
|
556
|
nuclear@0
|
557 #if !defined(OVR_CPP_NO_CONSTEXPR)
|
nuclear@0
|
558 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
559 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_constexpr)) /* clang */ && \
|
nuclear@0
|
560 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
561 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */
|
nuclear@0
|
562 // Not supported by VC++ through at least VS2013.
|
nuclear@0
|
563 #define OVR_CPP_NO_CONSTEXPR 1
|
nuclear@0
|
564 #endif
|
nuclear@0
|
565 #endif
|
nuclear@0
|
566
|
nuclear@0
|
567 #if !defined(OVR_CPP_NO_RELAXED_CONSTEXPR)
|
nuclear@0
|
568 #if !defined(OVR_CPP14_ENABLED) || \
|
nuclear@0
|
569 !(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_relaxed_constexpr)) /* clang */
|
nuclear@0
|
570 // Supported only by clang as of this writing.
|
nuclear@0
|
571 #define OVR_CPP_NO_RELAXED_CONSTEXPR 1
|
nuclear@0
|
572 #endif
|
nuclear@0
|
573 #endif
|
nuclear@0
|
574
|
nuclear@0
|
575
|
nuclear@0
|
576 //-----------------------------------------------------------------------------------
|
nuclear@0
|
577 // ***** OVR_CPP_NO_LAMBDA_EXPRESSIONS
|
nuclear@0
|
578 //
|
nuclear@0
|
579 // Defined as 1 if the compiler doesn't support C++11 lambda expressions. Otherwise undefined.
|
nuclear@0
|
580 // Some compilers have slightly crippled versions of this.
|
nuclear@0
|
581
|
nuclear@0
|
582 #if !defined(OVR_CPP_NO_LAMBDA_EXPRESSIONS)
|
nuclear@0
|
583 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
584 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_lambdas)) /* clang */ && \
|
nuclear@0
|
585 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
586 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
587 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
588 // Conversion of lambdas to function pointers is not supported until EDG 4.5.
|
nuclear@0
|
589 #define OVR_CPP_NO_LAMBDA_EXPRESSIONS 1
|
nuclear@0
|
590 #endif
|
nuclear@0
|
591 #endif
|
nuclear@0
|
592
|
nuclear@0
|
593
|
nuclear@0
|
594 //-----------------------------------------------------------------------------------
|
nuclear@0
|
595 // ***** OVR_CPP_NO_ALIGNOF
|
nuclear@0
|
596 //
|
nuclear@0
|
597 // Defined as 1 if the compiler supports C++11 alignof. Otherwise undefined.
|
nuclear@0
|
598 // Some compilers support __alignof__ instead of alignof, so for portability you
|
nuclear@0
|
599 // should use OVR_ALIGNOF instead of directly using C++11 alignof.
|
nuclear@0
|
600
|
nuclear@0
|
601 #if !defined(OVR_CPP_NO_ALIGNOF)
|
nuclear@0
|
602 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
603 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
604 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 300)) /* Apple clang 3.0+ */ && \
|
nuclear@0
|
605 !(defined(__GNUC__) && (OVR_CC_VERSION >= 401)) /* GCC 4.1+ */ && \
|
nuclear@0
|
606 !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \
|
nuclear@0
|
607 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 400))) /* EDG 4.0+ */
|
nuclear@0
|
608 #define OVR_CPP_NO_ALIGNOF 1
|
nuclear@0
|
609 #endif
|
nuclear@0
|
610 #endif
|
nuclear@0
|
611
|
nuclear@0
|
612
|
nuclear@0
|
613 //-----------------------------------------------------------------------------------
|
nuclear@0
|
614 // ***** OVR_CPP_NO_ALIGNAS
|
nuclear@0
|
615 //
|
nuclear@0
|
616 // Defined as 1 if the compiler supports C++11 alignas. Otherwise undefined.
|
nuclear@0
|
617 // See the OVR_ALIGNAS for a portable wrapper for alignas functionality.
|
nuclear@0
|
618
|
nuclear@0
|
619 #if !defined(OVR_CPP_NO_ALIGNAS)
|
nuclear@0
|
620 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
621 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \
|
nuclear@0
|
622 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
623 !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \
|
nuclear@0
|
624 !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \
|
nuclear@0
|
625 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
626 #define OVR_CPP_NO_ALIGNAS 1
|
nuclear@0
|
627 #endif
|
nuclear@0
|
628 #endif
|
nuclear@0
|
629
|
nuclear@0
|
630
|
nuclear@0
|
631 //-----------------------------------------------------------------------------------
|
nuclear@0
|
632 // ***** OVR_CPP_NO_OVERRIDE
|
nuclear@0
|
633 //
|
nuclear@0
|
634 // Defined as 1 if the compiler doesn't support C++11 override. Otherwise undefined.
|
nuclear@0
|
635 // See the OVR_OVERRIDE and OVR_FINALOVERRIDE macros for a portable wrapper.
|
nuclear@0
|
636
|
nuclear@0
|
637 #if !defined(OOVR_CPP_NO_OVERRIDE)
|
nuclear@0
|
638 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
639 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
640 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
641 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
642 !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \
|
nuclear@0
|
643 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
644 #define OVR_CPP_NO_OVERRIDE 1
|
nuclear@0
|
645 #endif
|
nuclear@0
|
646 #endif
|
nuclear@0
|
647
|
nuclear@0
|
648
|
nuclear@0
|
649 //-----------------------------------------------------------------------------------
|
nuclear@0
|
650 // ***** OVR_CPP_NO_FINAL
|
nuclear@0
|
651 //
|
nuclear@0
|
652 // Defined as 1 if the compiler doesn't support C++11 final attribute. Otherwise undefined.
|
nuclear@0
|
653 // See the OVR_FINAL and OVR_FINALOVERRIDE macros for a portable wrapper.
|
nuclear@0
|
654
|
nuclear@0
|
655 #if !defined(OOVR_CPP_NO_FINAL)
|
nuclear@0
|
656 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
657 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
658 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
659 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
660 !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \
|
nuclear@0
|
661 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
662 #define OVR_CPP_NO_FINAL 1
|
nuclear@0
|
663 #endif
|
nuclear@0
|
664 #endif
|
nuclear@0
|
665
|
nuclear@0
|
666
|
nuclear@0
|
667 //-----------------------------------------------------------------------------------
|
nuclear@0
|
668 // ***** OVR_CPP_NO_EXTERN_TEMPLATE
|
nuclear@0
|
669 //
|
nuclear@0
|
670 // Defined as 1 if the compiler doesn't support C++11 extern template.
|
nuclear@0
|
671 // Otherwise undefined. See OVR_EXTERN_TEMPLATE for wrapper macro.
|
nuclear@0
|
672
|
nuclear@0
|
673 #if !defined(OVR_CPP_NO_EXTERN_TEMPLATE)
|
nuclear@0
|
674 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
675 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
676 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
677 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
678 !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \
|
nuclear@0
|
679 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
680 #define OVR_CPP_NO_EXTERN_TEMPLATE 1
|
nuclear@0
|
681 #endif
|
nuclear@0
|
682 #endif
|
nuclear@0
|
683
|
nuclear@0
|
684
|
nuclear@0
|
685 //-----------------------------------------------------------------------------------
|
nuclear@0
|
686 // ***** OVR_CPP_NO_VARIADIC_TEMPLATES
|
nuclear@0
|
687 //
|
nuclear@0
|
688 // Defined as 1 if the compiler doesn't support C++11 variadic templates. Otherwise undefined.
|
nuclear@0
|
689
|
nuclear@0
|
690 #if !defined(OVR_CPP_NO_VARIADIC_TEMPLATES)
|
nuclear@0
|
691 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
692 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_variadic_templates)) /* clang */ && \
|
nuclear@0
|
693 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
694 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
695 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */
|
nuclear@0
|
696 #define OVR_CPP_NO_VARIADIC_TEMPLATES 1
|
nuclear@0
|
697 #endif
|
nuclear@0
|
698 #endif
|
nuclear@0
|
699
|
nuclear@0
|
700
|
nuclear@0
|
701 //-----------------------------------------------------------------------------------
|
nuclear@0
|
702 // ***** OVR_CPP_NO_NOEXCEPT
|
nuclear@0
|
703 //
|
nuclear@0
|
704 // Defined as 1 if the compiler supports C++11 noexcept. Otherwise undefined.
|
nuclear@0
|
705 // http://en.cppreference.com/w/cpp/language/noexcept
|
nuclear@0
|
706 // See OVR_NOEXCEPT / OVR_NOEXCEPT_IF / OVR_NOEXCEPT_EXPR for a portable wrapper
|
nuclear@0
|
707 // for noexcept functionality.
|
nuclear@0
|
708
|
nuclear@0
|
709 #if !defined(OVR_CPP_NO_NOEXCEPT)
|
nuclear@0
|
710 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
711 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_noexcept)) /* clang */ && \
|
nuclear@0
|
712 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
713 !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \
|
nuclear@0
|
714 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
715 #define OVR_CPP_NO_NOEXCEPT 1
|
nuclear@0
|
716 #endif
|
nuclear@0
|
717 #endif
|
nuclear@0
|
718
|
nuclear@0
|
719
|
nuclear@0
|
720 //-----------------------------------------------------------------------------------
|
nuclear@0
|
721 // ***** OVR_CPP_NO_DECLTYPE
|
nuclear@0
|
722 //
|
nuclear@0
|
723 // Defined as 1 if the compiler doesn't support C++11 decltype. Otherwise undefined.
|
nuclear@0
|
724 // Some compilers (e.g. VS2012) support most uses of decltype but don't support
|
nuclear@0
|
725 // decltype with incomplete types (which is an uncommon usage seen usually in
|
nuclear@0
|
726 // template metaprogramming). We don't include this support as a requirement for
|
nuclear@0
|
727 // our definition of decltype support here.
|
nuclear@0
|
728
|
nuclear@0
|
729 #if !defined(OVR_CPP_NO_DECLTYPE)
|
nuclear@0
|
730 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
731 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_decltype)) /* clang */ && \
|
nuclear@0
|
732 !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \
|
nuclear@0
|
733 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
734 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */
|
nuclear@0
|
735 // VC++ fails to support decltype for incomplete types until VS2013.
|
nuclear@0
|
736 // EDG fails to support decltype for incomplete types until v4.8.
|
nuclear@0
|
737 #define OVR_CPP_NO_DECLTYPE 1
|
nuclear@0
|
738 #endif
|
nuclear@0
|
739 #endif
|
nuclear@0
|
740
|
nuclear@0
|
741
|
nuclear@0
|
742 //-----------------------------------------------------------------------------------
|
nuclear@0
|
743 // ***** OVR_CPP_NO_DEFAULTED_FUNCTIONS
|
nuclear@0
|
744 //
|
nuclear@0
|
745 // Defined as 1 if the compiler doesn't support C++11 defaulted functions. Otherwise undefined.
|
nuclear@0
|
746 // Some compilers have slightly crippled versions of this.
|
nuclear@0
|
747
|
nuclear@0
|
748 #if !defined(OVR_CPP_NO_DEFAULTED_FUNCTIONS)
|
nuclear@0
|
749 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
750 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_defaulted_functions))/* clang */ && \
|
nuclear@0
|
751 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
752 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
753 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
754 // Up through at least VS2013 it's unsupported for defaulted move constructors and move assignment operators.
|
nuclear@0
|
755 // Until EDG 4.8 it's unsupported for defaulted move constructors and move assigment operators.
|
nuclear@0
|
756 #define OVR_CPP_NO_DEFAULTED_FUNCTIONS 1
|
nuclear@0
|
757 #endif
|
nuclear@0
|
758 #endif
|
nuclear@0
|
759
|
nuclear@0
|
760
|
nuclear@0
|
761 //-----------------------------------------------------------------------------------
|
nuclear@0
|
762 // ***** OVR_CPP_NO_DELETED_FUNCTIONS
|
nuclear@0
|
763 //
|
nuclear@0
|
764 // Defined as 1 if the compiler doesn't support C++11 deleted functions. Otherwise undefined.
|
nuclear@0
|
765 // Some compilers have slightly crippled versions of this.
|
nuclear@0
|
766
|
nuclear@0
|
767 #if !defined(OVR_CPP_NO_DELETED_FUNCTIONS)
|
nuclear@0
|
768 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
769 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_defaulted_functions)) /* clang */ && \
|
nuclear@0
|
770 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
771 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
772 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
773 // Up through at least VS2013 it's unsupported for defaulted move constructors and move assignment operators.
|
nuclear@0
|
774 // Until EDG 4.8 it's unsupported for defaulted move constructors and move assigment operators.
|
nuclear@0
|
775 #define OVR_CPP_NO_DELETED_FUNCTIONS 1
|
nuclear@0
|
776 #endif
|
nuclear@0
|
777 #endif
|
nuclear@0
|
778
|
nuclear@0
|
779
|
nuclear@0
|
780 //-----------------------------------------------------------------------------------
|
nuclear@0
|
781 // ***** OVR_CPP_NO_STANDARD_LAYOUT_TYPES
|
nuclear@0
|
782 //
|
nuclear@0
|
783 // Defined as 1 if the compiler doesn't support C++11 standard layout (relaxed POD). Otherwise undefined.
|
nuclear@0
|
784 // http://en.cppreference.com/w/cpp/types/is_standard_layout
|
nuclear@0
|
785
|
nuclear@0
|
786 #if !defined(OVR_CPP_NO_STANDARD_LAYOUT_TYPES)
|
nuclear@0
|
787 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
788 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \
|
nuclear@0
|
789 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
790 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
791 !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2013+ */ && \
|
nuclear@0
|
792 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */
|
nuclear@0
|
793 #define OVR_CPP_NO_STANDARD_LAYOUT_TYPES 1
|
nuclear@0
|
794 #endif
|
nuclear@0
|
795 #endif
|
nuclear@0
|
796
|
nuclear@0
|
797
|
nuclear@0
|
798 //-----------------------------------------------------------------------------------
|
nuclear@0
|
799 // ***** OVR_CPP_NO_FORWARD_DECLARED_ENUMS
|
nuclear@0
|
800 //
|
nuclear@0
|
801 // Defined as 1 if the compiler doesn't support C++11 forward declared enums. Otherwise undefined.
|
nuclear@0
|
802
|
nuclear@0
|
803 #if !defined(OVR_CPP_NO_FORWARD_DECLARED_ENUMS)
|
nuclear@0
|
804 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
805 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
806 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
807 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
808 !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \
|
nuclear@0
|
809 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
810 #define OVR_CPP_NO_FORWARD_DECLARED_ENUMS 1
|
nuclear@0
|
811 #endif
|
nuclear@0
|
812 #endif
|
nuclear@0
|
813
|
nuclear@0
|
814
|
nuclear@0
|
815 //-----------------------------------------------------------------------------------
|
nuclear@0
|
816 // ***** OVR_CPP_NO_STRONGLY_TYPED_ENUMS
|
nuclear@0
|
817 //
|
nuclear@0
|
818 // Defined as 1 if the compiler doesn't support C++11 strongly typed enums. Otherwise undefined.
|
nuclear@0
|
819
|
nuclear@0
|
820 #if !defined(OVR_CPP_NO_STRONGLY_TYPED_ENUMS)
|
nuclear@0
|
821 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
822 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_strong_enums)) /* clang */ && \
|
nuclear@0
|
823 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
824 !(defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012+ */ && \
|
nuclear@0
|
825 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 400))) /* EDG 4.0+ */
|
nuclear@0
|
826 #define OVR_CPP_NO_STRONGLY_TYPED_ENUMS 1
|
nuclear@0
|
827 #endif
|
nuclear@0
|
828 #endif
|
nuclear@0
|
829
|
nuclear@0
|
830
|
nuclear@0
|
831 //-----------------------------------------------------------------------------------
|
nuclear@0
|
832 // ***** OVR_CPP_NO_TRAILING_RETURN_TYPES
|
nuclear@0
|
833 //
|
nuclear@0
|
834 // Defined as 1 if the compiler doesn't support C++11 trailing return types. Otherwise undefined.
|
nuclear@0
|
835 // http://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax
|
nuclear@0
|
836
|
nuclear@0
|
837 #if !defined(OVR_CPP_NO_TRAILING_RETURN_TYPES)
|
nuclear@0
|
838 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
839 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_trailing_return)) /* clang */ && \
|
nuclear@0
|
840 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
841 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
842 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
843 #define OVR_CPP_NO_TRAILING_RETURN_TYPES 1
|
nuclear@0
|
844 #endif
|
nuclear@0
|
845 #endif
|
nuclear@0
|
846
|
nuclear@0
|
847
|
nuclear@0
|
848 //-----------------------------------------------------------------------------------
|
nuclear@0
|
849 // ***** OVR_CPP_NO_TEMPLATE_ALIASES
|
nuclear@0
|
850 //
|
nuclear@0
|
851 // Defined as 1 if the compiler doesn't support C++11 template aliases. Otherwise undefined.
|
nuclear@0
|
852
|
nuclear@0
|
853 #if !defined(OVR_CPP_NO_TEMPLATE_ALIASES)
|
nuclear@0
|
854 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
855 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_alias_templates)) /* clang */ && \
|
nuclear@0
|
856 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
857 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
858 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */
|
nuclear@0
|
859 #define OVR_CPP_NO_TEMPLATE_ALIASES 1
|
nuclear@0
|
860 #endif
|
nuclear@0
|
861 #endif
|
nuclear@0
|
862
|
nuclear@0
|
863
|
nuclear@0
|
864 //-----------------------------------------------------------------------------------
|
nuclear@0
|
865 // ***** OVR_CPP_NO_INITIALIZER_LISTS
|
nuclear@0
|
866 //
|
nuclear@0
|
867 // Defined as 1 if the compiler doesn't support C++11 initializer lists. Otherwise undefined.
|
nuclear@0
|
868 // This refers to the compiler support for this and not the Standard Library support for std::initializer_list,
|
nuclear@0
|
869 // as a new compiler with an old standard library (e.g. Apple clang with libstdc++) may not support std::initializer_list.
|
nuclear@0
|
870
|
nuclear@0
|
871 #if !defined(OVR_CPP_NO_INITIALIZER_LISTS)
|
nuclear@0
|
872 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
873 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_generalized_initializers)) /* clang */ && \
|
nuclear@0
|
874 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
875 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
876 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
877 #define OVR_CPP_NO_INITIALIZER_LISTS 1
|
nuclear@0
|
878 #endif
|
nuclear@0
|
879 #endif
|
nuclear@0
|
880
|
nuclear@0
|
881
|
nuclear@0
|
882 //-----------------------------------------------------------------------------------
|
nuclear@0
|
883 // ***** OVR_CPP_NO_NORETURN
|
nuclear@0
|
884 //
|
nuclear@0
|
885 // Defined as 1 if the compiler doesn't support the C++11 noreturn attribute. Otherwise undefined.
|
nuclear@0
|
886 // http://en.cppreference.com/w/cpp/language/attributes
|
nuclear@0
|
887 //
|
nuclear@0
|
888 #if !defined(OVR_CPP_NO_NORETURN)
|
nuclear@0
|
889 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
890 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
891 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
892 !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \
|
nuclear@0
|
893 !(defined(_MSC_VER) && (_MSC_VER >= 1500)) /* VS2008+ */ && \
|
nuclear@0
|
894 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */
|
nuclear@0
|
895 // Supported with VC++ only via __declspec(noreturn) (see OVR_NORETURN).
|
nuclear@0
|
896 #define OVR_CPP_NO_NORETURN 1
|
nuclear@0
|
897 #endif
|
nuclear@0
|
898 #endif
|
nuclear@0
|
899
|
nuclear@0
|
900
|
nuclear@0
|
901 //-----------------------------------------------------------------------------------
|
nuclear@0
|
902 // ***** OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS
|
nuclear@0
|
903 //
|
nuclear@0
|
904 // Defined as 1 if the compiler doesn't support C++11 in-class non-static member initializers. Otherwise undefined.
|
nuclear@0
|
905 // http://en.cppreference.com/w/cpp/language/data_members
|
nuclear@0
|
906
|
nuclear@0
|
907 #if !defined(OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS)
|
nuclear@0
|
908 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
909 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
910 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
911 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
912 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
913 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */
|
nuclear@0
|
914 #define OVR_CPP_NO_NONSTATIC_MEMBER_INITIALIZERS 1
|
nuclear@0
|
915 #endif
|
nuclear@0
|
916 #endif
|
nuclear@0
|
917
|
nuclear@0
|
918
|
nuclear@0
|
919 //-----------------------------------------------------------------------------------
|
nuclear@0
|
920 // ***** OVR_CPP_NO_DOUBLE_TEMPLATE_BRACKETS
|
nuclear@0
|
921 //
|
nuclear@0
|
922 // Defined as 1 if the compiler supports nested template declarations with >>,
|
nuclear@0
|
923 // as supported by C++11. Otherwise undefined.
|
nuclear@0
|
924
|
nuclear@0
|
925 #if !defined(OVR_CPP_NO_DOUBLE_TEMPLATE_ANGLE_BRACKETS)
|
nuclear@0
|
926 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
927 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
928 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
929 !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \
|
nuclear@0
|
930 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
931 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
932 #define OVR_CPP_NO_DOUBLE_TEMPLATE_BRACKETS 1
|
nuclear@0
|
933 #endif
|
nuclear@0
|
934 #endif
|
nuclear@0
|
935
|
nuclear@0
|
936
|
nuclear@0
|
937
|
nuclear@0
|
938 //-----------------------------------------------------------------------------------
|
nuclear@0
|
939 // ***** OVR_CPP_NO_INHERITING_CONSTRUCTORS
|
nuclear@0
|
940 //
|
nuclear@0
|
941 // Defined as 1 if the compiler supports C++11 inheriting constructors. Otherwise undefined.
|
nuclear@0
|
942 // Example usage:
|
nuclear@0
|
943 // struct A { explicit A(int x){} };
|
nuclear@0
|
944 // struct B : public A { using A::A; }; // As if B redeclared A::A(int).
|
nuclear@0
|
945
|
nuclear@0
|
946 #if !defined(OVR_CPP_NO_INHERITING_CONSTRUCTORS)
|
nuclear@0
|
947 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
948 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_inheriting_constructors)) /* clang */ && \
|
nuclear@0
|
949 !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \
|
nuclear@0
|
950 !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \
|
nuclear@0
|
951 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
952 #define OVR_CPP_NO_INHERITING_CONSTRUCTORS 1
|
nuclear@0
|
953 #endif
|
nuclear@0
|
954 #endif
|
nuclear@0
|
955
|
nuclear@0
|
956
|
nuclear@0
|
957 //-----------------------------------------------------------------------------------
|
nuclear@0
|
958 // ***** OVR_CPP_NO_DELEGATING_CONSTRUCTORS
|
nuclear@0
|
959 //
|
nuclear@0
|
960 // Defined as 1 if the compiler supports C++11 delegating constructors. Otherwise undefined.
|
nuclear@0
|
961
|
nuclear@0
|
962 #if !defined(OVR_CPP_NO_DELEGATING_CONSTRUCTORS)
|
nuclear@0
|
963 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
964 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 300)) /* clang 3.0+ */ && \
|
nuclear@0
|
965 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
966 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
967 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
968 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */
|
nuclear@0
|
969 #define OVR_CPP_NO_DELEGATING_CONSTRUCTORS 1
|
nuclear@0
|
970 #endif
|
nuclear@0
|
971 #endif
|
nuclear@0
|
972
|
nuclear@0
|
973
|
nuclear@0
|
974 //-----------------------------------------------------------------------------------
|
nuclear@0
|
975 // ***** OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
nuclear@0
|
976 //
|
nuclear@0
|
977 // Defined as 1 if the compiler supports C++11 function template default arguments. Otherwise undefined.
|
nuclear@0
|
978
|
nuclear@0
|
979 #if !defined(OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
|
nuclear@0
|
980 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
981 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
982 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
983 !(defined(__GNUC__) && (OVR_CC_VERSION >= 403)) /* GCC 4.3+ */ && \
|
nuclear@0
|
984 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
985 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) /* EDG 4.3+ */
|
nuclear@0
|
986 #define OVR_CPP_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS 1
|
nuclear@0
|
987 #endif
|
nuclear@0
|
988 #endif
|
nuclear@0
|
989
|
nuclear@0
|
990
|
nuclear@0
|
991 //-----------------------------------------------------------------------------------
|
nuclear@0
|
992 // ***** OVR_CPP_NO_UNRESTRICTED_UNIONS
|
nuclear@0
|
993 //
|
nuclear@0
|
994 // Defined as 1 if the compiler supports C++11 unrestricted unions. Otherwise undefined.
|
nuclear@0
|
995
|
nuclear@0
|
996 #if !defined(OVR_CPP_NO_UNRESTRICTED_UNIONS)
|
nuclear@0
|
997 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
998 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
999 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
1000 !(defined(__GNUC__) && (OVR_CC_VERSION >= 406)) /* GCC 4.6+ */ && \
|
nuclear@0
|
1001 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */
|
nuclear@0
|
1002 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1003 #define OVR_CPP_NO_UNRESTRICTED_UNIONS 1
|
nuclear@0
|
1004 #endif
|
nuclear@0
|
1005 #endif
|
nuclear@0
|
1006
|
nuclear@0
|
1007
|
nuclear@0
|
1008
|
nuclear@0
|
1009 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1010 // ***** OVR_CPP_NO_EXTENDED_SIZEOF
|
nuclear@0
|
1011 //
|
nuclear@0
|
1012 // Defined as 1 if the compiler supports C++11 class sizeof extensions (e.g. sizeof SomeClass::someMember).
|
nuclear@0
|
1013 // Otherwise undefined.
|
nuclear@0
|
1014
|
nuclear@0
|
1015 #if !defined(OVR_CPP_NO_EXTENDED_SIZEOF)
|
nuclear@0
|
1016 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1017 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
1018 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
1019 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
1020 !(defined(_MSC_VER) && (_MSC_VER >= 1900)) /* VS2014+ */ && \
|
nuclear@0
|
1021 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
1022 #define OVR_CPP_NO_EXTENDED_SIZEOF 1
|
nuclear@0
|
1023 #endif
|
nuclear@0
|
1024 #endif
|
nuclear@0
|
1025
|
nuclear@0
|
1026
|
nuclear@0
|
1027 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1028 // ***** OVR_CPP_NO_INLINE_NAMESPACES
|
nuclear@0
|
1029 //
|
nuclear@0
|
1030 // Defined as 1 if the compiler supports C++11 inlined namespaces. Otherwise undefined.
|
nuclear@0
|
1031 // http://en.cppreference.com/w/cpp/language/namespace#Inline_namespaces
|
nuclear@0
|
1032
|
nuclear@0
|
1033 #if !defined(OVR_CPP_NO_INLINE_NAMESPACES)
|
nuclear@0
|
1034 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1035 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
1036 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
1037 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
1038 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405))) /* EDG 4.5+ */
|
nuclear@0
|
1039 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1040 #define OVR_CPP_NO_INLINE_NAMESPACES 1
|
nuclear@0
|
1041 #endif
|
nuclear@0
|
1042 #endif
|
nuclear@0
|
1043
|
nuclear@0
|
1044
|
nuclear@0
|
1045 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1046 // ***** OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS
|
nuclear@0
|
1047 //
|
nuclear@0
|
1048 // Defined as 1 if the compiler supports C++11 explicit conversion operators. Otherwise undefined.
|
nuclear@0
|
1049 // http://en.cppreference.com/w/cpp/language/explicit
|
nuclear@0
|
1050
|
nuclear@0
|
1051 #if !defined(OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS)
|
nuclear@0
|
1052 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1053 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_explicit_conversions)) /* clang */ && \
|
nuclear@0
|
1054 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
1055 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
1056 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404))) /* EDG 4.4+ */
|
nuclear@0
|
1057 #define OVR_CPP_NO_EXPLICIT_CONVERSION_OPERATORS 1
|
nuclear@0
|
1058 #endif
|
nuclear@0
|
1059 #endif
|
nuclear@0
|
1060
|
nuclear@0
|
1061
|
nuclear@0
|
1062 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1063 // ***** OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
nuclear@0
|
1064 //
|
nuclear@0
|
1065 // Defined as 1 if the compiler supports C++11 local class template parameters. Otherwise undefined.
|
nuclear@0
|
1066 // Example:
|
nuclear@0
|
1067 // void Test() {
|
nuclear@0
|
1068 // struct LocalClass{ };
|
nuclear@0
|
1069 // SomeTemplateClass<LocalClass> t; // Allowed only in C++11
|
nuclear@0
|
1070 // }
|
nuclear@0
|
1071
|
nuclear@0
|
1072 #if !defined(OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS)
|
nuclear@0
|
1073 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1074 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_local_type_template_args)) /* clang */ && \
|
nuclear@0
|
1075 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
1076 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
1077 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402))) /* EDG 4.2+ */
|
nuclear@0
|
1078 #define OVR_CPP_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS 1
|
nuclear@0
|
1079 #endif
|
nuclear@0
|
1080 #endif
|
nuclear@0
|
1081
|
nuclear@0
|
1082
|
nuclear@0
|
1083 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1084 // ***** OVR_CPP_NO_NEW_CHARACTER_TYPES
|
nuclear@0
|
1085 //
|
nuclear@0
|
1086 // Defined as 1 if the compiler natively supports C++11 char16_t and char32_t. Otherwise undefined.
|
nuclear@0
|
1087 // VC++ through at least VS2013 defines char16_t as unsigned short in its standard library,
|
nuclear@0
|
1088 // but it is not a native type or unique type, nor can you for a string literal with it.
|
nuclear@0
|
1089
|
nuclear@0
|
1090 #if !defined(OVR_CPP_NO_NEW_CHARACTER_TYPES)
|
nuclear@0
|
1091 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1092 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_unicode_literals)) /* clang */ && \
|
nuclear@0
|
1093 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
1094 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */
|
nuclear@0
|
1095 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1096 #define OVR_CPP_NO_NEW_CHARACTER_TYPES 1
|
nuclear@0
|
1097 #endif
|
nuclear@0
|
1098 #endif
|
nuclear@0
|
1099
|
nuclear@0
|
1100
|
nuclear@0
|
1101 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1102 // ***** OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS
|
nuclear@0
|
1103 //
|
nuclear@0
|
1104 // Defined as 1 if the compiler supports C++11 \u and \U character literals for
|
nuclear@0
|
1105 // native char16_t and char32_t types.
|
nuclear@0
|
1106 //
|
nuclear@0
|
1107 #if !defined(OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS)
|
nuclear@0
|
1108 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1109 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
1110 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
1111 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
1112 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
1113 // Not supported by VC++ as of VS2013. VC++'s existing \U and \u are non-conforming.
|
nuclear@0
|
1114 #define OVR_CPP_NO_UNICODE_CHAR_NAME_LITERALS 1
|
nuclear@0
|
1115 #endif
|
nuclear@0
|
1116 #endif
|
nuclear@0
|
1117
|
nuclear@0
|
1118
|
nuclear@0
|
1119 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1120 // ***** OVR_CPP_NO_USER_DEFINED_LITERALS
|
nuclear@0
|
1121 //
|
nuclear@0
|
1122 // Defined as 1 if the compiler supports C++11 user-defined literals. Otherwise undefined.
|
nuclear@0
|
1123
|
nuclear@0
|
1124 #if !defined(OVR_CPP_NO_USER_DEFINED_LITERALS)
|
nuclear@0
|
1125 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1126 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 301)) /* clang 3.1+ */ && \
|
nuclear@0
|
1127 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 401)) /* Apple clang 4.1+ */ && \
|
nuclear@0
|
1128 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
1129 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
1130 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1131 #define OVR_CPP_NO_USER_DEFINED_LITERALS 1
|
nuclear@0
|
1132 #endif
|
nuclear@0
|
1133 #endif
|
nuclear@0
|
1134
|
nuclear@0
|
1135
|
nuclear@0
|
1136 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1137 // ***** OVR_CPP_NO_UNICODE_STRING_LITERALS
|
nuclear@0
|
1138 //
|
nuclear@0
|
1139 // Defined as 1 if the compiler supports C++11 Unicode string literals. Otherwise undefined.
|
nuclear@0
|
1140 // http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals
|
nuclear@0
|
1141
|
nuclear@0
|
1142 #if !defined(OVR_CPP_NO_UNICODE_STRING_LITERALS)
|
nuclear@0
|
1143 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1144 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_unicode_literals)) /* clang */ && \
|
nuclear@0
|
1145 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
1146 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */
|
nuclear@0
|
1147 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1148 #define OVR_CPP_NO_UNICODE_STRING_LITERALS 1
|
nuclear@0
|
1149 #endif
|
nuclear@0
|
1150 #endif
|
nuclear@0
|
1151
|
nuclear@0
|
1152
|
nuclear@0
|
1153 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1154 // ***** OVR_CPP_NO_RAW_STRING_LITERALS
|
nuclear@0
|
1155 //
|
nuclear@0
|
1156 // Defined as 1 if the compiler supports C++11 raw literals. Otherwise undefined.
|
nuclear@0
|
1157 // http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals
|
nuclear@0
|
1158
|
nuclear@0
|
1159 #if !defined(OVR_CPP_NO_RAW_STRING_LITERALS)
|
nuclear@0
|
1160 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1161 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_raw_string_literals)) /* clang */ && \
|
nuclear@0
|
1162 !(defined(__GNUC__) && (OVR_CC_VERSION >= 405)) /* GCC 4.5+ */ && \
|
nuclear@0
|
1163 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407))) /* EDG 4.7+ */
|
nuclear@0
|
1164 // Not supported by VC++ as of VS2013.
|
nuclear@0
|
1165 #define OVR_CPP_NO_RAW_STRING_LITERALS 1
|
nuclear@0
|
1166 #endif
|
nuclear@0
|
1167 #endif
|
nuclear@0
|
1168
|
nuclear@0
|
1169
|
nuclear@0
|
1170 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1171 // ***** OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX
|
nuclear@0
|
1172 //
|
nuclear@0
|
1173 // Defined as 1 if the compiler supports C++11 unified initialization.
|
nuclear@0
|
1174 // http://en.wikipedia.org/wiki/C%2B%2B11#Uniform_initialization
|
nuclear@0
|
1175
|
nuclear@0
|
1176 #if !defined(OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX)
|
nuclear@0
|
1177 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1178 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_generalized_initializers)) /* clang */ && \
|
nuclear@0
|
1179 !(defined(__GNUC__) && (OVR_CC_VERSION >= 404)) /* GCC 4.4+ */ && \
|
nuclear@0
|
1180 !(defined(_MSC_VER) && (_MSC_VER >= 1800)) /* VS2013+ */ && \
|
nuclear@0
|
1181 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406))) /* EDG 4.6+ */
|
nuclear@0
|
1182 #define OVR_CPP_NO_UNIFIED_INITIALIZATION_SYNTAX 1
|
nuclear@0
|
1183 #endif
|
nuclear@0
|
1184 #endif
|
nuclear@0
|
1185
|
nuclear@0
|
1186
|
nuclear@0
|
1187 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1188 // ***** OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS
|
nuclear@0
|
1189 //
|
nuclear@0
|
1190 // Defined as 1 if the compiler supports C++11 extended friends.
|
nuclear@0
|
1191
|
nuclear@0
|
1192 #if !defined(OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS)
|
nuclear@0
|
1193 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1194 (!(defined(__clang__) && !defined(__APPLE__) && (__clang__ >= 209)) /* clang 2.9+ */ && \
|
nuclear@0
|
1195 !(defined(__clang__) && defined(__APPLE__) && (__clang__ >= 400)) /* Apple clang 4.0+ */ && \
|
nuclear@0
|
1196 !(defined(__GNUC__) && (OVR_CC_VERSION >= 407)) /* GCC 4.7+ */ && \
|
nuclear@0
|
1197 !(defined(_MSC_VER) && (_MSC_VER >= 1600)) /* VS2010+ */ && \
|
nuclear@0
|
1198 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401))) /* EDG 4.1+ */
|
nuclear@0
|
1199 #define OVR_CPP_NO_EXTENDED_FRIEND_DECLARATIONS 1
|
nuclear@0
|
1200 #endif
|
nuclear@0
|
1201 #endif
|
nuclear@0
|
1202
|
nuclear@0
|
1203
|
nuclear@0
|
1204 //-----------------------------------------------------------------------------------
|
nuclear@0
|
1205 // ***** OVR_CPP_NO_THREAD_LOCAL
|
nuclear@0
|
1206 //
|
nuclear@0
|
1207 // Defined as 1 if the compiler supports C++11 thread_local. Else undefined. Does not
|
nuclear@0
|
1208 // indicate if the compiler supports C thread-local compiler extensions such as __thread
|
nuclear@0
|
1209 // and declspec(thread). Use OVR_THREAD_LOCAL if you want to declare a thread-local
|
nuclear@0
|
1210 // variable that supports C++11 thread_local when available but the C extension when
|
nuclear@0
|
1211 // it's available. The primary difference between C++11 thread_local and C extensions is
|
nuclear@0
|
1212 // that C++11 thread_local supports non-PODs and calls their constructors and destructors.
|
nuclear@0
|
1213 //
|
nuclear@0
|
1214 // Note that thread_local requires both compiler and linker support, and so it's possible
|
nuclear@0
|
1215 // that the compiler may support thread_local but the linker does not.
|
nuclear@0
|
1216
|
nuclear@0
|
1217 #if !defined(OVR_CPP_NO_THREAD_LOCAL)
|
nuclear@0
|
1218 #if !defined(OVR_CPP11_ENABLED) || \
|
nuclear@0
|
1219 (!(defined(__clang__) && OVR_CC_HAS_FEATURE(cxx_thread_local)) /* clang */ && \
|
nuclear@0
|
1220 !(defined(__GNUC__) && (OVR_CC_VERSION >= 408)) /* GCC 4.8+ */ && \
|
nuclear@0
|
1221 !(defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 408))) /* EDG 4.8+ */
|
nuclear@0
|
1222 #define OVR_CPP_NO_THREAD_LOCAL 1
|
nuclear@0
|
1223 #endif
|
nuclear@0
|
1224 #endif
|
nuclear@0
|
1225
|
nuclear@0
|
1226
|
nuclear@0
|
1227 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1228 // ***** OVR_ALIGNAS / OVR_ALIGNOF
|
nuclear@0
|
1229 //
|
nuclear@0
|
1230 // OVR_ALIGNAS(n) // Specifies a size_t power of two alignment for a type or instance.
|
nuclear@0
|
1231 // OVR_ALIGNOF(type) // Returns the size_t alignment of a type or instance.
|
nuclear@0
|
1232 //
|
nuclear@0
|
1233 // Example usage:
|
nuclear@0
|
1234 // OVR_ALIGNAS(8) char c = 'c'; // Specifies that the instance c be aligned to an 8 byte boundary.
|
nuclear@0
|
1235 // typedef OVR_ALIGNAS(8) char C; // Specifies that the type C be aligned to an 8 byte boundary.
|
nuclear@0
|
1236 // struct OVR_ALIGNAS(64) S{ char array[16]; }; // Specfies that the struct S have a natural alignment of 64.
|
nuclear@0
|
1237 // OVR_ALIGNAS(32) S s; // Specifies that the instance s of struct S be aligned to an 32 byte boundary.
|
nuclear@0
|
1238 // OVR_ALIGNAS(32) struct T{ char array[16]; } t; // Specfies that the instance t of struct T have a natural alignment of 32.
|
nuclear@0
|
1239 // 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).
|
nuclear@0
|
1240 //
|
nuclear@0
|
1241 // size_t a = OVR_ALIGNOF(double); // Returns the natural alignment of the double type.
|
nuclear@0
|
1242 // size_t a = OVR_ALIGNOF(S); // Returns the natural alignment of the struct S type.
|
nuclear@0
|
1243 //
|
nuclear@0
|
1244 // Note: If C++11 alignas is supported, then alignas/OVR_ALIGNAS may take a const expression in addition to a constant.
|
nuclear@0
|
1245 // Note: The C11 Standard species the _Alignas keyword and alignas as a macro for it in <stdalign.h>
|
nuclear@0
|
1246
|
nuclear@0
|
1247 #if !defined(OVR_ALIGNAS)
|
nuclear@0
|
1248 #if defined(OVR_CC_GNU) && !defined(OVR_CPP_NO_ALIGNAS) // If C++11 alignas is supported...
|
nuclear@0
|
1249 #define OVR_ALIGNAS(n) alignas(n)
|
nuclear@0
|
1250 #elif defined(__clang__) && !defined(OVR_CPP_NO_ALIGNAS)
|
nuclear@0
|
1251 #define OVR_ALIGNAS(n) alignas(n)
|
nuclear@0
|
1252 #elif defined(OVR_CC_GNU) || defined(__clang__)
|
nuclear@0
|
1253 #define OVR_ALIGNAS(n) __attribute__((aligned(n)))
|
nuclear@0
|
1254 #elif defined(OVR_CC_MSVC) || defined(OVR_CC_INTEL)
|
nuclear@0
|
1255 #define OVR_ALIGNAS(n) __declspec(align(n)) // For Microsoft the alignment must be a literal integer.
|
nuclear@0
|
1256 #elif defined(OVR_CC_ARM)
|
nuclear@0
|
1257 #define OVR_ALIGNAS(n) __align(n)
|
nuclear@0
|
1258 #else
|
nuclear@0
|
1259 #error Need to define OVR_ALIGNAS
|
nuclear@0
|
1260 #endif
|
nuclear@0
|
1261 #endif
|
nuclear@0
|
1262
|
nuclear@0
|
1263 #if !defined(OVR_ALIGNOF)
|
nuclear@0
|
1264 #if defined(OVR_CC_GNU) && !defined(OVR_CPP_NO_ALIGNOF) // If C++11 alignof is supported...
|
nuclear@0
|
1265 #define OVR_ALIGNOF(type) alignof(type)
|
nuclear@0
|
1266 #elif defined(__clang__) && !defined(OVR_CPP_NO_ALIGNOF)
|
nuclear@0
|
1267 #define OVR_ALIGNOF(type) alignof(type)
|
nuclear@0
|
1268 #elif defined(OVR_CC_GNU) || defined(__clang__)
|
nuclear@0
|
1269 #define OVR_ALIGNOF(type) ((size_t)__alignof__(type))
|
nuclear@0
|
1270 #elif defined(OVR_CC_MSVC) || defined(OVR_CC_INTEL)
|
nuclear@0
|
1271 #define OVR_ALIGNOF(type) ((size_t)__alignof(type))
|
nuclear@0
|
1272 #elif defined(OVR_CC_ARM)
|
nuclear@0
|
1273 #define OVR_ALIGNOF(type) ((size_t)__ALIGNOF__(type))
|
nuclear@0
|
1274 #else
|
nuclear@0
|
1275 #error Need to define OVR_ALIGNOF
|
nuclear@0
|
1276 #endif
|
nuclear@0
|
1277 #endif
|
nuclear@0
|
1278
|
nuclear@0
|
1279
|
nuclear@0
|
1280 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1281 // ***** OVR_ASSUME / OVR_ANALYSIS_ASSUME
|
nuclear@0
|
1282 //
|
nuclear@0
|
1283 // This is a portable wrapper for VC++'s __assume and __analysis_assume.
|
nuclear@0
|
1284 // __analysis_assume is typically used to quell VC++ static analysis warnings.
|
nuclear@0
|
1285 //
|
nuclear@0
|
1286 // Example usage:
|
nuclear@0
|
1287 // void Test(char c){
|
nuclear@0
|
1288 // switch(c){
|
nuclear@0
|
1289 // case 'a':
|
nuclear@0
|
1290 // case 'b':
|
nuclear@0
|
1291 // case 'c':
|
nuclear@0
|
1292 // case 'd':
|
nuclear@0
|
1293 // break;
|
nuclear@0
|
1294 // default:
|
nuclear@0
|
1295 // OVR_ASSUME(0); // Unreachable code.
|
nuclear@0
|
1296 // }
|
nuclear@0
|
1297 // }
|
nuclear@0
|
1298 //
|
nuclear@0
|
1299 // size_t Test(char* str){
|
nuclear@0
|
1300 // OVR_ANALYSIS_ASSUME(str != nullptr);
|
nuclear@0
|
1301 // return strlen(str);
|
nuclear@0
|
1302 // }
|
nuclear@0
|
1303
|
nuclear@0
|
1304 #if !defined(OVR_ASSUME)
|
nuclear@0
|
1305 #if defined(OVR_CC_MSVC)
|
nuclear@0
|
1306 #define OVR_ASSUME(x) __assume(x)
|
nuclear@0
|
1307 #define OVR_ANALYSIS_ASSUME(x) __analysis_assume(!!(x))
|
nuclear@0
|
1308 #else
|
nuclear@0
|
1309 #define OVR_ASSUME(x)
|
nuclear@0
|
1310 #define OVR_ANALYSIS_ASSUME(x)
|
nuclear@0
|
1311 #endif
|
nuclear@0
|
1312 #endif
|
nuclear@0
|
1313
|
nuclear@0
|
1314
|
nuclear@0
|
1315 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1316 // ***** OVR_RESTRICT
|
nuclear@0
|
1317 //
|
nuclear@0
|
1318 // Wraps the C99 restrict keyword in a portable way.
|
nuclear@0
|
1319 // C++11 and C++14 don't have restrict but this functionality is supported by
|
nuclear@0
|
1320 // all C++ compilers.
|
nuclear@0
|
1321 //
|
nuclear@0
|
1322 // Example usage:
|
nuclear@0
|
1323 // void* memcpy(void* OVR_RESTRICT s1, const void* OVR_RESTRICT s2, size_t n);
|
nuclear@0
|
1324
|
nuclear@0
|
1325 #if !defined(OVR_RESTRICT)
|
nuclear@0
|
1326 #define OVR_RESTRICT __restrict // Currently supported by all compilers of significance to us.
|
nuclear@0
|
1327 #endif
|
nuclear@0
|
1328
|
nuclear@0
|
1329
|
nuclear@0
|
1330 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1331 // ***** OVR_NOEXCEPT / OVR_NOEXCEPT_IF(predicate) / OVR_NOEXCEPT_EXPR(expression)
|
nuclear@0
|
1332 //
|
nuclear@0
|
1333 // Implements a portable wrapper for C++11 noexcept.
|
nuclear@0
|
1334 // http://en.cppreference.com/w/cpp/language/noexcept
|
nuclear@0
|
1335 //
|
nuclear@0
|
1336 // Example usage:
|
nuclear@0
|
1337 // void Test() OVR_NOEXCEPT {} // This function doesn't throw.
|
nuclear@0
|
1338 //
|
nuclear@0
|
1339 // template <typename T>
|
nuclear@0
|
1340 // void DoNothing() OVR_NOEXCEPT_IF(OVR_NOEXCEPT_EXPR(T())) // Throws an if and only if T::T(int) throws.
|
nuclear@0
|
1341 // { T t(3); }
|
nuclear@0
|
1342 //
|
nuclear@0
|
1343 #if !defined(OVR_NOEXCEPT)
|
nuclear@0
|
1344 #if defined(OVR_CPP_NOEXCEPT)
|
nuclear@0
|
1345 #define OVR_NOEXCEPT
|
nuclear@0
|
1346 #define OVR_NOEXCEPT_IF(predicate)
|
nuclear@0
|
1347 #define OVR_NOEXCEPT_EXPR(expression) false
|
nuclear@0
|
1348 #else
|
nuclear@0
|
1349 #define OVR_NOEXCEPT noexcept
|
nuclear@0
|
1350 #define OVR_NOEXCEPT_IF(predicate) noexcept((predicate))
|
nuclear@0
|
1351 #define OVR_NOEXCEPT_EXPR(expression) noexcept((expression))
|
nuclear@0
|
1352 #endif
|
nuclear@0
|
1353 #endif
|
nuclear@0
|
1354
|
nuclear@0
|
1355
|
nuclear@0
|
1356 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1357 // ***** OVR_FINAL
|
nuclear@0
|
1358 //
|
nuclear@0
|
1359 // Wraps the C++11 final keyword in a portable way.
|
nuclear@0
|
1360 // http://en.cppreference.com/w/cpp/language/final
|
nuclear@0
|
1361 //
|
nuclear@0
|
1362 // Example usage:
|
nuclear@0
|
1363 // struct Test { virtual int GetValue() OVR_FINAL; };
|
nuclear@0
|
1364
|
nuclear@0
|
1365 #if !defined(OVR_FINAL)
|
nuclear@0
|
1366 #if defined(OVR_CC_MSVC) && (OVR_CC_VERSION < 1700) // VC++ 2012 and earlier
|
nuclear@0
|
1367 #define OVR_FINAL sealed
|
nuclear@0
|
1368 #elif defined(OVR_CPP_INHERITANCE_FINAL)
|
nuclear@0
|
1369 #define OVR_FINAL
|
nuclear@0
|
1370 #else
|
nuclear@0
|
1371 #define OVR_FINAL final
|
nuclear@0
|
1372 #endif
|
nuclear@0
|
1373 #endif
|
nuclear@0
|
1374
|
nuclear@0
|
1375
|
nuclear@0
|
1376 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1377 // ***** OVR_OVERRIDE
|
nuclear@0
|
1378 //
|
nuclear@0
|
1379 // Wraps the C++11 override keyword in a portable way.
|
nuclear@0
|
1380 // http://en.cppreference.com/w/cpp/language/override
|
nuclear@0
|
1381 //
|
nuclear@0
|
1382 // Example usage:
|
nuclear@0
|
1383 // struct Parent { virtual void Func(int); };
|
nuclear@0
|
1384 // struct Child : public Parent { void Func(int) OVR_OVERRIDE; };
|
nuclear@0
|
1385
|
nuclear@0
|
1386 #if !defined(OVR_CPP11_ENABLED)
|
nuclear@0
|
1387 #define OVR_OVERRIDE
|
nuclear@0
|
1388 #elif !defined(OVR_OVERRIDE)
|
nuclear@0
|
1389 #if defined(OVR_CPP_OVERRIDE)
|
nuclear@0
|
1390 #define OVR_OVERRIDE
|
nuclear@0
|
1391 #else
|
nuclear@0
|
1392 #if (defined(_MSC_VER) && (_MSC_VER <= 1600))
|
nuclear@0
|
1393 #pragma warning(disable : 4481)
|
nuclear@0
|
1394 #endif
|
nuclear@0
|
1395 #define OVR_OVERRIDE override
|
nuclear@0
|
1396 #endif
|
nuclear@0
|
1397 #endif
|
nuclear@0
|
1398
|
nuclear@0
|
1399
|
nuclear@0
|
1400 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1401 // ***** OVR_FINAL_OVERRIDE
|
nuclear@0
|
1402 //
|
nuclear@0
|
1403 // Wraps the C++11 final+override keywords (a common combination) in a portable way.
|
nuclear@0
|
1404 //
|
nuclear@0
|
1405 // Example usage:
|
nuclear@0
|
1406 // struct Parent { virtual void Func(); };
|
nuclear@0
|
1407 // struct Child : public Parent { virtual void Func() OVR_FINAL_OVERRIDE; };
|
nuclear@0
|
1408
|
nuclear@0
|
1409 #if !defined(OVR_FINAL_OVERRIDE)
|
nuclear@0
|
1410 #define OVR_FINAL_OVERRIDE OVR_FINAL OVR_OVERRIDE
|
nuclear@0
|
1411 #endif
|
nuclear@0
|
1412
|
nuclear@0
|
1413
|
nuclear@0
|
1414 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1415 // ***** OVR_EXTERN_TEMPLATE
|
nuclear@0
|
1416 //
|
nuclear@0
|
1417 // Portable wrapper for C++11 extern template. This tells the compiler to not instantiate
|
nuclear@0
|
1418 // the template in the current translation unit, which can significantly speed up
|
nuclear@0
|
1419 // compilation and avoid problems due to two translation units compiling code with
|
nuclear@0
|
1420 // different settings.
|
nuclear@0
|
1421 //
|
nuclear@0
|
1422 // Example usage:
|
nuclear@0
|
1423 // OVR_EXTERN_TEMPLATE(class basic_string<char>); // Nothing to do for non-C++11 compilers.
|
nuclear@0
|
1424
|
nuclear@0
|
1425 #if !defined(OVR_EXTERN_TEMPLATE)
|
nuclear@0
|
1426 #if defined(OVR_CPP_EXTERN_TEMPLATE)
|
nuclear@0
|
1427 #define OVR_EXTERN_TEMPLATE(decl)
|
nuclear@0
|
1428 #else
|
nuclear@0
|
1429 #define OVR_EXTERN_TEMPLATE(decl) extern template decl
|
nuclear@0
|
1430 #endif
|
nuclear@0
|
1431 #endif
|
nuclear@0
|
1432
|
nuclear@0
|
1433
|
nuclear@0
|
1434 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1435 // ***** OVR_CONSTEXPR / OVR_CONSTEXPR_OR_CONST
|
nuclear@0
|
1436 //
|
nuclear@0
|
1437 // Portable wrapper for C++11 constexpr. Doesn't include C++14 relaxed constexpr,
|
nuclear@0
|
1438 // for which a different wrapper name is reserved.
|
nuclear@0
|
1439 //
|
nuclear@0
|
1440 // Example usage:
|
nuclear@0
|
1441 // OVR_CONSTEXPR int Test() { return 15; } // This can be optimized better by a C++11 compiler that supports constexpr.
|
nuclear@0
|
1442 // 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.
|
nuclear@0
|
1443
|
nuclear@0
|
1444 #if !defined(OVR_CONSTEXPR)
|
nuclear@0
|
1445 #if defined(OVR_CPP_NO_CONSTEXPR)
|
nuclear@0
|
1446 #define OVR_CONSTEXPR
|
nuclear@0
|
1447 #else
|
nuclear@0
|
1448 #define OVR_CONSTEXPR constexpr
|
nuclear@0
|
1449 #endif
|
nuclear@0
|
1450 #endif
|
nuclear@0
|
1451
|
nuclear@0
|
1452 #if !defined(OVR_CONSTEXPR_OR_CONST)
|
nuclear@0
|
1453 #if defined(OVR_CPP_NO_CONSTEXPR)
|
nuclear@0
|
1454 #define OVR_CONSTEXPR_OR_CONST const
|
nuclear@0
|
1455 #else
|
nuclear@0
|
1456 #define OVR_CONSTEXPR_OR_CONST constexpr
|
nuclear@0
|
1457 #endif
|
nuclear@0
|
1458 #endif
|
nuclear@0
|
1459
|
nuclear@0
|
1460
|
nuclear@0
|
1461
|
nuclear@0
|
1462 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1463 // ***** OVR_FUNCTION_DELETE / OVR_FUNCTION_DEFAULT
|
nuclear@0
|
1464 //
|
nuclear@0
|
1465 // Wraps the C++11 delete and default keywords in a way that allows for cleaner code
|
nuclear@0
|
1466 // while making for a better version of uncallable or default functions.
|
nuclear@0
|
1467 //
|
nuclear@0
|
1468 // Example usage:
|
nuclear@0
|
1469 // struct Test{
|
nuclear@0
|
1470 // Test() OVR_FUNCTION_DEFAULT; // Non-C++11 compilers will require a separate definition for Test().
|
nuclear@0
|
1471 // private: // Users should put OVR_FUNCTION_DELETE usage in a private
|
nuclear@0
|
1472 // void Uncallable() OVR_FUNCTION_DELETE; // area for compatibility with pre-C++11 compilers.
|
nuclear@0
|
1473 // };
|
nuclear@0
|
1474
|
nuclear@0
|
1475 #if defined(OVR_CPP_NO_DELETED_FUNCTIONS)
|
nuclear@0
|
1476 #define OVR_FUNCTION_DELETE
|
nuclear@0
|
1477 #else
|
nuclear@0
|
1478 #define OVR_FUNCTION_DELETE = delete
|
nuclear@0
|
1479 #endif
|
nuclear@0
|
1480
|
nuclear@0
|
1481 #if defined(OVR_CPP_NO_DEFAULTED_FUNCTIONS)
|
nuclear@0
|
1482 #define OVR_FUNCTION_DEFAULT
|
nuclear@0
|
1483 #else
|
nuclear@0
|
1484 #define OVR_FUNCTION_DEFAULT = default
|
nuclear@0
|
1485 #endif
|
nuclear@0
|
1486
|
nuclear@0
|
1487
|
nuclear@0
|
1488
|
nuclear@0
|
1489 // -----------------------------------------------------------------------------------
|
nuclear@0
|
1490 // ***** OVR_NON_COPYABLE
|
nuclear@0
|
1491 //
|
nuclear@0
|
1492 // Allows you to specify a class as being neither copy-constructible nor assignable,
|
nuclear@0
|
1493 // which is a commonly needed pattern in C++ programming. Classes with this declaration
|
nuclear@0
|
1494 // are required to be default constructible (as are most classes). For pre-C++11
|
nuclear@0
|
1495 // compilers this macro declares a private section for the class, which will be
|
nuclear@0
|
1496 // inherited by whatever code is directly below the macro invocation by default.
|
nuclear@0
|
1497 //
|
nuclear@0
|
1498 // Example usage:
|
nuclear@0
|
1499 // struct Test {
|
nuclear@0
|
1500 // Test();
|
nuclear@0
|
1501 // ...
|
nuclear@0
|
1502 // OVR_NON_COPYABLE(Test)
|
nuclear@0
|
1503 // };
|
nuclear@0
|
1504
|
nuclear@0
|
1505 #if !defined(OVR_NON_COPYABLE)
|
nuclear@0
|
1506 #if defined(OVR_CPP_NO_DELETED_FUNCTIONS)
|
nuclear@0
|
1507 #define OVR_NON_COPYABLE(Type) \
|
nuclear@0
|
1508 private: \
|
nuclear@0
|
1509 Type(const Type&); \
|
nuclear@0
|
1510 void operator=(const Type&);
|
nuclear@0
|
1511 #else
|
nuclear@0
|
1512 #define OVR_NON_COPYABLE(Type) \
|
nuclear@0
|
1513 Type(const Type&) = delete; \
|
nuclear@0
|
1514 void operator=(const Type&) = delete;
|
nuclear@0
|
1515 #endif
|
nuclear@0
|
1516 #endif
|
nuclear@0
|
1517
|
nuclear@0
|
1518
|
nuclear@0
|
1519
|
nuclear@0
|
1520 #endif // header include guard
|
nuclear@0
|
1521
|
nuclear@0
|
1522
|
nuclear@0
|
1523
|
nuclear@0
|
1524
|