From eb090b3b015e9f3cbde47331c785d5a181b0be91 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 6 Jul 2017 14:25:16 -0400 Subject: [PATCH 1/4] Modification to format.h to suppress C4574 on MSVC In Visual Studio 2017, C4574: 'identifier' is defined to be '0': did you mean to use '#if identifier'? --- fmt/format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 1b727965..27be274d 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -119,7 +119,8 @@ typedef __int64 intmax_t; # define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__) #endif -#ifdef __has_feature +// GLM defines __has_feature to '0' which causes MSVC to throw C4574 +#if defined(__has_feature) && __has_feature # define FMT_HAS_FEATURE(x) __has_feature(x) #else # define FMT_HAS_FEATURE(x) 0 From 7d3cec5106e04423586d33d037535fa08ebabed4 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 6 Jul 2017 17:35:31 -0400 Subject: [PATCH 2/4] Compile fix for Mac --- fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 27be274d..3d7400b1 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -120,7 +120,7 @@ typedef __int64 intmax_t; #endif // GLM defines __has_feature to '0' which causes MSVC to throw C4574 -#if defined(__has_feature) && __has_feature +#if (defined(__has_feature) && (__has_feature)) # define FMT_HAS_FEATURE(x) __has_feature(x) #else # define FMT_HAS_FEATURE(x) 0 From 7eff0809a4dd292517e6f2762666104c6cc68171 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 6 Jul 2017 17:36:56 -0400 Subject: [PATCH 3/4] Remove warning C4668 in MSVC for FMT_GCC_VERSION and FMT_HAS_GXX_CXX11 --- fmt/format.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fmt/format.h b/fmt/format.h index 3d7400b1..345e3674 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -99,7 +99,9 @@ typedef __int64 intmax_t; # define FMT_HAS_GXX_CXX11 1 # endif #else +# define FMT_GCC_VERSION 0 # define FMT_GCC_EXTENSION +# define FMT_HAS_GXX_CXX11 0 #endif #if defined(__INTEL_COMPILER) From fa24093789d481c9df7b27985562fc95e9b407b9 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 7 Jul 2017 10:02:09 -0400 Subject: [PATCH 4/4] Use a different solution to suppress C4574 while still compiling on Mac --- fmt/format.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 345e3674..b1b74ecc 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -121,13 +121,27 @@ typedef __int64 intmax_t; # define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__) #endif -// GLM defines __has_feature to '0' which causes MSVC to throw C4574 -#if (defined(__has_feature) && (__has_feature)) +// GLM defines __has_feature to '0' which causes MSVC to throw C4574 +// An #if check against __has_feature makes Clang unhappy, so the only way +// around this is to disable the warning for Microsoft Visual Studio +// Even though this is all macros, this will still work since it is the +// #ifdef __has_feature that throws the error, not the macro expansion +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4574) +#endif // _MSC_VER + +#ifdef __has_feature # define FMT_HAS_FEATURE(x) __has_feature(x) #else # define FMT_HAS_FEATURE(x) 0 #endif +// And reenabling it afterwards +#ifdef _MSC_VER +#pragma warning (pop) +#endif // _MSC_VER + #ifdef __has_builtin # define FMT_HAS_BUILTIN(x) __has_builtin(x) #else