"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/checkleakautovar.h" 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.

checkleakautovar.h  (cppcheck-1.86):checkleakautovar.h  (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 104 skipping to change at line 104
/** This constructor is used when registering the CheckLeakAutoVar */ /** This constructor is used when registering the CheckLeakAutoVar */
CheckLeakAutoVar() : Check(myName()) { CheckLeakAutoVar() : Check(myName()) {
} }
/** This constructor is used when running checks. */ /** This constructor is used when running checks. */
CheckLeakAutoVar(const Tokenizer *tokenizer, const Settings *settings, Error Logger *errorLogger) CheckLeakAutoVar(const Tokenizer *tokenizer, const Settings *settings, Error Logger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger) { : Check(myName(), tokenizer, settings, errorLogger) {
} }
/** @brief Run checks against the simplified token list */ /** @brief Run checks against the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *setting s, ErrorLogger *errorLogger) override { void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *setting s, ErrorLogger *errorLogger) OVERRIDE {
CheckLeakAutoVar checkLeakAutoVar(tokenizer, settings, errorLogger); CheckLeakAutoVar checkLeakAutoVar(tokenizer, settings, errorLogger);
checkLeakAutoVar.check(); checkLeakAutoVar.check();
} }
private: private:
/** check for leaks in all scopes */ /** check for leaks in all scopes */
void check(); void check();
/** check for leaks in a function scope */ /** check for leaks in a function scope */
skipping to change at line 147 skipping to change at line 147
void leakError(const Token* tok, const std::string &varname, int type); void leakError(const Token* tok, const std::string &varname, int type);
void mismatchError(const Token* tok, const std::string &varname); void mismatchError(const Token* tok, const std::string &varname);
void deallocUseError(const Token *tok, const std::string &varname); void deallocUseError(const Token *tok, const std::string &varname);
void deallocReturnError(const Token *tok, const std::string &varname); void deallocReturnError(const Token *tok, const std::string &varname);
void doubleFreeError(const Token *tok, const std::string &varname, int type) ; void doubleFreeError(const Token *tok, const std::string &varname, int type) ;
/** message: user configuration is needed to complete analysis */ /** message: user configuration is needed to complete analysis */
void configurationInfo(const Token* tok, const std::string &functionName); void configurationInfo(const Token* tok, const std::string &functionName);
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) co nst override { void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) co nst OVERRIDE {
CheckLeakAutoVar c(nullptr, settings, errorLogger); CheckLeakAutoVar c(nullptr, settings, errorLogger);
c.deallocReturnError(nullptr, "p"); c.deallocReturnError(nullptr, "p");
c.configurationInfo(nullptr, "f"); // user configuration is needed to c omplete analysis c.configurationInfo(nullptr, "f"); // user configuration is needed to c omplete analysis
c.doubleFreeError(nullptr, "varname", 0); c.doubleFreeError(nullptr, "varname", 0);
} }
static std::string myName() { static std::string myName() {
return "Leaks (auto variables)"; return "Leaks (auto variables)";
} }
std::string classInfo() const override { std::string classInfo() const OVERRIDE {
return "Detect when a auto variable is allocated but not deallocated or deallocated twice.\n"; return "Detect when a auto variable is allocated but not deallocated or deallocated twice.\n";
} }
}; };
/// @} /// @}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#endif // checkleakautovarH #endif // checkleakautovarH
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

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