Skip to content

Commit 2a611a1

Browse files
authored
Merge branch 'main' into rvermeulen/fix-368
2 parents 66e3c3b + 4d804eb commit 2a611a1

38 files changed

+264
-100
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* `A7-1-1` - no longer report parameters as contravening this rule. This is inline with the rule intent as described in the referenced C++ Core Guidelines rule [CON.1](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#con1-by-default-make-objects-immutable), which states "To avoid confusion and lots of false positives, don’t enforce this rule for function parameters."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- `A3-9-1` - `VariableWidthIntegerTypesUsed.ql`:
2+
- Exclude the plain char type. Still includes `signed char` and `unsigned char`.
3+
- Include CV-qualified variable width integer types.
4+
- `A3-9-1` - `VariableWidthPlainCharTypeUsed.ql`:
5+
- New query to support fine grained deviation support for the plain char type.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`A2-3-1`: ` cpp/autosar/invalid-character-in-string-literal`
2+
- Fixes #311. Exclude wide string literals and utf8 string literal.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`M9-3-3` - `MemberFunctionConstIfPossible.ql`, `MemberFunctionStaticIfPossible.ql`:
2+
- Fixes #413. Exclude deleted member functions.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
`A8-4-7` - `InParametersForCheapToCopyTypesNotPassedByValue.ql`, `InParametersForNotCheapToCopyTypesNotPassedByReference.ql`:
2+
- Fixes #397. Exclude user defined operators and move constructors.`
3+
- Exclude parameters for instantiated templates because the declaration location of the function does not contain enough information about the type used in the instantiation to make an actionable alert.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`A5-0-2` - `NonBooleanIfStmt.qll`, `NonBooleanIterationStmt.qll`:
2+
- Exclude compiler generated conditions.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`M9-3-3`: `MemberFunctionConstIfPossible.ql`:
2+
- Fix FP reported in 467. Excluding candidates in uninstantiated templates.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`A7-1-1` - `DeclarationUnmodifiedObjectMissingConstSpecifier.ql`
2+
- Fix FP reported in #372. Exclude compiler generated variables.

cpp/autosar/src/rules/A2-3-1/InvalidCharacterInStringLiteral.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import cpp
1919
import codingstandards.cpp.autosar
20+
import codingstandards.cpp.Literals
2021

2122
bindingset[s]
2223
string getCharOutsideBasicSourceCharSet(string s) {
@@ -27,6 +28,9 @@ string getCharOutsideBasicSourceCharSet(string s) {
2728
from StringLiteral s, string ch
2829
where
2930
not isExcluded(s, NamingPackage::invalidCharacterInStringLiteralQuery()) and
30-
ch = getCharOutsideBasicSourceCharSet(s.getValueText())
31+
ch = getCharOutsideBasicSourceCharSet(s.getValueText()) and
32+
// wide string and utf8 string literals are exempted.
33+
not s instanceof WideStringLiteral and
34+
not s instanceof Utf8StringLiteral
3135
select s,
3236
"String literal uses the character '" + ch + "' that is outside the language basic character set."

cpp/autosar/src/rules/A3-9-1/VariableWidthIntegerTypesUsed.ql

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* @id cpp/autosar/variable-width-integer-types-used
33
* @name A3-9-1: Use fixed-width integer types instead of basic, variable-width, integer types
4-
* @description The basic numerical types of char, int, short, long are not supposed to be used. The
5-
* specific-length types from <cstdint> header need be used instead.
4+
* @description The basic numerical types of signed/unsigned char, int, short, long are not supposed
5+
* to be used. The specific-length types from <cstdint> header need be used instead.
66
* @kind problem
77
* @precision very-high
88
* @problem.severity error
@@ -19,15 +19,16 @@ import cpp
1919
import codingstandards.cpp.autosar
2020
import codingstandards.cpp.EncapsulatingFunctions
2121
import codingstandards.cpp.BuiltInNumericTypes
22+
import codingstandards.cpp.Type
2223

23-
from Variable v
24+
from Variable v, Type typeStrippedOfSpecifiers
2425
where
2526
not isExcluded(v, DeclarationsPackage::variableWidthIntegerTypesUsedQuery()) and
27+
typeStrippedOfSpecifiers = stripSpecifiers(v.getType()) and
2628
(
27-
v.getType() instanceof BuiltInIntegerType or
28-
v.getType() instanceof PlainCharType or
29-
v.getType() instanceof UnsignedCharType or
30-
v.getType() instanceof SignedCharType
29+
typeStrippedOfSpecifiers instanceof BuiltInIntegerType or
30+
typeStrippedOfSpecifiers instanceof UnsignedCharType or
31+
typeStrippedOfSpecifiers instanceof SignedCharType
3132
) and
3233
not v instanceof ExcludedVariable
3334
select v, "Variable '" + v.getName() + "' has variable-width type."

0 commit comments

Comments
 (0)