Refactorizations:
- Removed redundant newlines at the end of test cases - Make use of STL algorithms instead of own implementations of std::replace and std::remove+string::erase - Removed unused variable (found by cppcheck) - Prefer postfix increment (found by cppcheck)
This commit is contained in:
parent
bb940e4722
commit
f5e5d59562
|
@ -860,7 +860,6 @@ void Preprocessor::handleUndef(std::list<std::string> &configurations) const
|
|||
{
|
||||
if (_settings && !_settings->userUndefs.empty()) {
|
||||
for (std::list<std::string>::iterator cfg = configurations.begin(); cfg != configurations.end();) {
|
||||
const std::string strcfg(*cfg);
|
||||
bool undef = false;
|
||||
for (std::set<std::string>::const_iterator it = _settings->userUndefs.begin(); it != _settings->userUndefs.end(); ++it) {
|
||||
if (*it == *cfg)
|
||||
|
@ -880,7 +879,7 @@ void Preprocessor::handleUndef(std::list<std::string> &configurations) const
|
|||
if (undef)
|
||||
configurations.erase(cfg++);
|
||||
else
|
||||
cfg++;
|
||||
++cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "settings.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <cctype> // std::isdigit, std::isalnum, etc
|
||||
|
@ -31,8 +32,7 @@ std::string Suppressions::parseFile(std::istream &istr)
|
|||
std::string line;
|
||||
while (std::getline(istr, line))
|
||||
filedata += line + "\n";
|
||||
while (filedata.find("\r") != std::string::npos)
|
||||
filedata[filedata.find("\r")] = '\n';
|
||||
std::replace(filedata.begin(), filedata.end(), '\r', '\n');
|
||||
|
||||
// Parse filedata..
|
||||
std::istringstream istr2(filedata);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "tokenlist.h"
|
||||
#include "errorlogger.h"
|
||||
#include "settings.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
@ -353,8 +354,7 @@ std::set<std::string> TemplateSimplifier::simplifyTemplatesExpandSpecialized(Tok
|
|||
const std::string pattern(s + " > (");
|
||||
|
||||
// remove spaces to create new name
|
||||
while (s.find(" ") != std::string::npos)
|
||||
s.erase(s.find(" "), 1);
|
||||
s.erase(std::remove(s.begin(), s.end(), ' '), s.end());
|
||||
const std::string name(s + ">");
|
||||
expandedtemplates.insert(name);
|
||||
|
||||
|
|
|
@ -140,8 +140,7 @@ private:
|
|||
"\n"
|
||||
"void Fred::f()\n"
|
||||
"{\n"
|
||||
"}\n"
|
||||
"\n");
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[p.h:4]: (style) Unused private function: 'Fred::f'\n", errout.str());
|
||||
|
||||
// Don't warn about include files which implementation we don't see
|
||||
|
@ -157,8 +156,7 @@ private:
|
|||
"\n"
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
"}\n"
|
||||
"\n");
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue