UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cxx.h
Go to the documentation of this file.
1 #pragma once
2 
3 #define GCC_ATLEAST(major, minor) (defined __GNUC__ && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
4 
5 #ifndef __has_extension // clang feature detection
6 # ifdef __has_feature
7 # define __has_extension __has_feature
8 # else
9 # define __has_extension(x) 0
10 # endif
11 #endif
12 
13 #define CXX11(gcc_major, gcc_minor, msc_ver, clang_feature) ( \
14  __cplusplus >= 201103L || \
15  (defined __GXX_EXPERIMENTAL_CXX0X__ && GCC_ATLEAST((gcc_major), (gcc_minor))) || \
16  (defined _MSC_VER && (msc_ver) != 0 && _MSC_VER >= (msc_ver)) || \
17  __has_extension(clang_feature) \
18 )
19 
20 #if CXX11(4, 4, 0, cxx_defaulted_functions)
21 # define DEFAULT = default
22 #else
23 # define DEFAULT {}
24 #endif
25 
26 #if CXX11(4, 4, 0, cxx_deleted_functions)
27 # define DELETED = delete
28 #else
29 # define DELETED
30 #endif
31 
32 #if !CXX11(4, 7, 1400, cxx_override_control)
33 # define override
34 #endif
35 
36 #ifndef __GNUC__
37 # define __attribute__(x)
38 #endif
39 
40 #ifdef _MSC_VER
41 # define __func__ __FUNCTION__
42 # define __PRETTY_FUNCTION__ __FUNCSIG__
43 # if _MSC_VER < 1900
44 # define snprintf _snprintf
45 # endif
46 # if _MSC_VER < 1800
47 # define round(x) ((x) < 0 ? -std::floor(0.5 - (x)) : std::floor(0.5 + (x)))
48 # endif
49 #else
50 # if __cplusplus < 201103L
51 # ifndef nullptr
52 /* not typesafe as the real nullptr from c++11 */
53 # define nullptr 0
54 # endif
55 # endif
56 #endif
57 
58 #if __cplusplus >= 201103L
59 # define register
60 #endif