File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
cpp/common/test/rules/unusedparameter Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
// NOTICE: SOME OF THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C TEST CASE AND
2
2
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3
3
4
+ #include < tuple>
5
+
4
6
int test_used (int x) { return x; } // COMPLIANT
5
7
6
8
void test_unused (int x) {} // NON_COMPLIANT
@@ -16,4 +18,16 @@ class A {
16
18
virtual void d (int x, int y) {} // virtual, not covered by this rule
17
19
};
18
20
21
+ void f (
22
+ int i,
23
+ int j,
24
+ int k,
25
+ [[maybe_unused]]
26
+ int l // NON_COMPILANT: maybe_unused parameters should also be considered unused
27
+ ) {
28
+ static_cast <void >(i); // NON_COMPILANT: static_cast to void should also be considered unused
29
+ (void )j; // NON_COMPILANT: C-style void casts should also be considered unused
30
+ std::ignore = k; // NON_COMPILANT: Assignment to std::ignore should also be considered unused
31
+ }
32
+
19
33
void test_no_def (int x); // COMPLIANT - no definition, so cannot be "unused"
You can’t perform that action at this time.
0 commit comments