You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/02/17 01:50:59 UTC

[7/7] mesos git commit: Windows: Changed ZK patch to fix macro redefinition warnings.

Windows: Changed ZK patch to fix macro redefinition warnings.

Currently, compiling against ZK on Windows will cause many macro
redefinition errors. This occurs because ZK has a `winstdint.h` file,
which contains definitions for macros that historically have not existed
in the MSVC toolchain.

However, since MSVC 1900, many of these now exist. Here, we introduce a
patch file that will condition out these definitions for versions 1900
and later.

Additionally, the previous patch file was not fully correct, resulting
in the patch being "fuzzed" when it was applied. This patch generates
the correct output, allowing the patches to apply cleanly.

Review: https://reviews.apache.org/r/56652/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/85d9d4ef
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/85d9d4ef
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/85d9d4ef

Branch: refs/heads/master
Commit: 85d9d4ef259e795a438eae12bd740063809e8bfc
Parents: b7e00bd
Author: Alex Clemmer <cl...@gmail.com>
Authored: Thu Feb 16 16:10:45 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Feb 16 17:50:10 2017 -0800

----------------------------------------------------------------------
 3rdparty/zookeeper-06d3f3f.patch | 274 +++++++++++++++++-----------------
 1 file changed, 141 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/85d9d4ef/3rdparty/zookeeper-06d3f3f.patch
----------------------------------------------------------------------
diff --git a/3rdparty/zookeeper-06d3f3f.patch b/3rdparty/zookeeper-06d3f3f.patch
index be2ceaf..7f66875 100644
--- a/3rdparty/zookeeper-06d3f3f.patch
+++ b/3rdparty/zookeeper-06d3f3f.patch
@@ -1,5 +1,145 @@
+diff --git a/src/c/include/winconfig.h b/src/c/include/winconfig.h
+index ccc3c189..a4b3287a 100644
+--- a/src/c/include/winconfig.h
++++ b/src/c/include/winconfig.h
+@@ -1,3 +1,5 @@
++#pragma once
++
+ /* Define to 1 if you have the <arpa/inet.h> header file. */
+ #undef HAVE_ARPA_INET_H
+
+@@ -152,13 +154,6 @@
+ #define __attribute__(x)
+ #define __func__ __FUNCTION__
+
+-#ifndef _WIN32_WINNT_NT4
+-#define _WIN32_WINNT_NT4 0x0400
+-#endif
+-
+-#define NTDDI_VERSION _WIN32_WINNT_NT4
+-#define _WIN32_WINNT _WIN32_WINNT_NT4
+-
+ #define _CRT_SECURE_NO_WARNINGS
+ #define WIN32_LEAN_AND_MEAN
+ #include <Windows.h>
+@@ -171,12 +166,17 @@
+ #undef max
+
+ #include <errno.h>
++#include <stdlib.h>
+
+ #define strtok_r strtok_s
+ #define localtime_r(a,b) localtime_s(b,a)
+ #define get_errno() errno=GetLastError()
+-#define random rand
++
++inline int __cdecl random() { return rand(); }
++
++#if ((defined(_MSC_VER) && _MSC_VER < 1900) || !defined(_MSC_VER))
+ #define snprintf _snprintf
++#endif
+
+ #define ACL ZKACL  // Conflict with windows API
+
+@@ -192,5 +192,5 @@
+ #define EINPROGRESS WSAEINPROGRESS
+ #endif
+
+-typedef int pid_t;
++typedef DWORD pid_t;
+ #endif
+diff --git a/src/c/include/winstdint.h b/src/c/include/winstdint.h
+index d02608a5..196ecc5d 100644
+--- a/src/c/include/winstdint.h
++++ b/src/c/include/winstdint.h
+@@ -41,6 +41,7 @@
+ #endif
+
+ #include <limits.h>
++#include <stdint.h>
+
+ // For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+ // compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+@@ -100,16 +101,6 @@ typedef uint16_t  uint_least16_t;
+ typedef uint32_t  uint_least32_t;
+ typedef uint64_t  uint_least64_t;
+
+-// 7.18.1.3 Fastest minimum-width integer types
+-typedef int8_t    int_fast8_t;
+-typedef int16_t   int_fast16_t;
+-typedef int32_t   int_fast32_t;
+-typedef int64_t   int_fast64_t;
+-typedef uint8_t   uint_fast8_t;
+-typedef uint16_t  uint_fast16_t;
+-typedef uint32_t  uint_fast32_t;
+-typedef uint64_t  uint_fast64_t;
+-
+ // 7.18.1.4 Integer types capable of holding object pointers
+ #ifdef _WIN64 // [
+    typedef signed __int64    intptr_t;
+@@ -126,7 +117,7 @@ typedef uint64_t  uintmax_t;
+
+ // 7.18.2 Limits of specified-width integer types
+
+-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
++#if (_MSC_VER < 1900) && (!defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)) // [   See footnote 220 at page 257 and footnote 221 at page 259
+
+ // 7.18.2.1 Limits of exact-width integer types
+ #define INT8_MIN     ((int8_t)_I8_MIN)
+@@ -223,7 +214,7 @@ typedef uint64_t  uintmax_t;
+
+ // 7.18.4 Limits of other integer types
+
+-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
++#if (_MSC_VER < 1900) && (!defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)) // [   See footnote 224 at page 260
+
+ // 7.18.4.1 Macros for minimum-width integer constants
+
+diff --git a/src/c/zookeeper-vs2015.sln b/src/c/zookeeper-vs2015.sln
+new file mode 100644
+index 00000000..44d738f8
+--- /dev/null
++++ b/src/c/zookeeper-vs2015.sln
+@@ -0,0 +1,37 @@
++Microsoft Visual Studio Solution File, Format Version 12.00
++# Visual Studio 14
++VisualStudioVersion = 14.0.23107.0
++MinimumVisualStudioVersion = 10.0.40219.1
++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zookeeper", "zookeeper.vcxproj", "{5754FB2B-5EA5-4988-851D-908CA533A626}"
++EndProject
++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cli", "cli.vcxproj", "{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}"
++EndProject
++Global
++	GlobalSection(SolutionConfigurationPlatforms) = preSolution
++		Debug|Win32 = Debug|Win32
++		Debug|x64 = Debug|x64
++		Release|Win32 = Release|Win32
++		Release|x64 = Release|x64
++	EndGlobalSection
++	GlobalSection(ProjectConfigurationPlatforms) = postSolution
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.ActiveCfg = Debug|Win32
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.Build.0 = Debug|Win32
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|x64.ActiveCfg = Debug|x64
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|x64.Build.0 = Debug|x64
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.ActiveCfg = Release|Win32
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.Build.0 = Release|Win32
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|x64.ActiveCfg = Release|x64
++		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|x64.Build.0 = Release|x64
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|Win32.ActiveCfg = Debug|Win32
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|Win32.Build.0 = Debug|Win32
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|x64.ActiveCfg = Debug|x64
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|x64.Build.0 = Debug|x64
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|Win32.ActiveCfg = Release|Win32
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|Win32.Build.0 = Release|Win32
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|x64.ActiveCfg = Release|x64
++		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|x64.Build.0 = Release|x64
++	EndGlobalSection
++	GlobalSection(SolutionProperties) = preSolution
++		HideSolutionNode = FALSE
++	EndGlobalSection
++EndGlobal
 diff --git a/src/c/zookeeper.vcxproj b/src/c/zookeeper.vcxproj
-index be4ad9a..59f9172 100644
+index be4ad9ab..5e75f779 100644
 --- a/src/c/zookeeper.vcxproj
 +++ b/src/c/zookeeper.vcxproj
 @@ -1,5 +1,5 @@
@@ -74,135 +214,3 @@ index be4ad9a..59f9172 100644
        <PrecompiledHeader />
        <WarningLevel>Level3</WarningLevel>
        <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-@@ -144,7 +145,7 @@
-     <ClCompile>
-       <AdditionalIncludeDirectories>./include;./generated;./hashtable;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ZOOKEEPER_EXPORTS;DLL_EXPORT;THREADED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
--      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-       <PrecompiledHeader>
-       </PrecompiledHeader>
-       <WarningLevel>Level3</WarningLevel>
-diff --git a/src/c/zookeeper-vs2015.sln b/src/c/zookeeper-vs2015.sln
-new file mode 100644
-index 0000000..44d738f
---- /dev/null
-+++ b/src/c/zookeeper-vs2015.sln
-@@ -0,0 +1,37 @@
-+Microsoft Visual Studio Solution File, Format Version 12.00
-+# Visual Studio 14
-+VisualStudioVersion = 14.0.23107.0
-+MinimumVisualStudioVersion = 10.0.40219.1
-+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zookeeper", "zookeeper.vcxproj", "{5754FB2B-5EA5-4988-851D-908CA533A626}"
-+EndProject
-+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cli", "cli.vcxproj", "{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}"
-+EndProject
-+Global
-+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-+		Debug|Win32 = Debug|Win32
-+		Debug|x64 = Debug|x64
-+		Release|Win32 = Release|Win32
-+		Release|x64 = Release|x64
-+	EndGlobalSection
-+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.ActiveCfg = Debug|Win32
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.Build.0 = Debug|Win32
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|x64.ActiveCfg = Debug|x64
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|x64.Build.0 = Debug|x64
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.ActiveCfg = Release|Win32
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.Build.0 = Release|Win32
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|x64.ActiveCfg = Release|x64
-+		{5754FB2B-5EA5-4988-851D-908CA533A626}.Release|x64.Build.0 = Release|x64
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|Win32.ActiveCfg = Debug|Win32
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|Win32.Build.0 = Debug|Win32
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|x64.ActiveCfg = Debug|x64
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Debug|x64.Build.0 = Debug|x64
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|Win32.ActiveCfg = Release|Win32
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|Win32.Build.0 = Release|Win32
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|x64.ActiveCfg = Release|x64
-+		{F267C55D-E02C-4BAF-A246-0AA58E8FE4A6}.Release|x64.Build.0 = Release|x64
-+	EndGlobalSection
-+	GlobalSection(SolutionProperties) = preSolution
-+		HideSolutionNode = FALSE
-+	EndGlobalSection
-+EndGlobal
-diff --git a/src/c/include/winconfig.h b/src/c/include/winconfig.h
-old mode 100644
-new mode 100755
-index ccc3c18..b1f4bfe
---- a/src/c/include/winconfig.h
-+++ b/src/c/include/winconfig.h
-@@ -1,3 +1,5 @@
-+#pragma once
-+
- /* Define to 1 if you have the <arpa/inet.h> header file. */
- #undef HAVE_ARPA_INET_H
-
-@@ -156,9 +158,2 @@ Allow APIs defined post NT4 to be used in files using the header
-
--#ifndef _WIN32_WINNT_NT4
--#define _WIN32_WINNT_NT4 0x0400
--#endif
--
--#define NTDDI_VERSION _WIN32_WINNT_NT4
--#define _WIN32_WINNT _WIN32_WINNT_NT4
--
-#define _CRT_SECURE_NO_WARNINGS
-
-@@ -171,12 +164,17 @@
- #undef max
-
- #include <errno.h>
-+#include <stdlib.h>
-
- #define strtok_r strtok_s
- #define localtime_r(a,b) localtime_s(b,a)
- #define get_errno() errno=GetLastError()
--#define random rand
-+
-+inline int __cdecl random() { return rand(); }
-+
-+#if ((defined(_MSC_VER) && _MSC_VER < 1900) || !defined(_MSC_VER))
- #define snprintf _snprintf
-+#endif
-
- #define ACL ZKACL  // Conflict with windows API
-
-@@ -192,5 +199,5 @@
- #define EINPROGRESS WSAEINPROGRESS
- #endif
-
--typedef int pid_t;
-+typedef DWORD pid_t;
- #endif
-diff --git a/src/c/include/winstdint.h b/src/c/include/winstdint.h
-old mode 100755
-new mode 100644
-index d02608a..be60a65
---- a/src/c/include/winstdint.h
-+++ b/src/c/include/winstdint.h
-@@ -41,6 +41,7 @@
- #endif
-
- #include <limits.h>
-+#include <stdint.h>
-
- // For Visual Studio 6 in C++ mode and for many Visual Studio versions when
- // compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
-@@ -100,16 +101,6 @@ typedef uint16_t  uint_least16_t;
- typedef uint32_t  uint_least32_t;
- typedef uint64_t  uint_least64_t;
-
--// 7.18.1.3 Fastest minimum-width integer types
--typedef int8_t    int_fast8_t;
--typedef int16_t   int_fast16_t;
--typedef int32_t   int_fast32_t;
--typedef int64_t   int_fast64_t;
--typedef uint8_t   uint_fast8_t;
--typedef uint16_t  uint_fast16_t;
--typedef uint32_t  uint_fast32_t;
--typedef uint64_t  uint_fast64_t;
--
- // 7.18.1.4 Integer types capable of holding object pointers
- #ifdef _WIN64 // [
-    typedef signed __int64    intptr_t;