aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-09-16 19:36:15 -0400
committerDavid Robillard <d@drobilla.net>2022-09-16 22:31:06 -0400
commit6ff6556a531e06217fe5e7ad86d2093b3c79ea7c (patch)
treed4ea2e353065b2d777bb8586e0160c2d667479a6
parent012b0de29906af6402a05a95eed0253a662df78b (diff)
downloadchilbert-6ff6556a531e06217fe5e7ad86d2093b3c79ea7c.tar.gz
chilbert-6ff6556a531e06217fe5e7ad86d2093b3c79ea7c.tar.bz2
chilbert-6ff6556a531e06217fe5e7ad86d2093b3c79ea7c.zip
Fix uninitialized members
-rw-r--r--.clang-tidy1
-rw-r--r--include/chilbert/BoundedBitVec.hpp2
-rw-r--r--include/chilbert/SmallBitVec.hpp3
-rw-r--r--test/test_hilbert.cpp2
-rw-r--r--test/test_utils.hpp4
5 files changed, 5 insertions, 7 deletions
diff --git a/.clang-tidy b/.clang-tidy
index e096e94..d4f85ba 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -2,7 +2,6 @@ Checks: >
*,
-*-avoid-c-arrays,
-*-magic-numbers,
- -*-member-init,
-*-move-const-arg,
-*-named-parameter,
-*-no-malloc,
diff --git a/include/chilbert/BoundedBitVec.hpp b/include/chilbert/BoundedBitVec.hpp
index fa414ca..4f9ef60 100644
--- a/include/chilbert/BoundedBitVec.hpp
+++ b/include/chilbert/BoundedBitVec.hpp
@@ -92,7 +92,7 @@ private:
}
std::array<Rack, calculate_num_racks(MaxN)> m_racks{};
- size_t m_size;
+ size_t m_size{};
};
namespace detail {
diff --git a/include/chilbert/SmallBitVec.hpp b/include/chilbert/SmallBitVec.hpp
index 10668ac..d9256c6 100644
--- a/include/chilbert/SmallBitVec.hpp
+++ b/include/chilbert/SmallBitVec.hpp
@@ -70,8 +70,7 @@ public:
};
explicit SmallBitVec(const size_t bits)
- : m_rack{0}
- , m_size{bits}
+ : m_size{bits}
{
assert(bits <= bits_per_rack);
}
diff --git a/test/test_hilbert.cpp b/test/test_hilbert.cpp
index ac4bba1..a0a64c0 100644
--- a/test/test_hilbert.cpp
+++ b/test/test_hilbert.cpp
@@ -39,7 +39,7 @@ template <size_t D>
std::array<uint64_t, D>
make_random_point(Context& ctx, const std::array<size_t, D>& ms)
{
- std::array<uint64_t, D> p;
+ std::array<uint64_t, D> p{};
for (size_t i = 0; i < D; ++i) {
p[i] = rand_between(ctx, 0, (1UL << ms[i]) - 1);
}
diff --git a/test/test_utils.hpp b/test/test_utils.hpp
index 3388552..65bd1b1 100644
--- a/test/test_utils.hpp
+++ b/test/test_utils.hpp
@@ -69,7 +69,7 @@ template <size_t N, size_t D, size_t Max = 64>
std::array<size_t, D>
make_random_precisions(Context& ctx)
{
- std::array<size_t, D> ms;
+ std::array<size_t, D> ms{};
size_t bits_left = N;
for (size_t i = 0; i < D; ++i) {
@@ -85,7 +85,7 @@ template <size_t M, size_t D>
std::array<uint64_t, D>
make_random_point(Context& ctx)
{
- std::array<uint64_t, D> p;
+ std::array<uint64_t, D> p{};
for (size_t i = 0; i < D; ++i) {
p[i] = rand_between(ctx, 0, (1UL << M) - 1);
}