Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions change_notes/2026-05-21-fix-fp-rule-5-13-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- `RULE-5-13-4` - `cpp/misra/unsigned-integer-literals-not-appropriately-suffixed`:
- Remove FPs in user-defined literals and template instantiations.
- `M2-13-3` - `cpp/autosar/missing-u-suffix`:
- Remove FPs in user-defined literals and template instantiations.

13 changes: 12 additions & 1 deletion cpp/common/src/codingstandards/cpp/Cpp14Literal.qll
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@
*/
module Cpp14Literal {
private import cpp as StandardLibrary
private import codingstandards.cpp.UserDefinedLiteral

/** An numeric literal. */
abstract class NumericLiteral extends StandardLibrary::Literal { }
abstract class NumericLiteral extends StandardLibrary::Literal {
NumericLiteral() {
// exclude user-defined literals as they define custom suffixes
not exists(StandardLibrary::FunctionCall fc |
this = fc.getArgument(0) and
fc.getTarget() instanceof UserDefinedLiteral
) and
// exclude literals derived from template instantiations
not this.isFromTemplateInstantiation(_)
Comment on lines +11 to +19
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests would require a c++20 build

}
}

/** Convenience for implementing class `UnrecognizedNumericLiteral` */
abstract private class RecognizedNumericLiteral extends StandardLibrary::Literal { }
Expand Down
Loading