Skip to content

Commit

Permalink
Disable a Windows platform warning. (#311)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Nov 12, 2020
1 parent f1327df commit d37bbc5
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/rcutils/stdatomic_helper/win32/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Windows.h>
#pragma warning(pop)

#include <stddef.h>
#include <stdint.h>
Expand Down
11 changes: 11 additions & 0 deletions src/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ extern "C"
#include <dirent.h>
#include <unistd.h>
#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 <windows.h>
#pragma warning(pop)
#include <direct.h>
#endif // _WIN32

Expand Down
11 changes: 11 additions & 0 deletions src/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ extern "C"

#ifdef _WIN32
# include <io.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 <windows.h>
# pragma warning(pop)
#else
# include <unistd.h>
#endif
Expand Down
11 changes: 11 additions & 0 deletions src/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ extern "C"
#include <string.h>

#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 <Windows.h>
#pragma warning(pop)
#else
#include <libgen.h>
#include <unistd.h>
Expand Down
11 changes: 11 additions & 0 deletions src/shared_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ extern "C"
#ifndef _WIN32
#include <dlfcn.h>
#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 <windows.h>
#pragma warning(pop)
C_ASSERT(sizeof(void *) == sizeof(HINSTANCE));
#endif // _WIN32

Expand Down
11 changes: 11 additions & 0 deletions src/time_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <windows.h>
#pragma warning(pop)

#include "./common.h"
#include "rcutils/allocator.h"
Expand Down

0 comments on commit d37bbc5

Please sign in to comment.