Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const Setting

FunctionUsage &usage = mFunctions[stripTemplateParameters(func->name())];

if (func->retDef && (func->retDef->isAttributeUnused() || func->retDef->isAttributeMaybeUnused())) {
usage.usedOtherFile = true;
}

if (!usage.lineNumber)
usage.lineNumber = func->token->linenr();

Expand Down
4 changes: 4 additions & 0 deletions test/testunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ class TestUnusedFunctions : public TestFixture {
// #10661
check("extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) { return 0; }\n");
ASSERT_EQUALS("", errout_str());

check("[[maybe_unused]] void f() {}\n" // #13268
"__attribute__((unused)) void g() {}\n");
ASSERT_EQUALS("", errout_str());
}

void initializer_list() {
Expand Down