Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.16.0
-
None
Description
In lib/cpp/src/thrift/windows/Sync.h the two macros NOMINMAX and WIN32_MEAN_LEAN are set and then unset:
#define NOMINMAX #define WIN32_LEAN_AND_MEAN #include <Windows.h> #undef NOMINMAX #undef WIN32_LEAN_AND_MEAN
However in our code we already set NOMINMAX and WIN32_LEAN_AND_MEAN globally, creating two problems:
- The macros are undefined after Thrift has been included, leading to possible unwanted behavior depending on the order of includes
- Visual Studio gives Warning C4005 because the macros are defined twice
Possible solution:
#ifndef NOMINMAX #define NOMINMAX #define _THRIFT_UNDEF_NOMINMAX #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #define _THRIFT_UNDEF_WIN32_LEAN_AND_MEAN #endif #include <Windows.h> #ifdef _THRIFT_UNDEF_NOMINMAX #undef NOMINMAX #undef _THRIFT_UNDEF_NOMINMAX #endif #ifdef _THRIFT_UNDEF_WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN #undef _THRIFT_UNDEF_WIN32_LEAN_AND_MEAN #endif
Attachments
Issue Links
- links to