fix #3127 ([False positive] _tmain function i VS 2010 project)
This commit is contained in:
parent
5e329d7280
commit
1dc7c0edf9
|
@ -161,7 +161,7 @@ void CheckUnusedFunctions::check(ErrorLogger * const errorLogger)
|
|||
const FunctionUsage &func = it->second;
|
||||
if (func.usedOtherFile || func.filename.empty())
|
||||
continue;
|
||||
if (it->first == "main" || it->first == "WinMain" || it->first == "if")
|
||||
if (it->first == "main" || it->first == "WinMain" || it->first == "_tmain" || it->first == "if")
|
||||
continue;
|
||||
if (! func.usedSameFile)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
TEST_CASE(template1);
|
||||
TEST_CASE(throwIsNotAFunction);
|
||||
TEST_CASE(unusedError);
|
||||
TEST_CASE(unusedMain);
|
||||
TEST_CASE(initializationIsNotAFunction);
|
||||
|
||||
TEST_CASE(multipleFiles); // same function name in multiple files
|
||||
|
@ -179,6 +180,18 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str());
|
||||
}
|
||||
|
||||
void unusedMain()
|
||||
{
|
||||
check("int main() { }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int _tmain() { }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int WinMain() { }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void initializationIsNotAFunction()
|
||||
{
|
||||
check("struct B: N::A {\n"
|
||||
|
|
Loading…
Reference in New Issue