Add --posix CLI option.
Part of ticket #2949 (new check: (style) finding non-reentrant functions)
This commit is contained in:
parent
6b23dd9928
commit
a50f75ef86
|
@ -460,6 +460,13 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
|||
}
|
||||
}
|
||||
|
||||
// Posix compliant code checks
|
||||
else if (strcmp(argv[i], "--posix") == 0)
|
||||
{
|
||||
_settings->_posix = true;
|
||||
}
|
||||
|
||||
|
||||
// deprecated: auto deallocated classes..
|
||||
else if (strcmp(argv[i], "--auto-dealloc") == 0)
|
||||
{
|
||||
|
@ -682,6 +689,7 @@ void CmdLineParser::PrintHelp()
|
|||
" more comments, like: // cppcheck-suppress warningId\n"
|
||||
" on the lines before the warning to suppress.\n"
|
||||
" -j <jobs> Start [jobs] threads to do the checking simultaneously.\n"
|
||||
" --posix Enable checks applicable only to Posix compliant code.\n"
|
||||
" -q, --quiet Only print error messages.\n"
|
||||
" --report-progress Report progress messages while checking a file.\n"
|
||||
#ifdef HAVE_RULES
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
TEST_CASE(ignorefilepaths1)
|
||||
TEST_CASE(ignorefilepaths2)
|
||||
TEST_CASE(checkconfig)
|
||||
TEST_CASE(posix);
|
||||
TEST_CASE(unknownParam);
|
||||
}
|
||||
|
||||
|
@ -812,6 +813,16 @@ private:
|
|||
ASSERT_EQUALS(true, settings.checkConfiguration);
|
||||
}
|
||||
|
||||
void posix()
|
||||
{
|
||||
REDIRECT;
|
||||
const char *argv[] = {"cppcheck", "--posix", "file.cpp"};
|
||||
Settings settings;
|
||||
CmdLineParser parser(&settings);
|
||||
ASSERT(parser.ParseFromArgs(3, argv));
|
||||
ASSERT_EQUALS(true, settings._posix);
|
||||
}
|
||||
|
||||
void unknownParam()
|
||||
{
|
||||
REDIRECT;
|
||||
|
|
Loading…
Reference in New Issue