refactor: Enable clang-tidy rule to reject anon namespace in header
What changed, and why it matters
This commit only changes a linting configuration file for the project's code style checker. It enables a rule that prevents anonymous namespaces from being used in header files, which is a code-quality and build-hygiene practice. There is no change to Bitcoin Core's runtime behavior, network protocol, wallet handling, consensus logic, or any user-facing feature, so it has no direct security impact.
No security action required. Treat as a normal code-quality/refactoring change.
Security signals we found
No security-relevant signals in the diff or commit message.
Change is purely a static-analysis/linting configuration update.
Evidence from the diff
The patch modifies src/.clang-tidy to add fuchsia-header-anon-namespaces (and its clang-tidy-22 alias misc-anonymous-namespace-in-header) to the enabled checks. Anonymous namespaces in headers can cause ODR (One Definition Rule) violations or unexpected linkage issues when headers are included in multiple translation units. Enabling this check is a preventive static-analysis hygiene measure; it does not alter compiled code, fix a known vulnerability, or change any executable behavior.
Changed components
src/.clang-tidyInspect captured patch +2 / −1
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 9bdcc03f..56f4b71f 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -8,8 +8,9 @@ bugprone-use-after-move,
bugprone-lambda-function-name,
bugprone-unhandled-self-assignment,
bugprone-unused-return-value,
-misc-unused-using-decls,
+fuchsia-header-anon-namespaces,
misc-no-recursion,
+misc-unused-using-decls,
modernize-avoid-bind,
modernize-deprecated-headers,
modernize-use-default-member-init,
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.