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 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+
46int test_used (int x) { return x; } // COMPLIANT
57
68void 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+
1933void test_no_def (int x); // COMPLIANT - no definition, so cannot be "unused"
You can’t perform that action at this time.
0 commit comments