Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5510

On Windows NOMINMAX and WIN32_LEAN_AND_MEAN are unset even if set before

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.16.0
    • 0.17.0
    • C++ - Library
    • 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

          Activity

            People

              emmenlau Mario Emmenlauer
              dsandbrink Dirk Sandbrink
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h