|
61 | 61 | # define LL_UNLIKELY(EXPR) (EXPR) |
62 | 62 | #endif |
63 | 63 |
|
64 | | - |
65 | 64 | // Figure out differences between compilers |
66 | | -#if defined(__clang__) |
67 | | - #define GCC_VERSION (__GNUC__ * 10000 \ |
68 | | - + __GNUC_MINOR__ * 100 \ |
69 | | - + __GNUC_PATCHLEVEL__) |
| 65 | +#if defined(__MSVC_VER__) || defined(_MSC_VER) |
| 66 | + #ifndef LL_MSVC |
| 67 | + #define LL_MSVC 1 |
| 68 | + #endif |
| 69 | + |
| 70 | + // Clang CL is MSVC-like but also supports its own macros |
| 71 | + #if defined(__clang__) |
| 72 | + #ifndef LL_CLANG |
| 73 | + #define LL_CLANG 1 |
| 74 | + #endif |
| 75 | + #endif |
| 76 | +#elif defined(__clang__) |
| 77 | + #define CLANG_VERSION (__clang_major__ * 10000 \ |
| 78 | + + __clang_minor__ * 100 \ |
| 79 | + + __clang_patchlevel__) |
70 | 80 | #ifndef LL_CLANG |
71 | 81 | #define LL_CLANG 1 |
72 | 82 | #endif |
73 | | - #ifndef LL_GNUC |
74 | | - #define LL_GNUC 1 |
75 | | - #endif |
76 | 83 | #elif defined(__GNUC__) |
77 | 84 | #define GCC_VERSION (__GNUC__ * 10000 \ |
78 | 85 | + __GNUC_MINOR__ * 100 \ |
79 | 86 | + __GNUC_PATCHLEVEL__) |
80 | 87 | #ifndef LL_GNUC |
81 | 88 | #define LL_GNUC 1 |
82 | 89 | #endif |
83 | | -#elif defined(__MSVC_VER__) || defined(_MSC_VER) |
84 | | - #ifndef LL_MSVC |
85 | | - #define LL_MSVC 1 |
86 | | - #endif |
87 | 90 | #endif |
88 | 91 |
|
89 | 92 | // Set up CPU architecture defines |
90 | 93 | #if LL_MSVC && defined(_M_ARM64) |
91 | 94 | # define LL_ARM64 1 |
92 | | -#elif LL_GNUC && (defined(__arm64__) || defined(__aarch64__)) |
| 95 | +#elif (LL_GNUC || LL_CLANG) && (defined(__arm64__) || defined(__aarch64__)) |
93 | 96 | # define LL_ARM64 1 |
94 | 97 | #elif LL_MSVC && _M_X64 |
95 | 98 | # define LL_X86_64 1 |
96 | 99 | # define LL_X86 1 |
97 | 100 | #elif LL_MSVC && _M_IX86 |
98 | 101 | # define LL_X86 1 |
99 | | -#elif LL_GNUC && ( defined(__amd64__) || defined(__x86_64__) ) |
| 102 | +#elif (LL_GNUC || LL_CLANG) && ( defined(__amd64__) || defined(__x86_64__) ) |
100 | 103 | # define LL_X86_64 1 |
101 | 104 | # define LL_X86 1 |
102 | | -#elif LL_GNUC && ( defined(__i386__) ) |
| 105 | +#elif (LL_GNUC || LL_CLANG) && ( defined(__i386__) ) |
103 | 106 | # define LL_X86 1 |
104 | 107 | #endif |
105 | 108 |
|
|
116 | 119 |
|
117 | 120 | #endif |
118 | 121 |
|
119 | | -// Although thread_local is now a standard storage class, we can't just |
120 | | -// #define LL_THREAD_LOCAL as thread_local because the *usage* is different. |
121 | | -// We'll have to take the time to change LL_THREAD_LOCAL declarations by hand. |
122 | | -#if LL_WINDOWS |
123 | | -# define LL_THREAD_LOCAL __declspec(thread) |
124 | | -#else |
125 | | -# define LL_THREAD_LOCAL __thread |
126 | | -#endif |
127 | | - |
128 | | - |
129 | 122 | #if defined(LL_WINDOWS) |
130 | 123 | #define BOOST_REGEX_NO_LIB 1 |
131 | 124 | #define CURL_STATICLIB 1 |
|
150 | 143 | #define LL_DLLIMPORT |
151 | 144 | #endif // LL_WINDOWS |
152 | 145 |
|
153 | | -#if __clang__ || ! defined(LL_WINDOWS) |
| 146 | +#if LL_CLANG || ! defined(LL_WINDOWS) |
154 | 147 | // Only on Windows, and only with the Microsoft compiler (vs. clang) is |
155 | 148 | // wchar_t potentially not a distinct type. |
156 | 149 | #define LL_WCHAR_T_NATIVE 1 |
|
211 | 204 | #define LL_PRETTY_FUNCTION __PRETTY_FUNCTION__ |
212 | 205 | #endif |
213 | 206 |
|
| 207 | +// vptr warning supression funtionality for undefined behavior sanitizer |
| 208 | +#if LL_CLANG || LL_GNUC |
| 209 | +# define LL_UBSAN_SUPRESS_VPTR __attribute__((no_sanitize("vptr"))) |
| 210 | +#else |
| 211 | +# define LL_UBSAN_SUPRESS_VPTR |
| 212 | +#endif |
| 213 | + |
214 | 214 | #if LL_ARM64 |
215 | 215 | #define GLM_FORCE_NEON 1 |
216 | 216 | #else |
|
0 commit comments