diff options
author | Chris Robinson <[email protected]> | 2019-09-18 13:58:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-18 13:58:04 -0700 |
commit | 24a10589522f07e3ff152777a986ad0fb72f2935 (patch) | |
tree | 9cd54a5a19013c94b0b7910e59af4ca2d3bce5ad | |
parent | b8f64155e9b5e2a048f4f055af235a210bcdedc7 (diff) |
Work around MSVC's lack of standard _Pragma support
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | 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} $<$<COMPILE_LANGUAGE:CXX>:/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<typename T> 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 |