Skip to content

Commit

Permalink
[cryptopp] clang-cl: fix compilation with cryptopp/gzip.h (#40679)
Browse files Browse the repository at this point in the history
Co-authored-by: Cheney Wang <[email protected]>
  • Loading branch information
rressi-at-globus and Cheney-W authored Sep 8, 2024
1 parent 1595890 commit a01cae2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
26 changes: 26 additions & 0 deletions ports/cryptopp/cryptopp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/secblock.h b/secblock.h
index 5ab920f9..74d939cf 100644
--- a/secblock.h
+++ b/secblock.h
@@ -270,7 +270,7 @@ public:
/// \details VS.NET STL enforces the policy of "All STL-compliant allocators
/// have to provide a template class member called rebind".
template <class V> struct rebind { typedef AllocatorWithCleanup<V, T_Align16> other; };
-#if (CRYPTOPP_MSC_VERSION >= 1500)
+#if (CRYPTOPP_MSC_VERSION >= 1500) || defined(__clang__)
AllocatorWithCleanup() {}
template <class V, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<V, A> &) {}
#endif
diff --git a/zdeflate.cpp b/zdeflate.cpp
index b3514b55..20717c24 100644
--- a/zdeflate.cpp
+++ b/zdeflate.cpp
@@ -413,7 +413,7 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
{
CRYPTOPP_ASSERT(scan[2] == match[2]);
unsigned int len = (unsigned int)(
-#if defined(_STDEXT_BEGIN) && !(defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400 || CRYPTOPP_MSC_VERSION >= 1600)) && !defined(_STLPORT_VERSION)
+#if defined(_STDEXT_BEGIN) && !(defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400 || CRYPTOPP_MSC_VERSION >= 1600)) && !defined(_STLPORT_VERSION) && !defined(__clang__)
stdext::unchecked_mismatch
#else
std::mismatch
4 changes: 3 additions & 1 deletion ports/cryptopp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ vcpkg_from_github(
REF "CRYPTOPP_${CRYPTOPP_VERSION}"
SHA512 28a67141155c9c15e3e6a2173b3a8487cc38a2a2ade73bf4a09814ca541be6b06e9a501be26f7e2f42a2f80df21b076aa5d8ad4224dc0a1f8d7f3b24deae465e
HEAD_REF master
PATCHES patch.patch
PATCHES
patch.patch
cryptopp.patch
)

file(COPY "${CMAKE_SOURCE_PATH}/cryptopp" DESTINATION "${SOURCE_PATH}")
Expand Down
1 change: 1 addition & 0 deletions ports/cryptopp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "cryptopp",
"version": "8.9.0",
"port-version": 1,
"description": "Crypto++ is a free C++ class library of cryptographic schemes.",
"homepage": "https://github.com/weidai11/cryptopp",
"license": "BSL-1.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@
},
"cryptopp": {
"baseline": "8.9.0",
"port-version": 0
"port-version": 1
},
"cserialport": {
"baseline": "4.3.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/cryptopp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d0e6dbcd3cb14acffac5ce963dc8fcd1178101fc",
"version": "8.9.0",
"port-version": 1
},
{
"git-tree": "48788514ae1e84dea9055e603527c91f92c124fb",
"version": "8.9.0",
Expand Down

0 comments on commit a01cae2

Please sign in to comment.