"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/checkinternal.cpp" between
cppcheck-1.86.tar.gz and cppcheck-1.87.tar.gz

About: Cppcheck is a static analysis tool for C/C++ code. It checks for memory leaks, mismatching allocation-deallocation, buffer overrun, and many more.

checkinternal.cpp  (cppcheck-1.86):checkinternal.cpp  (cppcheck-1.87)
/* /*
* Cppcheck - A tool for static C/C++ code analysis * Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2018 Cppcheck team. * Copyright (C) 2007-2019 Cppcheck team.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 355 skipping to change at line 355
} }
} }
} }
void CheckInternal::checkStlUsage() void CheckInternal::checkStlUsage()
{ {
const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase(); const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase();
for (const Scope *scope : symbolDatabase->functionScopes) { for (const Scope *scope : symbolDatabase->functionScopes) {
for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) { for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
if (Token::simpleMatch(tok, ". emplace (")) if (Token::simpleMatch(tok, ". emplace ("))
reportError(tok, Severity::error, "internalStlUsage", "The 'empl ace' function shall be avoided for now. 'emplace_back' is fine"); reportError(tok, Severity::error, "internalStlUsage", "The 'empl ace' function shall be avoided for now. It is not available e.g. in Slackware 14 .0. 'emplace_back' is fine.");
//if (Token::simpleMatch(tok, ". back ( )") && tok->astOperand1() && tok->astOperand1()->valueType() && tok->astOperand1()->valueType()->container & & Token::simpleMatch(tok->astOperand1()->valueType()->container, "std :: string" )) //if (Token::simpleMatch(tok, ". back ( )") && tok->astOperand1() && tok->astOperand1()->valueType() && tok->astOperand1()->valueType()->container & & Token::simpleMatch(tok->astOperand1()->valueType()->container, "std :: string" ))
// reportError(tok, Severity::error, "internalStlUsage", "The 'std: :string::back()' function shall be avoided for now."); // reportError(tok, Severity::error, "internalStlUsage", "The 'std: :string::back()' function shall be avoided for now.");
} }
} }
} }
void CheckInternal::multiComparePatternError(const Token* tok, const std::string & pattern, const std::string &funcname) void CheckInternal::multiComparePatternError(const Token* tok, const std::string & pattern, const std::string &funcname)
{ {
reportError(tok, Severity::error, "multiComparePatternError", reportError(tok, Severity::error, "multiComparePatternError",
"Bad multicompare pattern (a %cmd% must be first unless it is %o r%,%op%,%cop%,%name%,%oror%) inside Token::" + funcname + "() call: \"" + patter n + "\"" "Bad multicompare pattern (a %cmd% must be first unless it is %o r%,%op%,%cop%,%name%,%oror%) inside Token::" + funcname + "() call: \"" + patter n + "\""
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)