Skip to content

Commit f5a1fc2

Browse files
committed
Address review comments
1 parent 17f3a32 commit f5a1fc2

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `M0-1-3` - `UnusedGlobalOrNamespaceVariable.ql`
2+
- Reduces false positives by excluding compiler generated variables, and variables in uninstantiated templates.

cpp/autosar/test/rules/M0-1-3/test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ template <bool... Args> extern constexpr bool all_of_v = true; // COMPLIANT
8383

8484
template <bool B1, bool... Args>
8585
extern constexpr bool all_of_v<B1, Args...> =
86-
B1 && all_of_v<Args...>; // COMPLIANT
86+
B1 &&all_of_v<Args...>; // COMPLIANT
8787

8888
void test_template_variable() { all_of_v<true, true, true>; }
8989

cpp/common/src/codingstandards/cpp/deadcode/UnusedVariables.qll

+5-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ class PotentiallyUnusedLocalVariable extends LocalVariable {
4848
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
4949
// Ignore functions with error expressions as they indicate expressions that the extractor couldn't process
5050
not any(ErrorExpr e).getEnclosingFunction() = f
51-
)
52-
// ) and
53-
// // exclude uninstantiated template members
54-
// not this.isFromUninstantiatedTemplate(_) and
55-
// // Do not report compiler generated variables
56-
// not this.isCompilerGenerated()
51+
) and
52+
// exclude uninstantiated template members
53+
not this.isFromUninstantiatedTemplate(_) and
54+
// Do not report compiler generated variables
55+
not this.isCompilerGenerated()
5756
}
5857
}
5958

0 commit comments

Comments
 (0)