Command line: Added --std option. Right now only --std=posix is possible but other options might be added later.
This commit is contained in:
parent
aecf9fadcd
commit
afed93d7d6
|
@ -409,6 +409,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
|||
_settings->reportProgress = true;
|
||||
}
|
||||
|
||||
// --std
|
||||
else if (strcmp(argv[i], "--std=posix") == 0)
|
||||
{
|
||||
_settings->posix = true;
|
||||
}
|
||||
|
||||
// Output formatter
|
||||
else if (strcmp(argv[i], "--template") == 0)
|
||||
{
|
||||
|
@ -700,6 +706,8 @@ void CmdLineParser::PrintHelp()
|
|||
" https://sourceforge.net/projects/cppcheck/files/Articles/\n"
|
||||
#endif
|
||||
" -s, --style Deprecated, use --enable=style\n"
|
||||
" --std=posix Code is posix => it is not compatible with non-posix\n"
|
||||
" environments.\n"
|
||||
" --suppress=<spec> Suppress warnings that match <spec>. The format of\n"
|
||||
" <spec> is:\n"
|
||||
" [error id]:[filename]:[line]\n"
|
||||
|
|
|
@ -304,7 +304,7 @@ public:
|
|||
/** Is the 'configuration checking' wanted? */
|
||||
bool checkConfiguration;
|
||||
|
||||
/** Posix checks */
|
||||
/** Code is posix - it is not compatible with non-posix environments */
|
||||
bool posix;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ private:
|
|||
TEST_CASE(jobsMissingCount);
|
||||
TEST_CASE(jobsInvalid);
|
||||
TEST_CASE(reportProgress);
|
||||
TEST_CASE(stdposix);
|
||||
TEST_CASE(suppressionsOld); // TODO: Create and test real suppression file
|
||||
TEST_CASE(suppressions);
|
||||
TEST_CASE(suppressionsNoFile);
|
||||
|
@ -543,6 +544,16 @@ private:
|
|||
ASSERT(settings.reportProgress);
|
||||
}
|
||||
|
||||
void stdposix()
|
||||
{
|
||||
REDIRECT;
|
||||
const char *argv[] = {"cppcheck", "--std=posix", "file.cpp"};
|
||||
Settings settings;
|
||||
CmdLineParser parser(&settings);
|
||||
ASSERT(parser.ParseFromArgs(3, argv));
|
||||
ASSERT(settings.posix);
|
||||
}
|
||||
|
||||
void suppressionsOld()
|
||||
{
|
||||
// TODO: Fails because there is no suppr.txt file!
|
||||
|
|
Loading…
Reference in New Issue