Warn about usage of --suppressions or --exitcode-suppressions (they are deprecated)
Removed two redundant strncmp calls
This commit is contained in:
parent
176b3925b3
commit
40a6941577
|
@ -180,12 +180,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
||||||
std::string filename;
|
std::string filename;
|
||||||
|
|
||||||
// exitcode-suppressions filename.txt
|
// exitcode-suppressions filename.txt
|
||||||
// Deprecated
|
|
||||||
if (std::strcmp(argv[i], "--exitcode-suppressions") == 0) {
|
if (std::strcmp(argv[i], "--exitcode-suppressions") == 0) {
|
||||||
++i;
|
// This is deprecated and will be removed soon
|
||||||
|
PrintMessage("cppcheck: '--exitcode-suppressions <file>' is deprecated, use '--exitcode-suppressions=<file>' instead.");
|
||||||
|
|
||||||
if (i >= argc || std::strncmp(argv[i], "-", 1) == 0 ||
|
++i;
|
||||||
std::strncmp(argv[i], "--", 2) == 0) {
|
if (i >= argc || argv[i][0] == '-') {
|
||||||
PrintMessage("cppcheck: No filename specified for the '--exitcode-suppressions' option.");
|
PrintMessage("cppcheck: No filename specified for the '--exitcode-suppressions' option.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,10 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter errors
|
|
||||||
// This is deprecated, see --suppressions-list above
|
|
||||||
else if (std::strcmp(argv[i], "--suppressions") == 0) {
|
else if (std::strcmp(argv[i], "--suppressions") == 0) {
|
||||||
|
// This is deprecated and will be removed soon
|
||||||
|
PrintMessage("cppcheck: '--suppressions' is deprecated, use '--suppressions-list' instead.");
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
if (i >= argc) {
|
if (i >= argc) {
|
||||||
|
@ -756,7 +757,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (std::strncmp(argv[i], "-", 1) == 0 || std::strncmp(argv[i], "--", 2) == 0) {
|
else if (argv[i][0] == '-') {
|
||||||
std::string message("cppcheck: error: unrecognized command line option: \"");
|
std::string message("cppcheck: error: unrecognized command line option: \"");
|
||||||
message += argv[i];
|
message += argv[i];
|
||||||
message += "\".";
|
message += "\".";
|
||||||
|
@ -810,7 +811,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
|
||||||
|
|
||||||
void CmdLineParser::PrintHelp()
|
void CmdLineParser::PrintHelp()
|
||||||
{
|
{
|
||||||
std::cout << "Cppcheck - A tool for static C/C++ code analysis\n"
|
std::cout << "Cppcheck - A tool for static C/C++ code analysis\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Syntax:\n"
|
"Syntax:\n"
|
||||||
" cppcheck [OPTIONS] [files or paths]\n"
|
" cppcheck [OPTIONS] [files or paths]\n"
|
||||||
|
@ -824,6 +825,13 @@ void CmdLineParser::PrintHelp()
|
||||||
" analysis is disabled by this flag.\n"
|
" analysis is disabled by this flag.\n"
|
||||||
" --check-library Show information messages when library files have\n"
|
" --check-library Show information messages when library files have\n"
|
||||||
" incomplete info.\n"
|
" incomplete info.\n"
|
||||||
|
" --config-exclude=<dir>\n"
|
||||||
|
" Path (prefix) to be excluded from configuration checking.\n"
|
||||||
|
" Preprocessor configurations defined in headers (but not sources)\n"
|
||||||
|
" matching the prefix will not be considered for evaluation\n"
|
||||||
|
" of configuration alternatives\n"
|
||||||
|
" --config-excludes-file=<file>\n"
|
||||||
|
" A file that contains a list of config-excludes\n"
|
||||||
" --dump Dump xml data for each translation unit. The dump\n"
|
" --dump Dump xml data for each translation unit. The dump\n"
|
||||||
" files have the extension .dump and contain ast,\n"
|
" files have the extension .dump and contain ast,\n"
|
||||||
" tokenlist, symboldatabase, valueflow.\n"
|
" tokenlist, symboldatabase, valueflow.\n"
|
||||||
|
@ -886,13 +894,6 @@ void CmdLineParser::PrintHelp()
|
||||||
" First given path is searched for contained header\n"
|
" First given path is searched for contained header\n"
|
||||||
" files first. If paths are relative to source files,\n"
|
" files first. If paths are relative to source files,\n"
|
||||||
" this is not needed.\n"
|
" this is not needed.\n"
|
||||||
" --config-exclude=<dir>\n"
|
|
||||||
" Path (prefix) to be excluded from configuration checking.\n"
|
|
||||||
" Preprocessor configurations defined in headers (but not sources)\n"
|
|
||||||
" matching the prefix will not be considered for evaluation\n"
|
|
||||||
" of configuration alternatives\n"
|
|
||||||
" --config-excludes-file=<file>\n"
|
|
||||||
" A file that contains a list of config-excludes\n"
|
|
||||||
" --include=<file>\n"
|
" --include=<file>\n"
|
||||||
" Force inclusion of a file before the checked file. Can\n"
|
" Force inclusion of a file before the checked file. Can\n"
|
||||||
" be used for example when checking the Linux kernel,\n"
|
" be used for example when checking the Linux kernel,\n"
|
||||||
|
|
|
@ -563,7 +563,7 @@ uninitvar</programlisting>
|
||||||
|
|
||||||
<para>You can use the suppressions file like this:</para>
|
<para>You can use the suppressions file like this:</para>
|
||||||
|
|
||||||
<programlisting>cppcheck --suppressions suppressions.txt src/</programlisting>
|
<programlisting>cppcheck --suppressions-list=suppressions.txt src/</programlisting>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue