Skip to content

Commit 3e0eff6

Browse files
Update testunusedfunctions.cpp
1 parent 4380e22 commit 3e0eff6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/testunusedfunctions.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class TestUnusedFunctions : public TestFixture {
8686
TEST_CASE(attributeUnused);
8787
TEST_CASE(attributeMaybeUnused);
8888
TEST_CASE(staticFunction);
89+
TEST_CASE(unnamedArg);
8990
}
9091

9192
struct CheckOptions
@@ -827,6 +828,16 @@ class TestUnusedFunctions : public TestFixture {
827828
"}\n", dinit(CheckOptions, $.cpp = false));
828829
ASSERT_EQUALS("[test.c:1:6]: (style) The function 'f' should have static linkage since it is not used outside of its translation unit. [staticFunction]\n", errout_str());
829830
}
831+
832+
void unnamedArg()
833+
{
834+
check("struct S {\n"
835+
" void Type() {}\n"
836+
"};\n"
837+
"[[unused]] void f(Type) {}\n"
838+
"[[unused]] void g(Type, Type) {}\n");
839+
ASSERT_EQUALS("[test.cpp:2:10]: (style) The function 'Type' is never used. [unusedFunction]\n", errout_str());
840+
}
830841
};
831842

832843
REGISTER_TEST(TestUnusedFunctions)

0 commit comments

Comments
 (0)