Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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 tamplate instantiations.
- `M2-13-3` - `cpp/autosar/missing-u-suffix`:
- Remove FPs in user-defined literals and tamplate instantiations.
Comment thread
mbaluda marked this conversation as resolved.
Outdated

11 changes: 10 additions & 1 deletion cpp/common/src/codingstandards/cpp/Cpp14Literal.qll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ module Cpp14Literal {
private import cpp as StandardLibrary

/** An numeric literal. */
Comment thread
mbaluda marked this conversation as resolved.
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().getName().matches("operator \"\"%")
Comment thread
mbaluda marked this conversation as resolved.
Outdated
) 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