This is an automated email from the ASF dual-hosted git repository.
emmenlau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new cbb6530 [THRIFT-5510] On Windows NOMINMAX and WIN32_LEAN_AND_MEAN are
unset even if set before
new 6b5b6c4 Merge pull request #2515 from dsandbrink/patch-1
cbb6530 is described below
commit cbb6530228895bab3b0556df59574c46d9ea49d9
Author: Dirk Sandbrink <[email protected]>
AuthorDate: Fri Feb 4 09:55:19 2022 +0100
[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.
---
lib/cpp/src/thrift/windows/Sync.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/cpp/src/thrift/windows/Sync.h
b/lib/cpp/src/thrift/windows/Sync.h
index f5b8a05..a5b2ac5 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