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