From d37bbc53f4fb6c9d207af0bc5f194b31bb8a3183 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 12 Nov 2020 08:48:27 -0500 Subject: [PATCH] Disable a Windows platform warning. (#311) Signed-off-by: Chris Lalancette --- include/rcutils/stdatomic_helper/win32/stdatomic.h | 12 ++++++++++++ src/filesystem.c | 11 +++++++++++ src/logging.c | 11 +++++++++++ src/process.c | 11 +++++++++++ src/shared_library.c | 11 +++++++++++ src/time_win32.c | 11 +++++++++++ 6 files changed, 67 insertions(+) diff --git a/include/rcutils/stdatomic_helper/win32/stdatomic.h b/include/rcutils/stdatomic_helper/win32/stdatomic.h index 596c2a7c..7000fb21 100644 --- a/include/rcutils/stdatomic_helper/win32/stdatomic.h +++ b/include/rcutils/stdatomic_helper/win32/stdatomic.h @@ -63,7 +63,19 @@ #ifndef RCUTILS__STDATOMIC_HELPER__WIN32__STDATOMIC_H_ #define RCUTILS__STDATOMIC_HELPER__WIN32__STDATOMIC_H_ +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h + +#pragma warning(push) +#pragma warning(disable : 5105) #include +#pragma warning(pop) #include #include diff --git a/src/filesystem.c b/src/filesystem.c index 8a709571..772c6029 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -27,7 +27,18 @@ extern "C" #include #include #else +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h +#pragma warning(push) +#pragma warning(disable : 5105) #include +#pragma warning(pop) #include #endif // _WIN32 diff --git a/src/logging.c b/src/logging.c index 59df0af7..2472850b 100644 --- a/src/logging.c +++ b/src/logging.c @@ -26,7 +26,18 @@ extern "C" #ifdef _WIN32 # include +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h +# pragma warning(push) +# pragma warning(disable : 5105) # include +# pragma warning(pop) #else # include #endif diff --git a/src/process.c b/src/process.c index 89bd4bc2..78eb97dc 100644 --- a/src/process.c +++ b/src/process.c @@ -22,7 +22,18 @@ extern "C" #include #if defined _WIN32 || defined __CYGWIN__ +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h +#pragma warning(push) +#pragma warning(disable : 5105) #include +#pragma warning(pop) #else #include #include diff --git a/src/shared_library.c b/src/shared_library.c index 59d4ed29..f8ee5cb2 100644 --- a/src/shared_library.c +++ b/src/shared_library.c @@ -22,7 +22,18 @@ extern "C" #ifndef _WIN32 #include #else +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h +#pragma warning(push) +#pragma warning(disable : 5105) #include +#pragma warning(pop) C_ASSERT(sizeof(void *) == sizeof(HINSTANCE)); #endif // _WIN32 diff --git a/src/time_win32.c b/src/time_win32.c index 1ab0ac7b..0a3dc341 100644 --- a/src/time_win32.c +++ b/src/time_win32.c @@ -23,7 +23,18 @@ extern "C" #include "rcutils/time.h" +// When building with MSVC 19.28.29333.0 on Windows 10 (as of 2020-11-11), +// there appears to be a problem with winbase.h (which is included by +// Windows.h). In particular, warnings of the form: +// +// warning C5105: macro expansion producing 'defined' has undefined behavior +// +// See https://developercommunity.visualstudio.com/content/problem/695656/wdk-and-sdk-are-not-compatible-with-experimentalpr.html +// for more information. For now disable that warning when including windows.h +#pragma warning(push) +#pragma warning(disable : 5105) #include +#pragma warning(pop) #include "./common.h" #include "rcutils/allocator.h"