Skip to content

Commit 47805d8

Browse files
committed
update
1 parent 3bdc76d commit 47805d8

File tree

1 file changed

+14
-0
lines changed
  • cpp/common/test/rules/unusedparameter

1 file changed

+14
-0
lines changed

cpp/common/test/rules/unusedparameter/test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// NOTICE: SOME OF THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C TEST CASE AND
22
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
33

4+
#include <tuple>
5+
46
int test_used(int x) { return x; } // COMPLIANT
57

68
void test_unused(int x) {} // NON_COMPLIANT
@@ -16,4 +18,16 @@ class A {
1618
virtual void d(int x, int y) {} // virtual, not covered by this rule
1719
};
1820

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+
1933
void test_no_def(int x); // COMPLIANT - no definition, so cannot be "unused"

0 commit comments

Comments
 (0)