Dirk Sandbrink created THRIFT-5510: -------------------------------------- Summary: On Windows NOMINMAX and WIN32_LEAN_AND_MEAN are unset even if set before Key: THRIFT-5510 URL: https://issues.apache.org/jira/browse/THRIFT-5510 Project: Thrift Issue Type: Bug Affects Versions: 0.16.0 Reporter: Dirk Sandbrink
In lib/cpp/src/thrift/windows/Sync.h the two macros NOMINMAX and WIN32_MEAN_LEAN are set and then unset: {code:java} #define NOMINMAX #define WIN32_LEAN_AND_MEAN #include <Windows.h> #undef NOMINMAX #undef WIN32_LEAN_AND_MEAN {code} 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: {code:java} #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 {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)