Summary
The C family (C, C++, Mozcpp, Objective-C) carries the same non-numeric
truthy-literal gap #1462 closed for eleven other languages. It was
deliberately deferred there, and the reason is the reason it needs its
own issue: it is the one integer-truthy group with real corpus exposure.
The gap
cpp_bool_terminal_kinds! (big-code-analysis-ast/src/macros/kind_sets.rs)
is the one name-keyed set — it alternates node-kind name strings, so it
serves all four C-family grammars despite their differing kind ids. It lists
"number_literal" and "char_literal" (added by #1410) but not
"string_literal", "concatenated_string" or "nullptr".
C treats any non-zero value as true, so if ("s") and x || "default" are
the same shape #1462 fixed everywhere else.
Why it was deferred
Corpus cost. The snapshot corpora are C/C++ 1,042, JS 384, Rust 172,
PHP 6, C# 6 — so this is the single largest exposure in the tree, and #1462
already moved 85 of 384 pdf.js snapshots for the JS half alone. Deferring it
kept that measurement separate from an eleven-issue batch rather than
avoiding it.
Before fixing
Measure per literal kind, per grammar, the way #1410 and #1462 did: a fixture
per kind, the kind read from bca dump, abc.conditions against an
identifier control at the same cyclomatic. Do not work from inspection —
#1462's inspected list was correct as far as it went but incomplete by
eleven kinds.
Then measure the snapshot delta before accepting, and state what counts as
disproportionate in advance.
Note the set is name-keyed, so a typo is a silent no-op rather than a compile
error, and an arm added for Objective-C is inert for the other three (as
"message_expression" and "available_expression" already are).
Related
Summary
The C family (C, C++, Mozcpp, Objective-C) carries the same non-numeric
truthy-literal gap #1462 closed for eleven other languages. It was
deliberately deferred there, and the reason is the reason it needs its
own issue: it is the one integer-truthy group with real corpus exposure.
The gap
cpp_bool_terminal_kinds!(big-code-analysis-ast/src/macros/kind_sets.rs)is the one name-keyed set — it alternates node-kind name strings, so it
serves all four C-family grammars despite their differing kind ids. It lists
"number_literal"and"char_literal"(added by #1410) but not"string_literal","concatenated_string"or"nullptr".C treats any non-zero value as true, so
if ("s")andx || "default"arethe same shape #1462 fixed everywhere else.
Why it was deferred
Corpus cost. The snapshot corpora are C/C++ 1,042, JS 384, Rust 172,
PHP 6, C# 6 — so this is the single largest exposure in the tree, and #1462
already moved 85 of 384 pdf.js snapshots for the JS half alone. Deferring it
kept that measurement separate from an eleven-issue batch rather than
avoiding it.
Before fixing
Measure per literal kind, per grammar, the way #1410 and #1462 did: a fixture
per kind, the kind read from
bca dump,abc.conditionsagainst anidentifier control at the same
cyclomatic. Do not work from inspection —#1462's inspected list was correct as far as it went but incomplete by
eleven kinds.
Then measure the snapshot delta before accepting, and state what counts as
disproportionate in advance.
Note the set is name-keyed, so a typo is a silent no-op rather than a compile
error, and an arm added for Objective-C is inert for the other three (as
"message_expression"and"available_expression"already are).Related
cpp_bool_terminal_kinds!comment records the deferral.