"Fossies" - the Fresh Open Source Software Archive  

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

tokenlist.cpp  (cppcheck-1.86):tokenlist.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 81 skipping to change at line 81
} }
unsigned int TokenList::appendFileIfNew(const std::string &fileName) unsigned int TokenList::appendFileIfNew(const std::string &fileName)
{ {
// Has this file been tokenized already? // Has this file been tokenized already?
for (std::size_t i = 0; i < mFiles.size(); ++i) for (std::size_t i = 0; i < mFiles.size(); ++i)
if (Path::sameFileName(mFiles[i], fileName)) if (Path::sameFileName(mFiles[i], fileName))
return (unsigned int)i; return (unsigned int)i;
// The "mFiles" vector remembers what files have been tokenized.. // The "mFiles" vector remembers what files have been tokenized..
mFiles.push_back(Path::simplifyPath(fileName)); mFiles.push_back(fileName);
// Update mIsC and mIsCpp properties // Update mIsC and mIsCpp properties
if (mFiles.size() == 1) { // Update only useful if first file added to _file s if (mFiles.size() == 1) { // Update only useful if first file added to _file s
if (!mSettings) { if (!mSettings) {
mIsC = Path::isC(getSourceFilePath()); mIsC = Path::isC(getSourceFilePath());
mIsCpp = Path::isCPP(getSourceFilePath()); mIsCpp = Path::isCPP(getSourceFilePath());
} else { } else {
mIsC = mSettings->enforcedLang == Settings::C || (mSettings->enforce dLang == Settings::None && Path::isC(getSourceFilePath())); mIsC = mSettings->enforcedLang == Settings::C || (mSettings->enforce dLang == Settings::None && Path::isC(getSourceFilePath()));
mIsCpp = mSettings->enforcedLang == Settings::CPP || (mSettings->enf orcedLang == Settings::None && Path::isCPP(getSourceFilePath())); mIsCpp = mSettings->enforcedLang == Settings::CPP || (mSettings->enf orcedLang == Settings::None && Path::isCPP(getSourceFilePath()));
} }
skipping to change at line 591 skipping to change at line 591
tok = tok->next(); tok = tok->next();
if (tok->str() == "<") if (tok->str() == "<")
tok = tok->link()->next(); tok = tok->link()->next();
} else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(| [")) { } else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(| [")) {
tok = skipDecl(tok); tok = skipDecl(tok);
while (tok->next() && tok->next()->isName()) while (tok->next() && tok->next()->isName())
tok = tok->next(); tok = tok->next();
state.op.push(tok); state.op.push(tok);
if (Token::Match(tok, "%name% <") && tok->linkAt(1)) if (Token::Match(tok, "%name% <") && tok->linkAt(1))
tok = tok->linkAt(1); tok = tok->linkAt(1);
else if (Token::Match(tok, "%name% . . ."))
tok = tok->tokAt(3);
tok = tok->next(); tok = tok->next();
if (Token::Match(tok, "%str%")) { if (Token::Match(tok, "%str%")) {
while (Token::Match(tok, "%name%|%str%")) while (Token::Match(tok, "%name%|%str%"))
tok = tok->next(); tok = tok->next();
} }
} }
} else if (tok->str() == "{") { } else if (tok->str() == "{") {
const Token *prev = tok->previous(); const Token *prev = tok->previous();
if (Token::simpleMatch(prev, ") {") && iscast(prev->link())) if (Token::simpleMatch(prev, ") {") && iscast(prev->link()))
prev = prev->link()->previous(); prev = prev->link()->previous();
 End of changes. 3 change blocks. 
2 lines changed or deleted 4 lines changed or added

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