Skip to content

Commit 7376cef

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

File tree

10 files changed

+30
-19
lines changed

10 files changed

+30
-19
lines changed

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
CC: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang"
264264
CXX: "/usr/lib/llvm-${{env.DEFAULT_LLVM_VERSION}}/bin/clang++"
265265
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
266+
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=17 -DCPM_SOURCE_CACHE=~/cpm-cache
267267

268268
- name: Save CPM cache
269269
env:

.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)