You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A5-2-2: Exclude results in uninstantiated templates, explain limitations (#160)
* A5-2-2: Clarify c-style casts scope, exclude templates
Clarify what `CStyleCast` does and does not cover by adding a comment,
expanding the test case and providing an implementation scope. In
addition, exclude casts on template parameters to avoid unnecessary
false positives.
* A5-2-2: Exclude uninstantiated templates
Any cast in an uninstantiated template that is related to the template
parameter may be converted to a `ConstructorCall` when the template is
instantiated. To avoid the common false positive case where the
functional cast notation is used to call a constructor, we exclude all
results in uninstantiated templates and instead rely on reporting
results in template instantiations instead.
---------
Co-authored-by: Mauro Baluda <mbaluda@github.com>
-`CStyleCasts.ql` - exclude template parameters to avoid false positives when using the "functional notation" syntax. In addition, provide a greater explanation on limitations of this query.
Copy file name to clipboardExpand all lines: cpp/autosar/test/rules/A5-2-2/TraditionalCStyleCastsUsed.expected
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,3 +5,5 @@
5
5
| test.cpp:79:3:79:18 | (int)... | Use of explicit c-style cast to int generated from macro $@. | test.cpp:71:1:71:36 | #define NESTED_ADD_ONE(x) ADD_ONE(x) | NESTED_ADD_ONE |
6
6
| test.cpp:85:19:85:26 | (int)... | Use of explicit c-style cast to int. | test.cpp:85:19:85:26 | (int)... | |
7
7
| test.cpp:86:27:86:34 | (int)... | Use of explicit c-style cast to int. | test.cpp:86:27:86:34 | (int)... | |
8
+
| test.cpp:114:10:114:13 | (int)... | Use of explicit c-style cast to int. | test.cpp:114:10:114:13 | (int)... | |
9
+
| test.cpp:149:12:149:26 | (unsigned int)... | Use of explicit c-style cast to unsigned int. | test.cpp:149:12:149:26 | (unsigned int)... | |
0 commit comments