Skip to content

Commit a68384f

Browse files
committed
🚨 Updates for fixed clang-tidy
1 parent d4ba91e commit a68384f

File tree

10 files changed

+66
-41
lines changed

10 files changed

+66
-41
lines changed

.github/workflows/unit_tests.yml

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ jobs:
100100
run: |
101101
${{ matrix.install }}
102102
sudo apt install -y ninja-build python3-venv python3-pip
103-
python3 -m venv ${{github.workspace}}/test_venv
104-
source ${{github.workspace}}/test_venv/bin/activate
105-
pip install -r ${{github.workspace}}/requirements.txt
106-
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
107-
108103
109104
- name: Restore CPM cache
110105
env:
@@ -132,6 +127,13 @@ jobs:
132127
path: ~/cpm-cache
133128
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
134129

130+
- name: Install python test requirements
131+
run: |
132+
python3 -m venv ${{github.workspace}}/test_venv
133+
source ${{github.workspace}}/test_venv/bin/activate
134+
pip install -r ${{github.workspace}}/requirements.txt
135+
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
136+
135137
- name: Build Unit Tests
136138
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
137139

@@ -184,10 +186,6 @@ jobs:
184186
run: |
185187
${{ matrix.install }}
186188
sudo apt install -y ninja-build python3-venv python3-pip
187-
python3 -m venv ${{github.workspace}}/test_venv
188-
source ${{github.workspace}}/test_venv/bin/activate
189-
pip install -r ${{github.workspace}}/requirements.txt
190-
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
191189
192190
- name: Restore CPM cache
193191
env:
@@ -215,6 +213,13 @@ jobs:
215213
path: ~/cpm-cache
216214
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
217215

216+
- name: Install python test requirements
217+
run: |
218+
python3 -m venv ${{github.workspace}}/test_venv
219+
source ${{github.workspace}}/test_venv/bin/activate
220+
pip install -r ${{github.workspace}}/requirements.txt
221+
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
222+
218223
- name: Build Unit Tests
219224
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests
220225

@@ -263,7 +268,7 @@ jobs:
263268
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
264269
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
265270
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
266-
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache
271+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=17 -DCPM_SOURCE_CACHE=~/cpm-cache
267272

268273
- name: Save CPM cache
269274
env:
@@ -303,10 +308,6 @@ jobs:
303308
run: |
304309
${{ matrix.install }}
305310
sudo apt install -y ninja-build python3-venv python3-pip
306-
python3 -m venv ${{github.workspace}}/test_venv
307-
source ${{github.workspace}}/test_venv/bin/activate
308-
pip install -r ${{github.workspace}}/requirements.txt
309-
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
310311
311312
- name: Restore CPM cache
312313
env:
@@ -335,6 +336,13 @@ jobs:
335336
path: ~/cpm-cache
336337
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
337338

339+
- name: Install python test requirements
340+
run: |
341+
python3 -m venv ${{github.workspace}}/test_venv
342+
source ${{github.workspace}}/test_venv/bin/activate
343+
pip install -r ${{github.workspace}}/requirements.txt
344+
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
345+
338346
# https://github.com/actions/runner-images/issues/9524
339347
- name: Fix kernel mmap rnd bits
340348
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
@@ -353,10 +361,6 @@ jobs:
353361
- name: Install build tools
354362
run: |
355363
sudo apt update && sudo apt install -y gcc-${{env.DEFAULT_GCC_VERSION}} g++-${{env.DEFAULT_GCC_VERSION}} ninja-build valgrind python3-venv python3-pip
356-
python3 -m venv ${{github.workspace}}/test_venv
357-
source ${{github.workspace}}/test_venv/bin/activate
358-
pip install -r ${{github.workspace}}/requirements.txt
359-
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
360364
361365
- name: Restore CPM cache
362366
env:
@@ -384,6 +388,13 @@ jobs:
384388
path: ~/cpm-cache
385389
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
386390

391+
- name: Install python test requirements
392+
run: |
393+
python3 -m venv ${{github.workspace}}/test_venv
394+
source ${{github.workspace}}/test_venv/bin/activate
395+
pip install -r ${{github.workspace}}/requirements.txt
396+
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
397+
387398
- name: Build Unit Tests
388399
run: cmake --build ${{github.workspace}}/build -t build_unit_tests
389400

@@ -428,10 +439,6 @@ jobs:
428439
- name: Install build tools
429440
run: |
430441
sudo apt update && sudo apt install -y clang-${{env.MULL_LLVM_VERSION}} ninja-build python3-venv python3-pip
431-
python3 -m venv ${{github.workspace}}/test_venv
432-
source ${{github.workspace}}/test_venv/bin/activate
433-
pip install -r ${{github.workspace}}/requirements.txt
434-
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
435442
436443
- name: Install mull
437444
env:
@@ -466,12 +473,19 @@ jobs:
466473
path: ~/cpm-cache
467474
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
468475

476+
- name: Install python test requirements
477+
run: |
478+
python3 -m venv ${{github.workspace}}/test_venv
479+
source ${{github.workspace}}/test_venv/bin/activate
480+
pip install -r ${{github.workspace}}/requirements.txt
481+
echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH
482+
469483
- name: Build and run mull tests
470484
run: cmake --build build -t mull_tests
471485

472486
merge_ok:
473487
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
474-
needs: [build_and_test_24, build_and_test_22, quality_checks_pass, sanitize, valgrind]
488+
needs: [build_and_test_24, build_and_test_22, mutate, quality_checks_pass, sanitize, valgrind]
475489
if: ${{ !cancelled() }}
476490
steps:
477491
- name: Enable merge

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ CMakePresets.json
1313
__pycache__
1414
.mypy_cache
1515
.pytest_cache
16-
.hypothesis
16+
.hypothesis
17+
requirements.txt

include/stdx/atomic.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace stdx {
1515
inline namespace v1 {
16+
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
1617
template <typename T> class atomic {
1718
static_assert(std::is_trivially_copyable_v<T> and
1819
std::is_copy_constructible_v<T> and
@@ -39,7 +40,7 @@ template <typename T> class atomic {
3940

4041
constexpr atomic() CPP20(requires std::is_default_constructible_v<elem_t>)
4142
: value{} {}
42-
constexpr atomic(T t) : value{static_cast<elem_t>(t)} {}
43+
constexpr explicit atomic(T t) : value{static_cast<elem_t>(t)} {}
4344
atomic(atomic const &) = delete;
4445
auto operator=(atomic const &) -> atomic & = delete;
4546

@@ -52,7 +53,9 @@ template <typename T> class atomic {
5253
::atomic::store(value, static_cast<elem_t>(t), mo);
5354
}
5455

56+
// NOLINTNEXTLINE(google-explicit-constructor)
5557
[[nodiscard]] operator T() const { return load(); }
58+
// NOLINTNEXTLINE(misc-unconventional-assign-operator)
5659
auto operator=(T t) -> T {
5760
store(t);
5861
return t;

include/stdx/atomic_bitset.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class atomic_bitset {
102102
return static_cast<StorageElem>(salient_value(order));
103103
}
104104

105+
// NOLINTNEXTLINE(google-explicit-constructor)
105106
operator bitset_t() const {
106107
return bitset_t{salient_value(std::memory_order_seq_cst)};
107108
}

include/stdx/bit.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ inline namespace v1 {
1919
// endian
2020

2121
#if __cpp_lib_endian < 201907L
22-
enum struct endian {
22+
// NOLINTNEXTLINE(performance-enum-size)
23+
enum struct endian : underlying_type_t<decltype(__BYTE_ORDER__)> {
2324
little = __ORDER_LITTLE_ENDIAN__,
2425
big = __ORDER_BIG_ENDIAN__,
2526
native = __BYTE_ORDER__
@@ -262,14 +263,14 @@ constexpr auto bit_pack = [](auto... args) {
262263
};
263264

264265
template <>
265-
constexpr auto bit_pack<std::uint16_t> =
266+
constexpr inline auto bit_pack<std::uint16_t> =
266267
[](std::uint8_t hi, std::uint8_t lo) -> std::uint16_t {
267268
return static_cast<std::uint16_t>((static_cast<std::uint32_t>(hi) << 8u) |
268269
lo);
269270
};
270271

271272
template <>
272-
constexpr auto bit_pack<std::uint32_t> =
273+
constexpr inline auto bit_pack<std::uint32_t> =
273274
stdx::overload{[](std::uint16_t hi, std::uint16_t lo) -> std::uint32_t {
274275
return (static_cast<std::uint32_t>(hi) << 16u) | lo;
275276
},
@@ -281,7 +282,7 @@ constexpr auto bit_pack<std::uint32_t> =
281282
}};
282283

283284
template <>
284-
constexpr auto bit_pack<std::uint64_t> =
285+
constexpr inline auto bit_pack<std::uint64_t> =
285286
stdx::overload{[](std::uint32_t hi, std::uint32_t lo) -> std::uint64_t {
286287
return (static_cast<std::uint64_t>(hi) << 32u) | lo;
287288
},

include/stdx/compiler.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
4+
35
#ifndef CONSTINIT
46
#ifndef __cpp_constinit
57
#if defined(__clang__)
@@ -50,3 +52,5 @@
5052
#else
5153
#define STDX_PRAGMA(X) STDX_DO_PRAGMA(GCC X)
5254
#endif
55+
56+
// NOLINTEND(cppcoreguidelines-macro-usage)

include/stdx/panic.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ auto panic(Args &&...args) -> void {
3131
} // namespace v1
3232
} // namespace stdx
3333

34+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
35+
3436
#if __cplusplus >= 202002L
3537
#define STDX_PANIC(MSG, ...) \
3638
[] { \
@@ -40,3 +42,5 @@ auto panic(Args &&...args) -> void {
4042
#else
4143
#define STDX_PANIC(...) stdx::panic(__VA_ARGS__)
4244
#endif
45+
46+
// NOLINTEND(cppcoreguidelines-macro-usage)

include/stdx/udls.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ operator""_Gi(unsigned long long int n) -> unsigned long long int {
8484
return n * 1'024ull * 1'024ull * 1'024ull;
8585
}
8686

87+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
88+
8789
#define STDX_SMALL_INT_LITERAL_DEF(x) \
8890
CONSTEVAL auto operator""_##x(char const *, std::size_t) \
8991
->std::integral_constant<std::size_t, x##u> { \
@@ -103,6 +105,8 @@ STDX_SMALL_INT_LITERAL_DEF(9)
103105

104106
#undef STDX_SMALL_INT_LITERAL_DEF
105107

108+
// NOLINTEND(cppcoreguidelines-macro-usage)
109+
106110
// NOLINTEND(google-runtime-int)
107111
} // namespace literals
108112

include/stdx/utility.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ template <typename T, typename U>
7878
if constexpr (t_is_const) {
7979
return std::as_const(u);
8080
} else {
81-
return static_cast<U &>(u);
81+
return (u);
8282
}
8383
} else {
8484
if constexpr (t_is_const) {
@@ -182,6 +182,8 @@ constexpr auto is_aligned_with = [](auto v) -> bool {
182182
} // namespace v1
183183
} // namespace stdx
184184

185+
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
186+
185187
#ifndef FWD
186188
#define FWD(x) std::forward<decltype(x)>(x)
187189
#endif
@@ -217,3 +219,5 @@ constexpr auto is_aligned_with = [](auto v) -> bool {
217219
STDX_PRAGMA(diagnostic pop) \
218220
}()
219221
#endif
222+
223+
// NOLINTEND(cppcoreguidelines-macro-usage)

requirements.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)