Skip to content

Commit 124413c

Browse files
committed
⬆️ Add support for clang-19
1 parent 9999ebc commit 124413c

24 files changed

Lines changed: 234 additions & 206 deletions

.github/workflows/unit_tests.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
DEBIAN_FRONTEND: noninteractive
1414
CMAKE_GENERATOR: Ninja
1515
DEFAULT_CXX_STANDARD: 20
16-
DEFAULT_LLVM_VERSION: 18
16+
DEFAULT_LLVM_VERSION: 19
1717
DEFAULT_GCC_VERSION: 13
1818
MULL_LLVM_VERSION: 17
1919
HYPOTHESIS_PROFILE: default
@@ -29,7 +29,7 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
compiler: [clang, gcc]
32-
version: [12, 13, 16, 17, 18]
32+
version: [12, 13, 16, 17, 18, 19]
3333
cxx_standard: [17, 20]
3434
stdlib: [libstdc++, libc++]
3535
build_type: [Debug]
@@ -38,6 +38,15 @@ jobs:
3838
cc: "clang"
3939
cxx: "clang++"
4040
cxx_flags: "-stdlib=libstdc++"
41+
- version: 19
42+
compiler: clang
43+
install: sudo apt update && sudo apt install -y clang-19
44+
toolchain_root: "/usr/lib/llvm-19"
45+
- version: 19
46+
compiler: clang
47+
stdlib: libc++
48+
install: sudo apt update && sudo apt install -y clang-19 libc++-19-dev libc++abi-19-dev
49+
cxx_flags: "-stdlib=libc++"
4150
- version: 18
4251
compiler: clang
4352
install: sudo apt update && sudo apt install -y clang-18
@@ -80,6 +89,8 @@ jobs:
8089
cxx: "g++-12"
8190
cxx_flags: ""
8291
exclude:
92+
- compiler: gcc
93+
version: 19
8394
- compiler: gcc
8495
version: 18
8596
- compiler: gcc
@@ -293,8 +304,8 @@ jobs:
293304
- compiler: clang
294305
cc: "clang"
295306
cxx: "clang++"
296-
install: sudo apt update && sudo apt install -y clang-18
297-
toolchain_root: "/usr/lib/llvm-18"
307+
install: sudo apt update && sudo apt install -y clang-19
308+
toolchain_root: "/usr/lib/llvm-19"
298309
- compiler: gcc
299310
cc: "gcc-13"
300311
cxx: "g++-13"

include/stdx/atomic_bitset.hpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class atomic_bitset {
153153
return set(lsb, static_cast<msb_t>(l + length - 1), value, order);
154154
}
155155

156-
auto set(std::memory_order order = std::memory_order_seq_cst)
157-
LIFETIMEBOUND -> atomic_bitset & {
156+
auto set(std::memory_order order = std::memory_order_seq_cst) LIFETIMEBOUND
157+
-> atomic_bitset & {
158158
atomic::store(storage, mask, order);
159159
return *this;
160160
}
@@ -167,32 +167,33 @@ class atomic_bitset {
167167
storage, static_cast<elem_t>(~(bit << pos)), order)};
168168
}
169169

170-
auto
171-
reset(lsb_t lsb, msb_t msb,
172-
std::memory_order order = std::memory_order_seq_cst) -> bitset_t {
170+
auto reset(lsb_t lsb, msb_t msb,
171+
std::memory_order order = std::memory_order_seq_cst)
172+
-> bitset_t {
173173
auto const l = to_underlying(lsb);
174174
auto const m = to_underlying(msb);
175175
auto const shifted_value = bit_mask<elem_t>(m, l);
176176
return bitset_t{atomic::fetch_and(storage, ~shifted_value, order)};
177177
}
178178

179-
auto
180-
reset(lsb_t lsb, length_t len,
181-
std::memory_order order = std::memory_order_seq_cst) -> bitset_t {
179+
auto reset(lsb_t lsb, length_t len,
180+
std::memory_order order = std::memory_order_seq_cst)
181+
-> bitset_t {
182182
auto const l = to_underlying(lsb);
183183
auto const length = to_underlying(len);
184184
return reset(lsb, static_cast<msb_t>(l + length - 1), order);
185185
}
186186

187-
auto reset(std::memory_order order = std::memory_order_seq_cst)
188-
LIFETIMEBOUND -> atomic_bitset & {
187+
auto
188+
reset(std::memory_order order = std::memory_order_seq_cst) LIFETIMEBOUND
189+
-> atomic_bitset & {
189190
atomic::store(storage, elem_t{}, order);
190191
return *this;
191192
}
192193

193194
template <typename T>
194-
auto flip(T idx,
195-
std::memory_order order = std::memory_order_seq_cst) -> bitset_t {
195+
auto flip(T idx, std::memory_order order = std::memory_order_seq_cst)
196+
-> bitset_t {
196197
auto const pos = static_cast<std::size_t>(to_underlying(idx));
197198
return bitset_t{
198199
atomic::fetch_xor(storage, static_cast<elem_t>(bit << pos), order)};

include/stdx/bit.hpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ using std::bit_cast;
4747

4848
#if __cpp_lib_byteswap < 202110L
4949
template <typename T>
50-
[[nodiscard]] constexpr auto
51-
byteswap(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
50+
[[nodiscard]] constexpr auto byteswap(T x) noexcept
51+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
5252
if constexpr (sizeof(T) == sizeof(std::uint16_t)) {
5353
return __builtin_bswap16(x);
5454
} else if constexpr (sizeof(T) == sizeof(std::uint32_t)) {
@@ -67,8 +67,8 @@ using std::byteswap;
6767

6868
#if __cpp_lib_bitops < 201907L
6969
template <typename T>
70-
[[nodiscard]] constexpr auto
71-
countl_zero(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
70+
[[nodiscard]] constexpr auto countl_zero(T x) noexcept
71+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
7272
if (x == 0) {
7373
return std::numeric_limits<T>::digits;
7474
}
@@ -88,8 +88,8 @@ countl_zero(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
8888
}
8989

9090
template <typename T>
91-
[[nodiscard]] constexpr auto
92-
countr_zero(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
91+
[[nodiscard]] constexpr auto countr_zero(T x) noexcept
92+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
9393
if (x == 0) {
9494
return std::numeric_limits<T>::digits;
9595
}
@@ -104,20 +104,20 @@ countr_zero(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
104104
}
105105

106106
template <typename T>
107-
[[nodiscard]] constexpr auto
108-
countl_one(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
107+
[[nodiscard]] constexpr auto countl_one(T x) noexcept
108+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
109109
return countl_zero(T(~x));
110110
}
111111

112112
template <typename T>
113-
[[nodiscard]] constexpr auto
114-
countr_one(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
113+
[[nodiscard]] constexpr auto countr_one(T x) noexcept
114+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
115115
return countr_zero(T(~x));
116116
}
117117

118118
template <typename T>
119-
[[nodiscard]] constexpr auto
120-
popcount(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
119+
[[nodiscard]] constexpr auto popcount(T x) noexcept
120+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
121121
if constexpr (sizeof(T) <= sizeof(unsigned int)) {
122122
return __builtin_popcount(x);
123123
} else if constexpr (sizeof(T) <=
@@ -130,8 +130,8 @@ popcount(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
130130

131131
namespace detail {
132132
template <typename T>
133-
[[nodiscard]] constexpr auto
134-
rotl(T x, T s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
133+
[[nodiscard]] constexpr auto rotl(T x, T s) noexcept
134+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
135135
#ifdef __clang__
136136
if constexpr (sizeof(T) == sizeof(std::uint8_t)) {
137137
return __builtin_rotateleft8(x, s);
@@ -148,8 +148,8 @@ rotl(T x, T s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
148148
#endif
149149
}
150150
template <typename T>
151-
[[nodiscard]] constexpr auto
152-
rotr(T x, T s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
151+
[[nodiscard]] constexpr auto rotr(T x, T s) noexcept
152+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
153153
#ifdef __clang__
154154
if constexpr (sizeof(T) == sizeof(std::uint8_t)) {
155155
return __builtin_rotateright8(x, s);
@@ -168,8 +168,8 @@ rotr(T x, T s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
168168
} // namespace detail
169169

170170
template <typename T>
171-
[[nodiscard]] constexpr auto
172-
rotl(T x, int s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
171+
[[nodiscard]] constexpr auto rotl(T x, int s) noexcept
172+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
173173
if (s == 0) {
174174
return x;
175175
}
@@ -180,8 +180,8 @@ rotl(T x, int s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
180180
}
181181

182182
template <typename T>
183-
[[nodiscard]] constexpr auto
184-
rotr(T x, int s) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
183+
[[nodiscard]] constexpr auto rotr(T x, int s) noexcept
184+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
185185
if (s == 0) {
186186
return x;
187187
}
@@ -204,29 +204,29 @@ using std::rotr;
204204

205205
#if __cpp_lib_int_pow2 < 202002L
206206
template <typename T>
207-
[[nodiscard]] constexpr auto
208-
has_single_bit(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, bool> {
207+
[[nodiscard]] constexpr auto has_single_bit(T x) noexcept
208+
-> std::enable_if_t<std::is_unsigned_v<T>, bool> {
209209
return x and not(x & (x - 1));
210210
}
211211

212212
template <typename T>
213-
[[nodiscard]] constexpr auto
214-
bit_width(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, int> {
213+
[[nodiscard]] constexpr auto bit_width(T x) noexcept
214+
-> std::enable_if_t<std::is_unsigned_v<T>, int> {
215215
return std::numeric_limits<T>::digits - countl_zero(x);
216216
}
217217

218218
template <typename T>
219-
[[nodiscard]] constexpr auto
220-
bit_ceil(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
219+
[[nodiscard]] constexpr auto bit_ceil(T x) noexcept
220+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
221221
if (x <= 1U) {
222222
return 1U;
223223
}
224224
return T(1U << bit_width(x));
225225
}
226226

227227
template <typename T>
228-
[[nodiscard]] constexpr auto
229-
bit_floor(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
228+
[[nodiscard]] constexpr auto bit_floor(T x) noexcept
229+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
230230
if (x == 0) {
231231
return x;
232232
}
@@ -240,8 +240,8 @@ using std::has_single_bit;
240240
#endif
241241

242242
template <typename T>
243-
[[nodiscard]] constexpr auto
244-
to_le(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
243+
[[nodiscard]] constexpr auto to_le(T x) noexcept
244+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
245245
if constexpr (stdx::endian::native == stdx::endian::big) {
246246
return byteswap(x);
247247
} else {
@@ -250,8 +250,8 @@ to_le(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
250250
}
251251

252252
template <typename T>
253-
[[nodiscard]] constexpr auto
254-
to_be(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
253+
[[nodiscard]] constexpr auto to_be(T x) noexcept
254+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
255255
if constexpr (stdx::endian::native == stdx::endian::little) {
256256
return byteswap(x);
257257
} else {
@@ -260,8 +260,8 @@ to_be(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
260260
}
261261

262262
template <typename T>
263-
[[nodiscard]] constexpr auto
264-
from_le(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
263+
[[nodiscard]] constexpr auto from_le(T x) noexcept
264+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
265265
if constexpr (stdx::endian::native == stdx::endian::big) {
266266
return byteswap(x);
267267
} else {
@@ -270,8 +270,8 @@ from_le(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
270270
}
271271

272272
template <typename T>
273-
[[nodiscard]] constexpr auto
274-
from_be(T x) noexcept -> std::enable_if_t<std::is_unsigned_v<T>, T> {
273+
[[nodiscard]] constexpr auto from_be(T x) noexcept
274+
-> std::enable_if_t<std::is_unsigned_v<T>, T> {
275275
if constexpr (stdx::endian::native == stdx::endian::little) {
276276
return byteswap(x);
277277
} else {
@@ -341,8 +341,8 @@ template <typename To, typename From> constexpr auto bit_unpack(From arg) {
341341

342342
namespace detail {
343343
template <typename T, std::size_t Bit>
344-
constexpr auto
345-
mask_bits() -> std::enable_if_t<Bit <= std::numeric_limits<T>::digits, T> {
344+
constexpr auto mask_bits()
345+
-> std::enable_if_t<Bit <= std::numeric_limits<T>::digits, T> {
346346
if constexpr (Bit == std::numeric_limits<T>::digits) {
347347
return std::numeric_limits<T>::max();
348348
} else {

include/stdx/bitset.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ class bitset {
243243
return *this;
244244
}
245245

246-
constexpr auto set(lsb_t lsb, msb_t msb,
247-
bool value = true) LIFETIMEBOUND -> bitset & {
246+
constexpr auto set(lsb_t lsb, msb_t msb, bool value = true) LIFETIMEBOUND
247+
-> bitset & {
248248
auto const l = to_underlying(lsb);
249249
auto const m = to_underlying(msb);
250250
auto [l_index, l_offset] = indices(l);
@@ -272,8 +272,8 @@ class bitset {
272272
return *this;
273273
}
274274

275-
constexpr auto set(lsb_t lsb, length_t len,
276-
bool value = true) LIFETIMEBOUND -> bitset & {
275+
constexpr auto set(lsb_t lsb, length_t len, bool value = true) LIFETIMEBOUND
276+
-> bitset & {
277277
auto const l = to_underlying(lsb);
278278
auto const length = to_underlying(len);
279279
return set(lsb, static_cast<msb_t>(l + length - 1), value);
@@ -398,7 +398,7 @@ class bitset {
398398

399399
constexpr auto operator<<=(std::size_t pos) LIFETIMEBOUND->bitset & {
400400
auto dst = storage_size - 1;
401-
auto const start = dst - pos / storage_elem_size;
401+
auto const start = dst - (pos / storage_elem_size);
402402
pos %= storage_elem_size;
403403

404404
if (pos == 0) {

0 commit comments

Comments
 (0)