diff options
author | Dirk Sandbrink <dsandbrink@users.noreply.github.com> | 2022-02-04 09:55:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 09:55:19 +0100 |
commit | cbb6530228895bab3b0556df59574c46d9ea49d9 (patch) | |
tree | fd73874d5c56c8144e197785af0211df703fccb7 /lib | |
parent | 6f33b047067966d73397b95e6a54fc39901169eb (diff) | |
download | thrift-cbb6530228895bab3b0556df59574c46d9ea49d9.tar.gz |
[THRIFT-5510] On Windows NOMINMAX and WIN32_LEAN_AND_MEAN are unset even if set before
Only define and undefine NOMINMAX and WIN32_LEAN_AND_MEAN if they have not been set before.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpp/src/thrift/windows/Sync.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h index f5b8a052d..a5b2ac50f 100644 --- a/lib/cpp/src/thrift/windows/Sync.h +++ b/lib/cpp/src/thrift/windows/Sync.h @@ -29,11 +29,23 @@ // Including Windows.h can conflict with Winsock2 usage, and also // adds problematic macros like min() and max(). Try to work around: +#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 /* Lightweight synchronization objects that only make sense on Windows. For cross-platform |