Review report

bitcoin/bitcoin: PR #36805

2 minor findings

Findings

Link

[minor] · Incomplete guard markers can crash the include-guard linter

Three matching guard directives can leave a boundary unset, causing a TypeError that stops this linter before it checks the remaining headers.

Location: test/lint/lint-include-guards.py:128 (head).

Details and suggested fix

The aggregate count == 3 check does not require one match for each directive. For example, an expected #ifndef ID, two #define ID lines, and an unannotated #endif pass that check while leaving endif_line_num as None. On the #ifndef line, the boundary scan evaluates line_num > None and raises TypeError. The outer lint runner still reports failure, but this script exits with a traceback and skips all later headers. The base accepted this shape; the crash is new. Before scanning boundaries, require both positions to be non-None and ordered, and route failures through the existing missing-guard diagnostic and continue path. No current tracked header with this shape was identified.


Link

[minor] · Block comments hide trailing code from the include-guard check

The new lint check skips code following a closing block comment on the same line, allowing that code outside an otherwise correct include guard to go unflagged.

Location: test/lint/lint-include-guards.py:76 (head).

Details and suggested fix

_is_comment_or_blank returns True whenever a line starts inside a block comment or its stripped text starts with /*, without examining text after */. Thus /* note */ int x; before the guard is skipped, as is */ int x; after a preceding opening-comment line outside the guard. With an otherwise well-formed guard, the directive count passes and the linter can report success despite the unguarded declaration. Reclassify the remainder after each closing delimiter so only blank or comment-only lines bypass the boundary comparison. This is a gap in the new enforcement, not a regression from the base. No current tracked header with this pattern was identified.


Coverage details