Observed while pricing whether the per-rule list could move off parse (#359). Small, additive, and free.
The situation
src/cli/cmd_build.cpp calls check_unscanned_compiles, which materializes the complete Vec<Diagnostic> — every per-rule message formatted and interned — and then reads .size() to print one summary line:
[build-gcc] 5 rules produce an object file with no dependency scan; run 'putup parse' for the list.
The list the message points at already exists, in memory, one scope from the line that declines to print it.
Why it is not printed
Deliberate, and it should stay the default: per-rule warnings firing on every build train users to scroll past warnings. On the binutils BSP that would be five lines on every green build; the design puts the detail in parse for exactly that reason.
The proposal
Print the per-rule findings on the build when --verbose is set. --verbose is already parsed globally and already consulted throughout cmd_build, so this needs no new flag, no new surface, and no computation — the diagnostics are already built.
It is purely additive: parse keeps the check, so run 'putup parse' for the list stays true.
Measured cost of the list on the build path
Removing the check_unscanned_compiles call from the build entirely:
|
I refs |
| dry-run with the check |
2,764,252,747 |
| dry-run with the call removed |
2,761,891,373 |
| cost of the whole list |
2,361,374 — 0.085% |
Note that 0.085% is a property of this corpus: it is cheap because most rules already have a scan node and are skipped before the expensive path. On a corpus whose compiles carry -MD no scan nodes are created, and the check falls through to expand_instruction + reports_own_deps for every compile — still far cheaper than a full recompute, but not 0.085%.
Scope
Not urgent and deliberately not bundled into #359. Worth having if anyone wants the list without a second invocation.
Observed while pricing whether the per-rule list could move off
parse(#359). Small, additive, and free.The situation
src/cli/cmd_build.cppcallscheck_unscanned_compiles, which materializes the completeVec<Diagnostic>— every per-rule message formatted and interned — and then reads.size()to print one summary line:The list the message points at already exists, in memory, one scope from the line that declines to print it.
Why it is not printed
Deliberate, and it should stay the default: per-rule warnings firing on every build train users to scroll past warnings. On the binutils BSP that would be five lines on every green build; the design puts the detail in
parsefor exactly that reason.The proposal
Print the per-rule findings on the build when
--verboseis set.--verboseis already parsed globally and already consulted throughoutcmd_build, so this needs no new flag, no new surface, and no computation — the diagnostics are already built.It is purely additive:
parsekeeps the check, sorun 'putup parse' for the liststays true.Measured cost of the list on the build path
Removing the
check_unscanned_compilescall from the build entirely:Note that 0.085% is a property of this corpus: it is cheap because most rules already have a scan node and are skipped before the expensive path. On a corpus whose compiles carry
-MDno scan nodes are created, and the check falls through toexpand_instruction+reports_own_depsfor every compile — still far cheaper than a full recompute, but not 0.085%.Scope
Not urgent and deliberately not bundled into #359. Worth having if anyone wants the list without a second invocation.