Skip to content

Commit a663ed7

Browse files
Disable warning C5105 for older Windows SDKs in base64.c (ros2#544)
Signed-off-by: Barry Xu <barry.xu@sony.com>
1 parent f108564 commit a663ed7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎src/base64.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,24 @@ extern "C"
1818
#endif
1919

2020
#ifdef _WIN32
21+
/*
22+
* It was determined the warning C5105 ("macro expansion producing 'defined' has undefined
23+
* behavior") occurs when using /std:c11 or /std:c17 with older Windows SDKs (10.0.19041.0)
24+
* because the C99 preprocessor is activated.
25+
* See:
26+
* https://developercommunity.visualstudio.com/t/stdc17-generates-warning-compiling-windowsh/1249671
27+
* The current solution is to temporarily disable the C5105 warning. If the used version of Windows
28+
* SDK is higher than 10.0.20348.0 which fixs this issue, the workaround can be removed.
29+
*/
30+
#if defined(_MSC_VER)
31+
#pragma warning(push)
32+
#pragma warning(disable: 5105)
33+
#endif
2134
#include <windows.h>
35+
#if defined(_MSC_VER)
36+
#pragma warning(pop)
37+
#endif
38+
2239
#else
2340
#include <pthread.h>
2441
#endif

0 commit comments

Comments
 (0)