Removed --std=posix. From now on, if you use --library=posix then the posix checks will be enabled.
This commit is contained in:
parent
dfe417c369
commit
cb06aebdab
|
@ -593,7 +593,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
|
||||
// --std
|
||||
else if (std::strcmp(argv[i], "--std=posix") == 0) {
|
||||
mSettings->standards.posix = true;
|
||||
printMessage("cppcheck: Option --std=posix is deprecated and will be removed in 1.95.");
|
||||
} else if (std::strcmp(argv[i], "--std=c89") == 0) {
|
||||
mSettings->standards.c = Standards::C89;
|
||||
} else if (std::strcmp(argv[i], "--std=c99") == 0) {
|
||||
|
@ -1084,8 +1084,6 @@ void CmdLineParser::printHelp()
|
|||
#endif
|
||||
" --std=<id> Set standard.\n"
|
||||
" The available options are:\n"
|
||||
" * posix\n"
|
||||
" POSIX compatible code\n"
|
||||
" * c89\n"
|
||||
" C code is C89 compatible\n"
|
||||
" * c99\n"
|
||||
|
@ -1098,8 +1096,6 @@ void CmdLineParser::printHelp()
|
|||
" C++ code is C++11 compatible\n"
|
||||
" * c++14\n"
|
||||
" C++ code is C++14 compatible (default)\n"
|
||||
" More than one --std can be used:\n"
|
||||
" 'cppcheck --std=c99 --std=posix file.c'\n"
|
||||
" --suppress=<spec> Suppress warnings that match <spec>. The format of\n"
|
||||
" <spec> is:\n"
|
||||
" [error id]:[filename]:[line]\n"
|
||||
|
|
|
@ -823,7 +823,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
|
|||
}
|
||||
|
||||
bool posix = true;
|
||||
if (settings.standards.posix)
|
||||
if (settings.posix())
|
||||
posix = tryLoadLibrary(settings.library, argv[0], "posix.cfg");
|
||||
bool windows = true;
|
||||
if (settings.isWindowsPlatform())
|
||||
|
|
|
@ -153,7 +153,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
|
|||
return New;
|
||||
}
|
||||
|
||||
if (mSettings_->standards.posix) {
|
||||
if (mSettings_->posix()) {
|
||||
if (Token::Match(tok2, "open|openat|creat|mkstemp|mkostemp|socket (")) {
|
||||
// simple sanity check of function parameters..
|
||||
// TODO: Make such check for all these functions
|
||||
|
@ -255,7 +255,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok
|
|||
if (tok->str() == "realloc" && Token::simpleMatch(vartok->next(), ", 0 )"))
|
||||
return Malloc;
|
||||
|
||||
if (mSettings_->standards.posix) {
|
||||
if (mSettings_->posix()) {
|
||||
if (tok->str() == "close")
|
||||
return Fd;
|
||||
if (tok->str() == "pclose")
|
||||
|
|
|
@ -377,7 +377,7 @@ void CheckOther::invalidPointerCastError(const Token* tok, const std::string& fr
|
|||
//---------------------------------------------------------------------------
|
||||
void CheckOther::checkPipeParameterSize()
|
||||
{
|
||||
if (!mSettings->standards.posix)
|
||||
if (!mSettings->posix())
|
||||
return;
|
||||
|
||||
const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase();
|
||||
|
|
|
@ -176,6 +176,10 @@ public:
|
|||
/** @brief Using -E for debugging purposes */
|
||||
bool preprocessOnly;
|
||||
|
||||
bool posix() const {
|
||||
return std::find(libraries.begin(), libraries.end(), "posix") != libraries.end();
|
||||
}
|
||||
|
||||
/** @brief List of include paths, e.g. "my/includes/" which should be used
|
||||
for finding include files inside source files. (-I) */
|
||||
std::list<std::string> includePaths;
|
||||
|
|
|
@ -38,11 +38,8 @@ struct Standards {
|
|||
/** C++ code standard */
|
||||
enum cppstd_t { CPP03, CPP11, CPP14, CPPLatest=CPP14 } cpp;
|
||||
|
||||
/** Code is posix */
|
||||
bool posix;
|
||||
|
||||
/** This constructor clear all the variables **/
|
||||
Standards() : c(C11), cpp(CPP14), posix(false) {}
|
||||
Standards() : c(C11), cpp(CPP14) {}
|
||||
|
||||
bool setC(const std::string& str) {
|
||||
if (str == "c89" || str == "C89") {
|
||||
|
|
Loading…
Reference in New Issue