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
3 changes: 3 additions & 0 deletions lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
if (func->isAttributeConstructor() || func->isAttributeDestructor() || func->type != Function::eFunction || func->isOperator())
continue;

if (func->isExtern())
continue;

// Don't care about templates
if (tokenizer.isCPP() && func->templateDef != nullptr)
continue;
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,7 @@ const Token *Function::setFlags(const Token *tok1, const Scope *scope)
isInlineKeyword(true);

// extern function
if (tok1->str() == "extern") {
if (tok1->isExternC() || tok1->str() == "extern") {
isExtern(true);
}

Expand Down
4 changes: 4 additions & 0 deletions test/testunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ class TestUnusedFunctions : public TestFixture {
// Don't crash on wrong syntax
check("int x __attribute__((constructor));\n"
"int y __attribute__((destructor));");

// #10661
check("extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) { return 0; }\n");
ASSERT_EQUALS("", errout.str());
}

void initializer_list() {
Expand Down