Enclose all header content in include guards
What changed, and why it matters
This commit fixes the placement of include guards in three C++ header files. Include guards prevent the same header from being processed multiple times, which avoids compilation errors and can prevent subtle bugs from duplicate definitions. The changes are purely structural code-quality fixes with no direct security exploit path.
No immediate action required. Treat as routine code-quality/maintenance merge. Reviewers may verify that all project headers follow the include-guard-at-top convention.
Security signals we found
Defensive code-quality improvement
Include guard placement fix
Potential ODR violation prevention
No direct memory safety or cryptographic issue
Evidence from the diff
The patch moves #ifndef/#define include guards to the very top of net_permissions.h and txgraph.h, and moves the #endif to the end of init_test_fixture.h so it encloses the entire file content. Previously, some headers had includes and declarations before the guard, or the closing guard was placed before the end of the file. This is a defensive coding cleanup that eliminates risk of double inclusion and associated compilation or ODR (One Definition Rule) issues.
Changed components
src/net_permissions.hsrc/txgraph.hsrc/wallet/test/init_test_fixture.hInspect captured patch +8 / −7
### src/net_permissions.h
@@ -2,16 +2,16 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#ifndef BITCOIN_NET_PERMISSIONS_H
+#define BITCOIN_NET_PERMISSIONS_H
+
#include <netaddress.h>
#include <netbase.h>
#include <string>
#include <type_traits>
#include <vector>
-#ifndef BITCOIN_NET_PERMISSIONS_H
-#define BITCOIN_NET_PERMISSIONS_H
-
struct bilingual_str;
extern const std::vector<std::string> NET_PERMISSIONS_DOC;
### src/txgraph.h
@@ -2,6 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#ifndef BITCOIN_TXGRAPH_H
+#define BITCOIN_TXGRAPH_H
+
#include <compare>
#include <cstdint>
#include <functional>
@@ -12,9 +15,6 @@
#include <util/feefrac.h>
-#ifndef BITCOIN_TXGRAPH_H
-#define BITCOIN_TXGRAPH_H
-
inline constexpr unsigned MAX_CLUSTER_COUNT_LIMIT{64};
/** Data structure to encapsulate fees, sizes, and dependencies for a set of transactions.
### src/wallet/test/init_test_fixture.h
@@ -24,5 +24,6 @@ struct InitWalletDirTestingSetup: public BasicTestingSetup {
std::unique_ptr<interfaces::WalletLoader> m_wallet_loader;
};
-#endif // BITCOIN_WALLET_TEST_INIT_TEST_FIXTURE_H
} // namespace wallet
+
+#endif // BITCOIN_WALLET_TEST_INIT_TEST_FIXTURE_HWhy this scored 20/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.