Skip to content

Commit 7d6fb92

Browse files
authored
Apply patch to fix C++20 compilation when building (#3)
1 parent 82c39f6 commit 7d6fb92

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

build-cmd.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

33
cd "$(dirname "$0")"
4+
top="$(pwd)"
45

56
# turn on verbose debugging output for parabuild logs.
67
exec 4>&1; export BASH_XTRACEFD=4; set -x
@@ -41,3 +42,8 @@ pushd "$WEBSOCKETPP_SOURCE_DIR"
4142
mkdir -p "$stage/LICENSES"
4243
cp COPYING "$stage/LICENSES/websocketpp.txt"
4344
popd
45+
46+
# Apply C++20 fixes from websocketpp's PRs
47+
# Note that this patches the build artifacts, not the source!
48+
# This only makes sense because this is a header-only library anyhow.
49+
patch --directory "$stage/include/" -p1 < "$top/patches/fix-cpp20-build.patch"

patches/fix-cpp20-build.patch

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
From 39c4dd128b0c2d0f12f76137b175966b83f535ba Mon Sep 17 00:00:00 2001
2+
From: snag24 <45948878+snag24@users.noreply.github.com>
3+
Date: Thu, 5 Jun 2025 13:51:32 +0530
4+
Subject: [PATCH 1/2] Update endpoint.hpp
5+
6+
---
7+
websocketpp/endpoint.hpp | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/websocketpp/endpoint.hpp b/websocketpp/endpoint.hpp
11+
index c124b1d9a..91c348f10 100644
12+
--- a/websocketpp/endpoint.hpp
13+
+++ b/websocketpp/endpoint.hpp
14+
@@ -43,7 +43,7 @@ class endpoint : public config::transport_type, public config::endpoint_base {
15+
public:
16+
// Import appropriate types from our helper class
17+
// See endpoint_types for more details.
18+
- typedef endpoint<connection,config> type;
19+
+ typedef endpoint type;
20+
21+
/// Type of the transport component of this endpoint
22+
typedef typename config::transport_type transport_type;
23+
@@ -109,7 +109,7 @@ class endpoint : public config::transport_type, public config::endpoint_base {
24+
25+
26+
/// Destructor
27+
- ~endpoint<connection,config>() {}
28+
+ ~endpoint() {}
29+
30+
#ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
31+
// no copy constructor because endpoints are not copyable
32+
33+
From 2638897e78d1bab9357c4fba11367f6ec0bab0db Mon Sep 17 00:00:00 2001
34+
From: snag24 <45948878+snag24@users.noreply.github.com>
35+
Date: Thu, 5 Jun 2025 13:56:00 +0530
36+
Subject: [PATCH 2/2] c++20 patch
37+
38+
---
39+
websocketpp/logger/basic.hpp | 18 +++++++++---------
40+
1 file changed, 9 insertions(+), 9 deletions(-)
41+
42+
diff --git a/websocketpp/logger/basic.hpp b/websocketpp/logger/basic.hpp
43+
index 84514130e..f0e490e6d 100644
44+
--- a/websocketpp/logger/basic.hpp
45+
+++ b/websocketpp/logger/basic.hpp
46+
@@ -58,33 +58,33 @@ namespace log {
47+
template <typename concurrency, typename names>
48+
class basic {
49+
public:
50+
- basic<concurrency,names>(channel_type_hint::value h =
51+
+ basic(channel_type_hint::value h =
52+
channel_type_hint::access)
53+
: m_static_channels(0xffffffff)
54+
, m_dynamic_channels(0)
55+
, m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {}
56+
57+
- basic<concurrency,names>(std::ostream * out)
58+
+ basic(std::ostream * out)
59+
: m_static_channels(0xffffffff)
60+
, m_dynamic_channels(0)
61+
, m_out(out) {}
62+
63+
- basic<concurrency,names>(level c, channel_type_hint::value h =
64+
+ basic(level c, channel_type_hint::value h =
65+
channel_type_hint::access)
66+
: m_static_channels(c)
67+
, m_dynamic_channels(0)
68+
, m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {}
69+
70+
- basic<concurrency,names>(level c, std::ostream * out)
71+
+ basic(level c, std::ostream * out)
72+
: m_static_channels(c)
73+
, m_dynamic_channels(0)
74+
, m_out(out) {}
75+
76+
/// Destructor
77+
- ~basic<concurrency,names>() {}
78+
+ ~basic() {}
79+
80+
/// Copy constructor
81+
- basic<concurrency,names>(basic<concurrency,names> const & other)
82+
+ basic(basic<concurrency,names> const & other)
83+
: m_static_channels(other.m_static_channels)
84+
, m_dynamic_channels(other.m_dynamic_channels)
85+
, m_out(other.m_out)
86+
@@ -92,12 +92,12 @@ class basic {
87+
88+
#ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
89+
// no copy assignment operator because of const member variables
90+
- basic<concurrency,names> & operator=(basic<concurrency,names> const &) = delete;
91+
+ basic & operator=(basic<concurrency,names> const &) = delete;
92+
#endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
93+
94+
#ifdef _WEBSOCKETPP_MOVE_SEMANTICS_
95+
/// Move constructor
96+
- basic<concurrency,names>(basic<concurrency,names> && other)
97+
+ basic(basic<concurrency,names> && other)
98+
: m_static_channels(other.m_static_channels)
99+
, m_dynamic_channels(other.m_dynamic_channels)
100+
, m_out(other.m_out)
101+
@@ -105,7 +105,7 @@ class basic {
102+
103+
#ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
104+
// no move assignment operator because of const member variables
105+
- basic<concurrency,names> & operator=(basic<concurrency,names> &&) = delete;
106+
+ basic & operator=(basic<concurrency,names> &&) = delete;
107+
#endif // _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_
108+
109+
#endif // _WEBSOCKETPP_MOVE_SEMANTICS_

0 commit comments

Comments
 (0)