[ https://issues.apache.org/jira/browse/THRIFT-5510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer updated THRIFT-5510: ------------------------------- Component/s: C++ - Library > 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 > Components: C++ - Library > Affects Versions: 0.16.0 > Reporter: Dirk Sandbrink > Assignee: Mario Emmenlauer > Priority: Minor > Fix For: 0.17.0 > > Time Spent: 0.5h > Remaining Estimate: 0h > > 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.10#820010)