Settings: Removed the --enable=posix option. Ticket: #2949
This commit is contained in:
parent
315112314c
commit
01b9c0707d
|
@ -660,9 +660,6 @@ void CmdLineParser::PrintHelp()
|
||||||
" * missingInclude\n"
|
" * missingInclude\n"
|
||||||
" Warn if there are missing includes.\n"
|
" Warn if there are missing includes.\n"
|
||||||
" For detailed information use --check-config\n"
|
" For detailed information use --check-config\n"
|
||||||
" * posix\n"
|
|
||||||
" Enable checks specific for POSIX-compiliant\n"
|
|
||||||
" code.\n"
|
|
||||||
" Several ids can be given if you separate them with\n"
|
" Several ids can be given if you separate them with\n"
|
||||||
" commas.\n"
|
" commas.\n"
|
||||||
" --error-exitcode=<n> If errors are found, integer [n] is returned instead\n"
|
" --error-exitcode=<n> If errors are found, integer [n] is returned instead\n"
|
||||||
|
|
|
@ -33,7 +33,7 @@ CheckNonReentrantFunctions instance;
|
||||||
|
|
||||||
void CheckNonReentrantFunctions::nonReentrantFunctions()
|
void CheckNonReentrantFunctions::nonReentrantFunctions()
|
||||||
{
|
{
|
||||||
if (!_settings->isEnabled("posix") || !_settings->isEnabled("style"))
|
if (!_settings->posix || !_settings->isEnabled("style"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't check C# and Java code
|
// Don't check C# and Java code
|
||||||
|
|
|
@ -40,8 +40,6 @@ void CheckObsoleteFunctions::obsoleteFunctions()
|
||||||
if (_tokenizer->isJavaOrCSharp())
|
if (_tokenizer->isJavaOrCSharp())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool checkPosix = _settings->isEnabled("posix");
|
|
||||||
|
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (tok->isName() && tok->varId()==0 && tok->strAt(1) == "(" && !Token::Match(tok->previous(), ".|::|:|,"))
|
if (tok->isName() && tok->varId()==0 && tok->strAt(1) == "(" && !Token::Match(tok->previous(), ".|::|:|,"))
|
||||||
|
@ -58,7 +56,7 @@ void CheckObsoleteFunctions::obsoleteFunctions()
|
||||||
reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second);
|
reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (checkPosix)
|
else if (_settings->posix)
|
||||||
{
|
{
|
||||||
it = _obsoletePosixFunctions.find(tok->str());
|
it = _obsoletePosixFunctions.find(tok->str());
|
||||||
if (it != _obsoletePosixFunctions.end())
|
if (it != _obsoletePosixFunctions.end())
|
||||||
|
|
|
@ -48,6 +48,7 @@ Settings::Settings()
|
||||||
reportProgress = false;
|
reportProgress = false;
|
||||||
ifcfg = false;
|
ifcfg = false;
|
||||||
checkConfiguration = false;
|
checkConfiguration = false;
|
||||||
|
posix = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Settings::Suppressions::parseFile(std::istream &istr)
|
std::string Settings::Suppressions::parseFile(std::istream &istr)
|
||||||
|
@ -393,7 +394,6 @@ std::string Settings::addEnabled(const std::string &str)
|
||||||
id.insert("missingInclude");
|
id.insert("missingInclude");
|
||||||
id.insert("unusedFunction");
|
id.insert("unusedFunction");
|
||||||
id.insert("information");
|
id.insert("information");
|
||||||
id.insert("posix");
|
|
||||||
|
|
||||||
if (str == "all")
|
if (str == "all")
|
||||||
{
|
{
|
||||||
|
|
|
@ -300,6 +300,9 @@ public:
|
||||||
|
|
||||||
/** Is the 'configuration checking' wanted? */
|
/** Is the 'configuration checking' wanted? */
|
||||||
bool checkConfiguration;
|
bool checkConfiguration;
|
||||||
|
|
||||||
|
/** Posix checks */
|
||||||
|
bool posix;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -62,7 +62,6 @@ private:
|
||||||
TEST_CASE(enabledStyle);
|
TEST_CASE(enabledStyle);
|
||||||
TEST_CASE(enabledUnusedFunction);
|
TEST_CASE(enabledUnusedFunction);
|
||||||
TEST_CASE(enabledMissingInclude);
|
TEST_CASE(enabledMissingInclude);
|
||||||
TEST_CASE(enablePosix);
|
|
||||||
TEST_CASE(errorExitcode);
|
TEST_CASE(errorExitcode);
|
||||||
TEST_CASE(errorExitcodeMissing);
|
TEST_CASE(errorExitcodeMissing);
|
||||||
TEST_CASE(errorExitcodeStr);
|
TEST_CASE(errorExitcodeStr);
|
||||||
|
@ -425,16 +424,6 @@ private:
|
||||||
ASSERT(settings.isEnabled("missingInclude"));
|
ASSERT(settings.isEnabled("missingInclude"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void enablePosix()
|
|
||||||
{
|
|
||||||
REDIRECT;
|
|
||||||
const char *argv[] = {"cppcheck", "--enable=posix", "file.cpp"};
|
|
||||||
Settings settings;
|
|
||||||
CmdLineParser parser(&settings);
|
|
||||||
ASSERT(parser.ParseFromArgs(3, argv));
|
|
||||||
ASSERT(settings.isEnabled("posix"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void errorExitcode()
|
void errorExitcode()
|
||||||
{
|
{
|
||||||
REDIRECT;
|
REDIRECT;
|
||||||
|
|
|
@ -38,15 +38,13 @@ private:
|
||||||
TEST_CASE(test_crypt);
|
TEST_CASE(test_crypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void check(const char code[])
|
void check(const char code[])
|
||||||
{
|
{
|
||||||
// Clear the error buffer..
|
// Clear the error buffer..
|
||||||
errout.str("");
|
errout.str("");
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.addEnabled("posix");
|
settings.posix = true;
|
||||||
settings.inconclusive = true;
|
|
||||||
settings.addEnabled("style");
|
settings.addEnabled("style");
|
||||||
|
|
||||||
// Tokenize..
|
// Tokenize..
|
||||||
|
|
|
@ -50,7 +50,6 @@ private:
|
||||||
TEST_CASE(testgets);
|
TEST_CASE(testgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void check(const char code[])
|
void check(const char code[])
|
||||||
{
|
{
|
||||||
// Clear the error buffer..
|
// Clear the error buffer..
|
||||||
|
@ -58,7 +57,7 @@ private:
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.addEnabled("style");
|
settings.addEnabled("style");
|
||||||
settings.addEnabled("posix");
|
settings.posix = true;
|
||||||
|
|
||||||
// Tokenize..
|
// Tokenize..
|
||||||
Tokenizer tokenizer(&settings, this);
|
Tokenizer tokenizer(&settings, this);
|
||||||
|
|
Loading…
Reference in New Issue