AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

Merge bitcoin/bitcoin#36805: Enclose all header content in include guards

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#36805: Enclose all header content in include guards

ca14da90250fb5211983021a754473cde194d59e lint: Require all code in a header to be inside its include guard (Hennadii Stepanov)
00e1f35524ac52e3936db1f1d9ba44fda4911544 Enclose all header content in include guards (Hennadii Stepanov)

Pull request description:

From https://gcc.gnu.org/onlinedocs/cpp/Once-Only-Headers.html:
> If a header file happens to be included twice, the compiler will process its contents twice. This is very likely to cause an error, e.g. when the compiler sees the same structure definition twice. Even if it does not, it will certainly waste time.

This PR fixes the three headers that have content outside their guards and modifies [`test/lint/lint-include-guards.py`](https://github.com/bitcoin/bitcoin/blob/master/test/lint/lint-include-guards.py) to catch such violations in the future.

A prerequisite for https://github.com/bitcoin/bitcoin/pull/36808.

ACKs for top commit:
maflcko:
review ACK ca14da90250fb5211983021a754473cde194d59e 🖨

Tree-SHA512: 79a3e7591d4393343df9dcd39d48fe637d62b640e4dad71079fdc2bbbbcf2c01db36c3de77e82d26f90bbc0bdd2864f0e289eb45536f9df9f6e797ee7467874d
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit is a code-quality cleanup, not a security fix. It moves include guards in three header files so they wrap all content, and updates a lint script to enforce that rule going forward. Include guards prevent the compiler from accidentally processing the same header twice, which avoids build errors and wasted compile time. There is no runtime security impact.

Recommended action

No security action required. Treat as normal code-quality/maintenance merge.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.