From 24a10589522f07e3ff152777a986ad0fb72f2935 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 18 Sep 2019 13:58:04 -0700 Subject: Work around MSVC's lack of standard _Pragma support --- CMakeLists.txt | 2 +- common/almalloc.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 515cbddc..4b00194e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,7 @@ IF(MSVC) IF(HAVE_PERMISSIVE_SWITCH) SET(C_FLAGS ${C_FLAGS} $<$:/permissive->) ENDIF() - SET(C_FLAGS ${C_FLAGS} /W4 /w14640 /wd4065 /wd4200 /wd4268 /wd4324) + SET(C_FLAGS ${C_FLAGS} /W4 /w14640 /wd4065 /wd4268 /wd4324) IF(NOT DXSDK_DIR) STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}") diff --git a/common/almalloc.h b/common/almalloc.h index fd8d4be7..e021337b 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -12,19 +12,19 @@ #ifdef _MSC_VER -#define DIAGNOSTIC_PUSH _Pragma("warning(push)") +#define DIAGNOSTIC_PUSH __pragma(warning(push)) #define GNUDIAGNOSTIC(x) -#define MVSDIAGNOSTIC(x) _Pragma(x) -#define DIAGNOSTIC_POP _Pragma("warning(pop)") +#define MVSDIAGNOSTIC(...) __pragma(__VA_ARGS__) +#define DIAGNOSTIC_POP __pragma(warning(pop)) #elif defined(__GNUC__) || defined(__clang__) #define DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define GNUDIAGNOSTIC(x) _Pragma(x) -#define MVSDIAGNOSTIC(x) +#define MVSDIAGNOSTIC(...) #define DIAGNOSTIC_POP _Pragma("GCC diagnostic push") #else #define DIAGNOSTIC_PUSH #define GNUDIAGNOSTIC(x) -#define MVSDIAGNOSTIC(x) +#define MVSDIAGNOSTIC(...) #define DIAGNOSTIC_POP #endif @@ -113,7 +113,7 @@ inline T* assume_aligned(T *ptr) noexcept * destructor is trivial (a no-op). So disable that warning for this call. */ DIAGNOSTIC_PUSH -MVSDIAGNOSTIC("warning(disable : 4100)") +MVSDIAGNOSTIC(warning(disable : 4100)) template inline void destroy_at(T *ptr) { ptr->~T(); } DIAGNOSTIC_POP @@ -258,7 +258,7 @@ struct FlexArray { const index_type mSize; DIAGNOSTIC_PUSH GNUDIAGNOSTIC("GCC diagnostic ignored \"-Wpedantic\"") -MVSDIAGNOSTIC("warning(disable : 4200)") +MVSDIAGNOSTIC(warning(disable : 4200)) alignas(alignment) element_type mArray[0]; DIAGNOSTIC_POP -- cgit v1.2.3