Skip to content

Commit 7aba067

Browse files
committed
Bug#33307865 remove sunpro-cc support
Issue ===== devstudio is not a supported compiler anymore. Any special handling for SUNPRO_CC can be removed. Change ====== - remove all ifdef'ed SUNPROCC code RB: 26948
1 parent 5da4f64 commit 7aba067

File tree

7 files changed

+3
-108
lines changed

7 files changed

+3
-108
lines changed

router/src/harness/include/mysql/harness/default_init_allocator.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@
2727

2828
#include <memory>
2929

30-
#ifdef __SUNPRO_CC
31-
// workaround sun-cc's error
32-
//
33-
// Error: A is not a member of A.
34-
//
35-
// for 'using A::A' by disabling the default-init adaptor and go directly to the
36-
// allocator itself.
37-
template <class T>
38-
using default_init_allocator = std::allocator<T>;
39-
#else
4030
/**
4131
* allocator which leaves newly constructed fields "default initialized".
4232
*
@@ -69,6 +59,5 @@ class default_init_allocator : public A {
6959
a_t::construct(static_cast<A &>(*this), ptr, std::forward<Args>(args)...);
7060
}
7161
};
72-
#endif
7362

7463
#endif

router/src/harness/include/mysql/harness/stdx/bit.h

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -57,65 +57,6 @@ namespace impl {
5757
// selects impl::bswap_N() with an 'if'
5858
// 2. impl::bswap() is automatically selected with std::if_enable_t<>
5959
//
60-
#if defined(__SUNPRO_CC)
61-
// Implementation works with all compilers, but is only used with devstudio.
62-
//
63-
// - gcc [
64-
// 2 byte: 1x rol
65-
// 4 byte: 1x bswap
66-
// 8 byte: 1x bswap
67-
// ]
68-
// - clang [
69-
// 2 byte: 1x rol
70-
// 4 byte: 1x bswap
71-
// 8 byte: 1x bswap
72-
// ]
73-
// - msvc (bad) [
74-
// 2 byte: 1x rol
75-
// 4 byte: 2x shl, 2x, shr, 3x or, 2x and
76-
// 8 byte: lots of shifts, or and ands
77-
// ]
78-
// - devstudio [
79-
// 2 byte: 2x shift, 1 and, 1 or
80-
// 4 byte: 2x shl, 2x, shr, 3x or, 2x and
81-
// 8 byte: lots of shifts, or and ands
82-
//
83-
84-
constexpr uint8_t bswap_1(uint8_t t) noexcept { return t; }
85-
86-
constexpr uint16_t bswap_2(uint16_t t) noexcept {
87-
return (t & UINT16_C(0x00ff)) << (1 * 8) | (t & UINT16_C(0xff00)) >> (1 * 8);
88-
}
89-
90-
constexpr uint32_t bswap_4(uint32_t t) noexcept {
91-
return (t & UINT32_C(0x0000'00ff)) << (3 * 8) |
92-
(t & UINT32_C(0x0000'ff00)) << (1 * 8) |
93-
(t & UINT32_C(0x00ff'0000)) >> (1 * 8) |
94-
(t & UINT32_C(0xff00'0000)) >> (3 * 8);
95-
}
96-
97-
constexpr uint64_t bswap_8(uint64_t t) noexcept {
98-
return (t & UINT64_C(0x0000'0000'0000'00ff)) << (7 * 8) |
99-
(t & UINT64_C(0x0000'0000'0000'ff00)) << (5 * 8) |
100-
(t & UINT64_C(0x0000'0000'00ff'0000)) << (3 * 8) |
101-
(t & UINT64_C(0x0000'0000'ff00'0000)) << (1 * 8) |
102-
(t & UINT64_C(0x0000'00ff'0000'0000)) >> (1 * 8) |
103-
(t & UINT64_C(0x0000'ff00'0000'0000)) >> (3 * 8) |
104-
(t & UINT64_C(0x00ff'0000'0000'0000)) >> (5 * 8) |
105-
(t & UINT64_C(0xff00'0000'0000'0000)) >> (7 * 8);
106-
}
107-
108-
template <class T>
109-
constexpr std::enable_if_t<
110-
sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8, T>
111-
bswap(T t) noexcept {
112-
if (1 == sizeof(t)) return bswap_1(t);
113-
if (2 == sizeof(t)) return bswap_2(t);
114-
if (4 == sizeof(t)) return bswap_4(t);
115-
if (8 == sizeof(t)) return bswap_8(t);
116-
}
117-
118-
#else // __SUNPRO_CC
11960
// implementation for
12061
//
12162
// - gcc [
@@ -143,11 +84,6 @@ bswap(T t) noexcept {
14384
// MSVC provides _byteswap_uint64() and friends as instrincts, but they aren't
14485
// marked as constexpr.
14586
//
146-
// with devstudio it fails with:
147-
//
148-
// Error: std::enable_if_t<sizeof((T))==1, T> stdx::impl::bswap<T>(T) already
149-
// had a body defined.
150-
//
15187
template <class T>
15288
constexpr std::enable_if_t<sizeof(T) == 1, T> bswap(T t) noexcept {
15389
return t;
@@ -197,7 +133,6 @@ constexpr std::enable_if_t<sizeof(T) == 8, T> bswap(T t) noexcept {
197133
(t & UINT64_C(0xff00'0000'0000'0000)) >> (7 * 8);
198134
#endif
199135
}
200-
#endif // __SUNPRO_CC
201136

202137
} // namespace impl
203138

router/src/harness/src/sd_notify.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,7 @@ connect_to_notify_socket(net::io_context &io_ctx,
115115

116116
// stay in the loop in case we got interrupted.
117117
} else {
118-
#if defined(__SUNPRO_CC)
119-
// suncc needs a std::move(), while gcc complains about redundant
120-
// std::move().
121-
return std::move(sock);
122-
#else
123118
return sock;
124-
#endif
125119
}
126120
} while (true);
127121
}

router/src/harness/tests/test_net_ts_io_context.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,6 @@ TEST(NetTS_io_context, executor_defer_called_once) {
576576
ASSERT_EQ(global_called, 1);
577577
}
578578

579-
#if !defined(__SUNPRO_CC)
580-
// sunproc can't generate move-only lambda's
581-
582579
/**
583580
* test that net::defer() compiles with move only lambdas.
584581
*/
@@ -604,7 +601,6 @@ TEST(NetTS_io_context, executor_defer_move_only_lambda) {
604601
ASSERT_EQ(0, io_ctx.run_one());
605602
ASSERT_EQ(called, 1);
606603
}
607-
#endif
608604

609605
// net::is_executor_v<> chokes with solaris-ld on
610606
//

router/src/router/src/common/mysql_session.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,7 @@ MySQLSession::real_query(const std::string &q) {
304304
return stdx::make_unexpected(make_mysql_error_code(connection_));
305305
}
306306

307-
#if defined(__SUNPRO_CC)
308-
// ensure sun-cc doesn't try to the copy-constructor on a move-only type
309-
return std::move(res);
310-
#else
311307
return res;
312-
#endif
313308
}
314309

315310
stdx::expected<MySQLSession::mysql_result_type, MysqlError>

router/src/router/src/config_generator.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,7 @@ static stdx::expected<std::ofstream, std::error_code> open_ofstream(
492492
std::error_code{errno, std::generic_category()});
493493
}
494494

495-
#ifdef __SUNPRO_CC
496-
// make sure sun-cc uses the move-constructor (and not the non-existant
497-
// copy-constructor)
498-
return {std::move(of)};
499-
#else
500495
return of;
501-
#endif
502496
}
503497

504498
void ConfigGenerator::bootstrap_system_deployment(

router/src/routing/tests/test_routing.cc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ class MockServer {
248248
std::atomic_bool stop_;
249249
};
250250

251-
// sunpro tries to invoke the disabled copy-constructor of sock.
252-
// while GCC complains about "redundant move in return statement".
253-
#if defined(__SUNPRO_CC)
254-
#define WORKAROUND_RETURN_NON_COPYABLE_EXPECTED(x) std::move(x)
255-
#else
256-
#define WORKAROUND_RETURN_NON_COPYABLE_EXPECTED(x) (x)
257-
#endif
258-
259251
static stdx::expected<net::ip::tcp::socket, std::error_code> connect_tcp(
260252
net::io_context &io_ctx, const std::string &host, uint16_t port,
261253
std::chrono::milliseconds connect_timeout) {
@@ -302,7 +294,7 @@ static stdx::expected<net::ip::tcp::socket, std::error_code> connect_tcp(
302294
} else {
303295
// success, we can continue
304296
sock.native_non_blocking(false);
305-
return WORKAROUND_RETURN_NON_COPYABLE_EXPECTED(sock);
297+
return sock;
306298
}
307299
}
308300
} else {
@@ -312,7 +304,7 @@ static stdx::expected<net::ip::tcp::socket, std::error_code> connect_tcp(
312304
// everything is fine, we are connected
313305
sock.native_non_blocking(false);
314306

315-
return WORKAROUND_RETURN_NON_COPYABLE_EXPECTED(sock);
307+
return sock;
316308
}
317309

318310
// it failed, try the next address
@@ -364,7 +356,7 @@ connect_socket(net::io_context &io_ctx,
364356
return stdx::make_unexpected(socket_res.error());
365357
}
366358

367-
return WORKAROUND_RETURN_NON_COPYABLE_EXPECTED(sock);
359+
return sock;
368360
}
369361
#endif
370362

0 commit comments

Comments
 (0)