|
219 | 219 |
|
220 | 220 | #ifndef __VMAWARE_DEBUG__ |
221 | 221 | #if defined(_DEBUG) /* MSVC Debug */ \ |
222 | | - || defined(DEBUG) /* user or build-system */ |
223 | | - #define __VMAWARE_DEBUG__ |
224 | | - #if defined(_DEBUG) /* MSVC Debug */ \ |
225 | 222 | || defined(DEBUG) /* user or build-system */ |
226 | 223 | #define __VMAWARE_DEBUG__ |
227 | 224 | #endif |
228 | 225 | #endif |
229 | | -#endif |
230 | 226 |
|
231 | | -#if defined(_WIN32) || defined(_WIN64) |
232 | 227 | #if defined(_WIN32) || defined(_WIN64) |
233 | 228 | #ifndef WIN32_LEAN_AND_MEAN |
234 | 229 | #define WIN32_LEAN_AND_MEAN |
235 | | - #define WIN32_LEAN_AND_MEAN |
236 | 230 | #endif |
237 | 231 |
|
238 | | - |
239 | 232 | #define WINDOWS 1 |
240 | 233 | #define LINUX 0 |
241 | 234 | #define APPLE 0 |
242 | | -#elif (defined(__linux__)) |
243 | 235 | #elif (defined(__linux__)) |
244 | 236 | #define WINDOWS 0 |
245 | 237 | #define LINUX 1 |
246 | 238 | #define APPLE 0 |
247 | | -#elif (defined(__APPLE__) || defined(__APPLE_CPP__) || defined(__MACH__) || defined(__DARWIN)) |
248 | 239 | #elif (defined(__APPLE__) || defined(__APPLE_CPP__) || defined(__MACH__) || defined(__DARWIN)) |
249 | 240 | #define WINDOWS 0 |
250 | 241 | #define LINUX 0 |
|
257 | 248 |
|
258 | 249 | #ifdef _MSC_VER |
259 | 250 | #define MSVC 1 |
260 | | - #define MSVC 1 |
261 | 251 | #endif |
262 | 252 |
|
263 | 253 | #if defined(_MSVC_LANG) |
264 | 254 | #define VMA_CPLUSPLUS _MSVC_LANG |
265 | | -#else |
266 | 255 | #else |
267 | 256 | #define VMA_CPLUSPLUS __cplusplus |
268 | 257 | #endif |
269 | | -#endif |
270 | 258 |
|
271 | 259 | #if VMA_CPLUSPLUS >= 202302L |
272 | 260 | #define VMA_CPP 23 |
273 | 261 | #elif VMA_CPLUSPLUS >= 202002L |
274 | 262 | #define VMA_CPP 20 |
275 | | - #define VMA_CPP 20 |
276 | 263 | #elif VMA_CPLUSPLUS >= 201703L |
277 | 264 | #define VMA_CPP 17 |
278 | | - #define VMA_CPP 17 |
279 | 265 | #elif VMA_CPLUSPLUS >= 201402L |
280 | 266 | #define VMA_CPP 14 |
281 | | - #define VMA_CPP 14 |
282 | 267 | #elif VMA_CPLUSPLUS >= 201103L |
283 | 268 | #define VMA_CPP 11 |
284 | | - #define VMA_CPP 11 |
285 | 269 | #elif VMA_CPLUSPLUS >= 199711L |
286 | 270 | #define VMA_CPP 98 /* C++98 or C++03 */ |
287 | | - #define VMA_CPP 98 /* C++98 or C++03 */ |
288 | 271 | #else |
289 | 272 | #error "Unsupported C++ standard (pre-C++98 or unknown)." |
290 | 273 | #endif |
291 | | -#endif |
292 | 274 |
|
293 | 275 | #if (VMA_CPP < 11 && !WINDOWS) |
294 | 276 | #error "VMAware only supports C++11 or above, set your compiler flag to '-std=c++20' for gcc/clang, or '/std:c++20' for MSVC" |
295 | 277 | #endif |
296 | 278 |
|
297 | | -#if defined(__x86_64__) || defined(_M_X64) |
298 | | -#endif |
299 | | - |
300 | 279 | #if defined(__x86_64__) || defined(_M_X64) |
301 | 280 | #define x86_64 1 |
302 | | -#else |
303 | 281 | #else |
304 | 282 | #define x86_64 0 |
305 | 283 | #endif |
306 | 284 |
|
307 | 285 | #if defined(__i386__) || defined(_M_IX86) |
308 | 286 | #define x86_32 1 |
309 | | -#else |
310 | 287 | #else |
311 | 288 | #define x86_32 0 |
312 | 289 | #endif |
313 | 290 |
|
314 | 291 | #if x86_32 || x86_64 |
315 | 292 | #define x86 1 |
316 | | - #define x86 1 |
317 | 293 | #else |
318 | 294 | #define x86 0 |
319 | 295 | #endif |
320 | | -#endif |
321 | 296 |
|
322 | 297 | #if defined(__aarch64__) || defined(_M_ARM64) || defined(__ARM_LINUX_COMPILER__) |
323 | 298 | #define ARM64 1 |
324 | | - #define ARM64 1 |
325 | 299 | #else |
326 | 300 | #define ARM64 0 |
327 | 301 | #endif |
328 | | -#endif |
329 | 302 |
|
330 | 303 | #if (defined(__arm__) || defined(_M_ARM)) && !ARM64 |
331 | 304 | #define ARM32 1 |
332 | | -#else |
333 | 305 | #else |
334 | 306 | #define ARM32 0 |
335 | 307 | #endif |
336 | | -#endif |
337 | 308 |
|
338 | | -#if ARM32 || ARM64 |
339 | 309 | #if ARM32 || ARM64 |
340 | 310 | #define ARM 1 |
341 | 311 | #else |
342 | 312 | #define ARM 0 |
343 | | - #define ARM 0 |
344 | | -#endif |
345 | | - |
346 | | -#if (!APPLE && (VMA_CPP >= 20) && (!CLANG || __clang_major__ >= 16)) |
347 | | - #define SOURCE_LOCATION_SUPPORTED 1 |
348 | | -#else |
349 | | - #define SOURCE_LOCATION_SUPPORTED 0 |
350 | 313 | #endif |
351 | 314 |
|
352 | 315 | #if (!APPLE && (VMA_CPP >= 20) && (!CLANG || __clang_major__ >= 16)) |
|
358 | 321 | #if defined(__clang__) |
359 | 322 | #define GCC 0 |
360 | 323 | #define CLANG 1 |
361 | | - #define GCC 0 |
362 | | - #define CLANG 1 |
363 | 324 | #elif defined(__GNUC__) |
364 | 325 | #define GCC 1 |
365 | 326 | #define CLANG 0 |
366 | | - #define GCC 1 |
367 | | - #define CLANG 0 |
368 | 327 | #else |
369 | 328 | #define GCC 0 |
370 | 329 | #define CLANG 0 |
371 | | - #define GCC 0 |
372 | | - #define CLANG 0 |
373 | 330 | #endif |
374 | 331 |
|
375 | 332 | #if !(defined(WINDOWS) || defined(LINUX) || defined(APPLE)) |
376 | 333 | #warning "Unknown OS detected, tests will be severely limited" |
377 | | - #warning "Unknown OS detected, tests will be severely limited" |
378 | 334 | #endif |
379 | 335 |
|
380 | 336 | #if (VMA_CPP >= 23) |
381 | 337 | #include <limits> |
382 | | - #include <limits> |
383 | 338 | #endif |
384 | 339 | #if (VMA_CPP >= 20) |
385 | 340 | #include <bit> |
|
390 | 345 | #endif |
391 | 346 | #if (VMA_CPP >= 17) |
392 | 347 | #include <filesystem> |
393 | | - #include <system_error> |
394 | | -#endif |
| 348 | + #include <system_error> |
| 349 | + #endif |
395 | 350 | #ifdef __VMAWARE_DEBUG__ |
396 | | - #include <iomanip> |
397 | 351 | #include <iomanip> |
398 | 352 | #include <ios> |
399 | 353 | #include <locale> |
|
431 | 385 | #include <devpkey.h> |
432 | 386 | #include <devguid.h> |
433 | 387 | #include <winevt.h> |
434 | | - #include <windows.h> |
435 | | - #include <intrin.h> |
436 | | - #include <winioctl.h> |
437 | | - #include <winternl.h> |
438 | | - #include <powerbase.h> |
439 | | - #include <setupapi.h> |
440 | | - #include <initguid.h> |
441 | | - #include <devpkey.h> |
442 | | - #include <devguid.h> |
443 | | - #include <winevt.h> |
444 | 388 |
|
445 | | - #pragma comment(lib, "setupapi.lib") |
446 | | - #pragma comment(lib, "powrprof.lib") |
447 | | - #pragma comment(lib, "mincore.lib") |
448 | 389 | #pragma comment(lib, "setupapi.lib") |
449 | 390 | #pragma comment(lib, "powrprof.lib") |
450 | 391 | #pragma comment(lib, "mincore.lib") |
@@ -11171,7 +11112,6 @@ struct VM { |
11171 | 11112 | */ |
11172 | 11113 | static bool check( |
11173 | 11114 | const enum_flags flag_bit |
11174 | | - #if (SOURCE_LOCATION_SUPPORTED) |
11175 | 11115 | #if (SOURCE_LOCATION_SUPPORTED) |
11176 | 11116 | , [[maybe_unused]] const std::source_location& loc = std::source_location::current() |
11177 | 11117 | #endif |
@@ -11571,7 +11511,6 @@ struct VM { |
11571 | 11511 | const u8 percent, |
11572 | 11512 | bool(*detection_func)() |
11573 | 11513 | #if (SOURCE_LOCATION_SUPPORTED) |
11574 | | - #if (SOURCE_LOCATION_SUPPORTED) |
11575 | 11514 | , const std::source_location& loc = std::source_location::current() |
11576 | 11515 | #endif |
11577 | 11516 | ) { |
@@ -11769,7 +11708,6 @@ struct VM { |
11769 | 11708 | static void modify_score( |
11770 | 11709 | const enum_flags flag, |
11771 | 11710 | const u8 percent |
11772 | | - #if (SOURCE_LOCATION_SUPPORTED) |
11773 | 11711 | #if (SOURCE_LOCATION_SUPPORTED) |
11774 | 11712 | , const std::source_location& loc = std::source_location::current() |
11775 | 11713 | #endif |
|
0 commit comments