test: Move cluster_linearize.h contents into cluster_linearize namespace
What changed, and why it matters
This commit is a minor code cleanup in a test-only header file. It moves helper functions from an anonymous namespace into a named namespace and removes some compiler-hint annotations. There is no change to how Bitcoin Core validates transactions, handles money, or protects user data.
No security action needed. Treat as ordinary refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes src/test/util/cluster_linearize.h only. It replaces an unnamed namespace with namespace cluster_linearize, removes using namespace cluster_linearize, and drops [[maybe_unused]] on two static helper methods inside DepGraphFormatter. The purpose stated in the commit message is to silence Clang -Wunused-template warnings for bench_bitcoin/fuzz builds and to follow C++ Core Guideline SF.21. No logic, interfaces, or runtime behavior are altered.
Changed components
src/test/util/cluster_linearize.hInspect captured patch +4 / −6
diff --git a/src/test/util/cluster_linearize.h b/src/test/util/cluster_linearize.h
index b3f639e8..6e2ae130 100644
--- a/src/test/util/cluster_linearize.h
+++ b/src/test/util/cluster_linearize.h
@@ -17,9 +17,7 @@
#include <utility>
#include <vector>
-namespace {
-
-using namespace cluster_linearize;
+namespace cluster_linearize {
using TestBitSet = BitSet<32>;
@@ -99,7 +97,7 @@ using TestBitSet = BitSet<32>;
struct DepGraphFormatter
{
/** Convert x>=0 to 2x (even), x<0 to -2x-1 (odd). */
- [[maybe_unused]] static uint64_t SignedToUnsigned(int64_t x) noexcept
+ static uint64_t SignedToUnsigned(int64_t x) noexcept
{
if (x < 0) {
return 2 * uint64_t(-(x + 1)) + 1;
@@ -109,7 +107,7 @@ struct DepGraphFormatter
}
/** Convert even x to x/2 (>=0), odd x to -(x/2)-1 (<0). */
- [[maybe_unused]] static int64_t UnsignedToSigned(uint64_t x) noexcept
+ static int64_t UnsignedToSigned(uint64_t x) noexcept
{
if (x & 1) {
return -int64_t(x / 2) - 1;
@@ -416,6 +414,6 @@ inline uint64_t MaxOptimalLinearizationCost(DepGraphIndex cluster_count)
return COSTS[cluster_count] * 2;
}
-} // namespace
+} // namespace cluster_linearize
#endif // BITCOIN_TEST_UTIL_CLUSTER_LINEARIZE_H
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.