Skip to content

Commit 422c44d

Browse files
authored
Merge pull request #76 from elbeno/update-stuff
⬆️ 👷 Bring toolchains up to date
2 parents d20fa24 + 25827fb commit 422c44d

13 files changed

Lines changed: 114 additions & 61 deletions

File tree

.github/workflows/asciidoctor-ghpages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3737

3838
- name: Setup Node.js
39-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
39+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
4040
with:
4141
node-version: 20
4242

4343
- name: Install Mermaid
4444
run: |
45-
sudo npm install -g @mermaid-js/mermaid-cli@11.2.1
45+
npm install -g @mermaid-js/mermaid-cli@11.4.2
4646
npx puppeteer browsers install chrome-headless-shell
4747
4848
- name: Install asciidoctor

.github/workflows/unit_tests.yml

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ env:
1313
DEBIAN_FRONTEND: noninteractive
1414
CMAKE_GENERATOR: Ninja
1515
DEFAULT_CXX_STANDARD: 20
16-
DEFAULT_LLVM_VERSION: 18
17-
DEFAULT_GCC_VERSION: 13
16+
DEFAULT_LLVM_VERSION: 21
17+
DEFAULT_GCC_VERSION: 14
1818

1919
concurrency:
2020
group: ${{ github.head_ref || github.run_id }}
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
compiler: [clang, gcc]
30-
version: [12, 13, 16, 17, 18]
30+
version: [12, 13, 14, 16, 17, 18, 19, 20, 21]
3131
cxx_standard: [20]
3232
stdlib: [libstdc++, libc++]
3333
build_type: [Debug]
@@ -36,6 +36,33 @@ jobs:
3636
cc: "clang"
3737
cxx: "clang++"
3838
cxx_flags: "-stdlib=libstdc++"
39+
- version: 21
40+
compiler: clang
41+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 21
42+
toolchain_root: "/usr/lib/llvm-21"
43+
- version: 21
44+
compiler: clang
45+
stdlib: libc++
46+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 21 && sudo apt install -y libc++-21-dev libc++abi-21-dev
47+
cxx_flags: "-stdlib=libc++"
48+
- version: 20
49+
compiler: clang
50+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20
51+
toolchain_root: "/usr/lib/llvm-20"
52+
- version: 20
53+
compiler: clang
54+
stdlib: libc++
55+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 && sudo apt install -y libc++-20-dev libc++abi-20-dev
56+
cxx_flags: "-stdlib=libc++"
57+
- version: 19
58+
compiler: clang
59+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 19
60+
toolchain_root: "/usr/lib/llvm-19"
61+
- version: 19
62+
compiler: clang
63+
stdlib: libc++
64+
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 19 && sudo apt install -y libc++-19-dev libc++abi-19-dev
65+
cxx_flags: "-stdlib=libc++"
3966
- version: 18
4067
compiler: clang
4168
install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18
@@ -66,24 +93,37 @@ jobs:
6693
- compiler: gcc
6794
toolchain_root: "/usr"
6895
cxx_flags: ""
96+
- version: 14
97+
compiler: gcc
98+
install: sudo apt update && sudo apt install -y gcc-14 g++-14
99+
cc: "gcc-14"
100+
cxx: "g++-14"
69101
- version: 13
70102
compiler: gcc
71-
install: sudo apt update && sudo apt-get install -y gcc-13 g++-13
103+
install: sudo apt update && sudo apt install -y gcc-13 g++-13
72104
cc: "gcc-13"
73105
cxx: "g++-13"
74106
- version: 12
75107
compiler: gcc
76-
install: sudo apt update && sudo apt-get install -y gcc-12 g++-12
108+
install: sudo apt update && sudo apt install -y gcc-12 g++-12
77109
cc: "gcc-12"
78110
cxx: "g++-12"
79111
cxx_flags: ""
80112
exclude:
113+
- compiler: gcc
114+
version: 21
115+
- compiler: gcc
116+
version: 20
117+
- compiler: gcc
118+
version: 19
81119
- compiler: gcc
82120
version: 18
83121
- compiler: gcc
84122
version: 17
85123
- compiler: gcc
86124
version: 16
125+
- compiler: clang
126+
version: 14
87127
- compiler: clang
88128
version: 13
89129
- compiler: clang
@@ -321,6 +361,13 @@ jobs:
321361
path: ~/cpm-cache
322362
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
323363

364+
# https://github.com/actions/runner-images/issues/9524
365+
- name: Fix kernel mmap rnd bits
366+
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
367+
# high-entropy ASLR in much newer kernels that GitHub runners are
368+
# using leading to random crashes: https://reviews.llvm.org/D148280
369+
run: sudo sysctl vm.mmap_rnd_bits=28
370+
324371
- name: Build Unit Tests
325372
run: cmake --build ${{github.workspace}}/build -t unit_tests
326373

include/safe/array.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ template <typename T, std::size_t Size> struct array {
4040
return storage[pos.unsafe_value()];
4141
}
4242

43-
[[nodiscard]] constexpr auto
44-
at(var<size_type, ival<0, Size - 1>> pos) -> reference {
43+
[[nodiscard]] constexpr auto at(var<size_type, ival<0, Size - 1>> pos)
44+
-> reference {
4545
return storage[pos.unsafe_value()];
4646
}
4747

48-
[[nodiscard]] constexpr auto
49-
at(var<size_type, ival<0, Size - 1>> pos) const -> const_reference {
48+
[[nodiscard]] constexpr auto at(var<size_type, ival<0, Size - 1>> pos) const
49+
-> const_reference {
5050
return storage[pos.unsafe_value()];
5151
}
5252

@@ -152,14 +152,14 @@ template <std::size_t I, class T, std::size_t N>
152152
}
153153

154154
template <std::size_t I, class T, std::size_t N>
155-
[[nodiscard]] constexpr auto
156-
get(safe::array<T, N> const &a) noexcept -> T const & {
155+
[[nodiscard]] constexpr auto get(safe::array<T, N> const &a) noexcept
156+
-> T const & {
157157
return a[safe::constant<std::size_t, I>];
158158
}
159159

160160
template <std::size_t I, class T, std::size_t N>
161-
[[nodiscard]] constexpr auto
162-
get(safe::array<T, N> const &&a) noexcept -> T const && {
161+
[[nodiscard]] constexpr auto get(safe::array<T, N> const &&a) noexcept
162+
-> T const && {
163163
return a[safe::constant<std::size_t, I>];
164164
}
165165

include/safe/big_integer/detail/compare.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
namespace safe::_big_integer::detail {
1010
template <std::size_t LhsNumBits, std::size_t RhsNumBits>
11-
[[nodiscard]] constexpr auto
12-
unsigned_compare(storage<LhsNumBits> const &lhs,
13-
storage<RhsNumBits> const &rhs) -> std::strong_ordering {
11+
[[nodiscard]] constexpr auto unsigned_compare(storage<LhsNumBits> const &lhs,
12+
storage<RhsNumBits> const &rhs)
13+
-> std::strong_ordering {
1414
for (auto i = std::max(lhs.num_elems, rhs.num_elems); i > std::size_t{};) {
1515
--i;
1616
auto const l = lhs.get(i);
@@ -26,9 +26,9 @@ unsigned_compare(storage<LhsNumBits> const &lhs,
2626
}
2727

2828
template <std::size_t LhsNumBits, std::size_t RhsNumBits>
29-
[[nodiscard]] constexpr auto
30-
operator<=>(storage<LhsNumBits> const &lhs,
31-
storage<RhsNumBits> const &rhs) -> std::strong_ordering {
29+
[[nodiscard]] constexpr auto operator<=>(storage<LhsNumBits> const &lhs,
30+
storage<RhsNumBits> const &rhs)
31+
-> std::strong_ordering {
3232
if (lhs.negative()) {
3333
if (rhs.negative()) {
3434
return unsigned_compare(lhs, rhs);

include/safe/big_integer/detail/plus.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#include <functional>
88

99
namespace safe::_big_integer::detail {
10-
constexpr static auto plus =
11-
stateful_zip_transform(elem_t{}, [](elem_t &carry, double_elem_t const &lhs,
12-
double_elem_t const &rhs) {
10+
constexpr static auto plus = stateful_zip_transform(
11+
elem_t{},
12+
[](elem_t &carry, double_elem_t const &lhs,
13+
double_elem_t const &rhs) -> double_elem_t {
1314
double_elem_t const result =
1415
lhs + rhs + static_cast<double_elem_t>(carry);
1516

include/safe/big_integer/detail/storage.hpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ using double_elem_t = std::uint64_t;
1313

1414
template <std::size_t NumBits> struct storage {
1515
public:
16-
constexpr static auto num_elems = (NumBits + 31) / 32;
17-
constexpr static auto num_bits = NumBits;
16+
constexpr static std::size_t num_elems = (NumBits + 31) / 32;
17+
constexpr static std::size_t num_bits = NumBits;
1818

1919
std::array<elem_t, num_elems> elems{};
2020

@@ -55,20 +55,22 @@ template <std::size_t NumBits> struct storage {
5555

5656
[[nodiscard]] constexpr auto get(int32_t i) const -> elem_t {
5757
if (i < 0) {
58-
return 0u;
58+
return elem_t{};
5959
}
60-
if (i < num_elems) {
61-
return elems[i];
60+
if (auto iu = static_cast<std::size_t>(i); iu < num_elems) {
61+
return elems[iu];
6262
}
6363
if (negative()) {
6464
return 0xffff'ffffu;
6565
}
66-
return 0u;
66+
return elem_t{};
6767
}
6868

6969
constexpr auto set(int32_t i, elem_t elem) -> void {
70-
if (i >= 0 && i < num_elems) {
71-
elems[i] = elem;
70+
if (i >= 0) {
71+
if (auto iu = static_cast<std::size_t>(i); iu < num_elems) {
72+
elems[iu] = elem;
73+
}
7274
}
7375
}
7476
};
@@ -112,8 +114,8 @@ template <std::size_t NumBits>
112114
}
113115

114116
template <std::size_t NumBits>
115-
[[nodiscard]] constexpr auto
116-
to_storage(storage<NumBits> const &v) -> auto const & {
117+
[[nodiscard]] constexpr auto to_storage(storage<NumBits> const &v)
118+
-> auto const & {
117119
return v;
118120
}
119121

@@ -135,16 +137,16 @@ template <std::integral T, T value>
135137

136138
template <std::size_t NumBits>
137139
requires(NumBits > 32 && NumBits <= 64)
138-
[[nodiscard]] constexpr auto
139-
to_integral(storage<NumBits> const &value) -> int64_t {
140+
[[nodiscard]] constexpr auto to_integral(storage<NumBits> const &value)
141+
-> int64_t {
140142
return (static_cast<uint64_t>(value.get(1)) << 32u) |
141143
(static_cast<uint64_t>(value.get(0)));
142144
}
143145

144146
template <std::size_t NumBits>
145147
requires(NumBits <= 32)
146-
[[nodiscard]] constexpr auto
147-
to_integral(storage<NumBits> const &value) -> int32_t {
148+
[[nodiscard]] constexpr auto to_integral(storage<NumBits> const &value)
149+
-> int32_t {
148150
return static_cast<int32_t>(value.get(0));
149151
}
150152

include/safe/big_integer/interface/big_integer.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ big_integer(detail::storage<NumBits>) -> big_integer<NumBits>;
159159
}
160160

161161
template <std::size_t LhsNumBits, std::size_t RhsNumBits>
162-
[[nodiscard]] constexpr auto
163-
operator==(big_integer<LhsNumBits> const &lhs,
164-
big_integer<RhsNumBits> const &rhs) -> bool {
162+
[[nodiscard]] constexpr auto operator==(big_integer<LhsNumBits> const &lhs,
163+
big_integer<RhsNumBits> const &rhs)
164+
-> bool {
165165
return lhs.unsafe_storage == rhs.unsafe_storage;
166166
}
167167

@@ -173,8 +173,8 @@ template <std::size_t LhsNumBits>
173173

174174
template <typename L, typename R>
175175
requires at_least_one_big_integer<L, R>
176-
[[nodiscard]] constexpr auto
177-
operator<=>(L const &raw_lhs, R const &raw_rhs) -> std::strong_ordering {
176+
[[nodiscard]] constexpr auto operator<=>(L const &raw_lhs, R const &raw_rhs)
177+
-> std::strong_ordering {
178178
auto lhs = detail::to_storage(raw_lhs);
179179
auto rhs = detail::to_storage(raw_rhs);
180180
return lhs <=> rhs;

include/safe/detail/assume.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
44

5-
#if defined(SAFE_TESTING)
5+
#ifdef SAFE_TESTING
66
// if testing is turned on, turn assumptions into the appropriate framework's
77
// assertion
8-
#if defined(RC_ASSERT)
8+
#ifdef RC_ASSERT
99
// RapidCheck
1010
#define SAFE_ASSUME(expr) RC_ASSERT(expr)
1111

@@ -23,7 +23,7 @@
2323
#else
2424
// adapted from section 4 in
2525
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1774r4.pdf
26-
#if defined(__cpp_assume)
26+
#ifdef __cpp_assume
2727
#define SAFE_ASSUME(expr) [[assume(expr)]]
2828
#elif defined(__clang__)
2929
// https://clang.llvm.org/docs/LanguageExtensions.html#builtin-assume

include/safe/dsl/detail/triint.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ template <typename T> struct triint {
2525
};
2626

2727
template <typename LhsT, typename RhsT>
28-
[[nodiscard]] constexpr auto operator==(triint<LhsT> lhs,
29-
triint<RhsT> rhs) -> bool {
28+
[[nodiscard]] constexpr auto operator==(triint<LhsT> lhs, triint<RhsT> rhs)
29+
-> bool {
3030
return (lhs.var_bits() == rhs.var_bits()) &&
3131
(lhs.const_bits() == rhs.const_bits());
3232
}
@@ -63,14 +63,14 @@ template <typename U>
6363
}
6464

6565
template <typename U>
66-
[[nodiscard]] constexpr auto operator<<(triint<U> val,
67-
auto shamt) -> triint<U> {
66+
[[nodiscard]] constexpr auto operator<<(triint<U> val, auto shamt)
67+
-> triint<U> {
6868
return {val.var_bits() << shamt, val.const_bits() << shamt};
6969
}
7070

7171
template <typename U>
72-
[[nodiscard]] constexpr auto operator>>(triint<U> val,
73-
auto shamt) -> triint<U> {
72+
[[nodiscard]] constexpr auto operator>>(triint<U> val, auto shamt)
73+
-> triint<U> {
7474
return {val.var_bits() >> shamt, val.const_bits() >> shamt};
7575
}
7676

include/safe/dsl/intersection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ template <typename... Intervals> struct intersection_t : public detail::set_op {
88
};
99

1010
template <Operand LhsT, Operand RhsT>
11-
[[nodiscard]] constexpr auto operator&&(LhsT,
12-
RhsT) -> intersection_t<LhsT, RhsT> {
11+
[[nodiscard]] constexpr auto operator&&(LhsT, RhsT)
12+
-> intersection_t<LhsT, RhsT> {
1313
return {};
1414
}
1515
} // namespace safe::dsl

0 commit comments

Comments
 (0)