Repository navigation
Commit ce90abd
committed
Rule 5.13.4: Remove false positives in macro expansions
The CodeQL extractor does not preserve the source spelling of literals
expanded from a macro: getValueText() either drops the suffix (e.g. `0U`
becomes `0`) or returns the text of the whole macro invocation. As a
result, correctly suffixed literals such as `TEST_MACRO(1U == 0U)` were
reported as missing a `U` suffix.
Exclude literals generated by macro expansions, consistent with the fix
for RULE-7-2 (#705). Unsuffixed literals in
macro expansions are now a known false negative, documented in the test.
This also applies to M2-13-3, which shares the query.1 parent fe0dc9a commit ce90abd
3 files changed
Lines changed: 13 additions & 0 deletions
File tree
- change_notes
- cpp/common
- src/codingstandards/cpp/rules/unsignedintegerliteralsnotappropriatelysuffixed
- test/rules/unsignedintegerliteralsnotappropriatelysuffixed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
0 commit comments