Skip to content

Commit

Permalink
Merge pull request #183 from BillyONeal/boost-186-hazelcast
Browse files Browse the repository at this point in the history
[hazelcast-cpp-client] Fix build with Boost 1.86.
  • Loading branch information
Osyotr authored Oct 18, 2024
2 parents ee845ff + 2fe745f commit 2212ca6
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 13 deletions.
145 changes: 145 additions & 0 deletions ports/hazelcast-cpp-client/boost-1-86-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
diff --git a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h
index 4df3620dc..bf0340f47 100644
--- a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h
+++ b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h
@@ -56,6 +56,11 @@
namespace hazelcast {
namespace util {
class ByteBuffer;
+
+template<class T>
+struct is_trivial_or_uuid : std::is_trivial<T> {};
+template<>
+struct is_trivial_or_uuid<boost::uuids::uuid> : std::true_type {};
}

namespace cp {
@@ -594,7 +599,7 @@ public:
std::is_same<std::pair<typename T::value_type::first_type,
typename T::value_type::second_type>,
typename T::value_type>::value &&
- std::is_trivial<typename T::value_type::first_type>::value &&
+ hazelcast::util::is_trivial_or_uuid<typename T::value_type::first_type>::value &&
std::is_trivial<typename T::value_type::second_type>::value,
T>::type
get()
@@ -625,7 +630,7 @@ public:
std::is_same<std::pair<typename T::value_type::first_type,
typename T::value_type::second_type>,
typename T::value_type>::value &&
- std::is_trivial<typename T::value_type::first_type>::value &&
+ hazelcast::util::is_trivial_or_uuid<typename T::value_type::first_type>::value &&
!std::is_trivial<typename T::value_type::second_type>::value,
T>::type
get()
@@ -1246,12 +1251,11 @@ public:
set(nil);
if (!nil) {
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(uuid.data));
+ *reinterpret_cast<int64_t*>(&uuid.data[0]));
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(uuid.data +
- util::Bits::LONG_SIZE_IN_BYTES));
+ *reinterpret_cast<int64_t*>(&uuid.data[util::Bits::LONG_SIZE_IN_BYTES]));
std::memcpy(wr_ptr(sizeof(boost::uuids::uuid)),
- uuid.data,
+ &uuid.data[0],
sizeof(boost::uuids::uuid));
} else {
wr_ptr(sizeof(boost::uuids::uuid));
@@ -1525,13 +1529,13 @@ private:
boost::uuids::uuid get_uuid()
{
boost::uuids::uuid u;
- memcpy(&u.data,
+ memcpy(&u.data[0],
rd_ptr(sizeof(boost::uuids::uuid)),
sizeof(boost::uuids::uuid));
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(u.data));
+ *reinterpret_cast<int64_t*>(&u.data[0]));
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(u.data + util::Bits::LONG_SIZE_IN_BYTES));
+ *reinterpret_cast<int64_t*>(&u.data[util::Bits::LONG_SIZE_IN_BYTES]));
return u;
}

diff --git a/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h b/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h
index 9e678f54d..88a2f14c0 100644
--- a/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h
+++ b/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h
@@ -182,11 +182,11 @@ public:
{
check_available(util::Bits::UUID_SIZE_IN_BYTES);
boost::uuids::uuid u;
- std::memcpy(&u.data, &buffer_[pos_], util::Bits::UUID_SIZE_IN_BYTES);
+ std::memcpy(&u.data[0], &buffer_[pos_], util::Bits::UUID_SIZE_IN_BYTES);
pos_ += util::Bits::UUID_SIZE_IN_BYTES;
if (byte_order_ == boost::endian::order::little) {
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(u.data));
+ *reinterpret_cast<int64_t*>(&u.data[0]));
boost::endian::endian_reverse_inplace<int64_t>(
*reinterpret_cast<int64_t*>(
&u.data[util::Bits::LONG_SIZE_IN_BYTES]));
diff --git a/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h b/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h
index 5b3186347..625c642b2 100644
--- a/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h
+++ b/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h
@@ -210,22 +210,7 @@ private:
const std::string& name,
int partition = UNASSIGNED_PARTITION,
const std::shared_ptr<connection::Connection>& conn = nullptr,
- boost::uuids::uuid uuid = { 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0,
- 0x0 });
+ boost::uuids::uuid uuid = {});

void invoke_on_selection();

diff --git a/hazelcast/src/hazelcast/client/protocol.cpp b/hazelcast/src/hazelcast/client/protocol.cpp
index cfc67f26f..934d9da4b 100644
--- a/hazelcast/src/hazelcast/client/protocol.cpp
+++ b/hazelcast/src/hazelcast/client/protocol.cpp
@@ -376,7 +376,7 @@ operator<<(std::ostream& os, const ClientMessage& msg)
void
ClientMessage::set(unsigned char* /* memory */, boost::uuids::uuid uuid)
{
- std::memcpy(wr_ptr(uuid.size()), uuid.data, uuid.size());
+ std::memcpy(wr_ptr(uuid.size()), &uuid.data[0], uuid.size());
}

void
diff --git a/hazelcast/src/hazelcast/client/serialization.cpp b/hazelcast/src/hazelcast/client/serialization.cpp
index 071772fec..8dcb6ccf0 100644
--- a/hazelcast/src/hazelcast/client/serialization.cpp
+++ b/hazelcast/src/hazelcast/client/serialization.cpp
@@ -731,12 +731,12 @@ data_output::write(boost::uuids::uuid v)
}
if (byte_order_ == boost::endian::order::little) {
boost::endian::endian_reverse_inplace<int64_t>(
- *reinterpret_cast<int64_t*>(v.data));
+ *reinterpret_cast<int64_t*>(&v.data[0]));
boost::endian::endian_reverse_inplace<int64_t>(
*reinterpret_cast<int64_t*>(&v.data[util::Bits::LONG_SIZE_IN_BYTES]));
}
output_stream_.insert(
- output_stream_.end(), v.data, v.data + util::Bits::UUID_SIZE_IN_BYTES);
+ output_stream_.end(), &v.data[0], &v.data[util::Bits::LONG_SIZE_IN_BYTES]);
}

template<>
2 changes: 2 additions & 0 deletions ports/hazelcast-cpp-client/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 9f6668fe88b1e10e1c91fea26acb12efab464f652d9008e43b06d92413a7bc4b66cd0ef00c0643ddf12c8d29b099cd767209a096e609fa214233dcc3288d194e
HEAD_REF master
PATCHES
boost-1-86-fix.patch # https://github.com/hazelcast/hazelcast-cpp-client/pull/1247
)

vcpkg_check_features(
Expand Down
1 change: 1 addition & 0 deletions ports/hazelcast-cpp-client/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "hazelcast-cpp-client",
"version": "5.3.0",
"port-version": 1,
"description": "C++ client library for Hazelcast in-memory database.",
"homepage": "https://github.com/hazelcast/hazelcast-cpp-client",
"documentation": "http://hazelcast.github.io/hazelcast-cpp-client/index.html",
Expand Down
12 changes: 0 additions & 12 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,18 +447,6 @@ gz-tools2:x64-android=fail
gz-tools2:arm64-android=fail
gz-gui7:x64-osx=fail
halide:x64-windows-static=fail
# hazelcast-cpp-client fails to build with Boost 1.86
hazelcast-cpp-client:x86-windows=fail
hazelcast-cpp-client:x64-windows=fail
hazelcast-cpp-client:x64-windows-static=fail
hazelcast-cpp-client:x64-windows-static-md=fail
hazelcast-cpp-client:arm64-windows=fail
hazelcast-cpp-client:x64-osx=fail
hazelcast-cpp-client:arm64-osx=fail
hazelcast-cpp-client:x64-linux=fail
hazelcast-cpp-client:arm-neon-android=fail
hazelcast-cpp-client:arm64-android=fail
hazelcast-cpp-client:x64-android=fail
hexl:x64-android=fail
highs:arm-neon-android=fail
highs:arm64-android=fail
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@
},
"hazelcast-cpp-client": {
"baseline": "5.3.0",
"port-version": 0
"port-version": 1
},
"hdf5": {
"baseline": "1.14.4.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/h-/hazelcast-cpp-client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c85557c281b86c8aabb762d79c45775ccea9c0b9",
"version": "5.3.0",
"port-version": 1
},
{
"git-tree": "4940909398dd70e7610c314749ca143bb0c23918",
"version": "5.3.0",
Expand Down

0 comments on commit 2212ca6

Please sign in to comment.