src: clazy compiler warnings

get rid of most clazy warnings (https://github.com/KDE/clazy)
* range loop use refs
* qcolor ctor with ints
* missing Q_OBJECT macro
* use .constfirst instead of .first

enabled ccache for unix systems for fasterr recompiling
* if ccache is in path we use it now
This commit is contained in:
Andreas Stallinger
2017-08-10 09:45:55 +02:00
parent bb5c1d49b6
commit 37ead804bf
97 changed files with 339 additions and 344 deletions
+3 -3
View File
@@ -113,7 +113,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<int>& values)
std::vector<std::string> valuesStringVector;
if (getValues(key, valuesStringVector))
{
for (std::string valueString : valuesStringVector)
for (const std::string& valueString : valuesStringVector)
{
values.push_back(atoi(valueString.c_str()));
}
@@ -127,7 +127,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<float>& values
std::vector<std::string> valuesStringVector;
if (getValues(key, valuesStringVector))
{
for (std::string valueString : valuesStringVector)
for (const std::string& valueString : valuesStringVector)
{
values.push_back(static_cast<float>(atof(valueString.c_str())));
}
@@ -141,7 +141,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<bool>& values)
std::vector<std::string> valuesStringVector;
if (getValues(key, valuesStringVector))
{
for (std::string valueString : valuesStringVector)
for (const std::string& valueString : valuesStringVector)
{
values.push_back(atoi(valueString.c_str()) != 0);
}
@@ -46,15 +46,15 @@ void conflicting_options(const boost::program_options::variables_map& vm,
std::vector<FilePath> extractPaths(const std::vector<std::string>& vector)
{
std::vector<FilePath> v;
for (std::string s : vector)
for (const std::string& s : vector)
{
std::vector<std::string> temp= utility::splitToVector(s, ',');
for (std::string path : temp)
for (const std::string& path : temp)
{
v.push_back(FilePath(path));
}
}
return std::move(v);
return v;
}
} // namespace cmd
+3 -3
View File
@@ -24,7 +24,7 @@ void FileManager::update(
m_allSourceFilePaths.clear();
for (FileInfo fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
{
const FilePath& filePath = fileInfo.path;
if (isExcluded(filePath))
@@ -76,7 +76,7 @@ std::set<FilePath> FileManager::getAllSourceFilePathsRelative(const FilePath& ba
std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& filePaths)
{
std::vector<FilePath> ret;
for (const FilePath filePath: filePaths)
for (const FilePath& filePath: filePaths)
{
ret.push_back(filePath.canonical());
}
@@ -85,7 +85,7 @@ std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& fi
bool FileManager::isExcluded(const FilePath& filePath) const
{
for (FilePath path : m_excludePaths)
for (const FilePath& path : m_excludePaths)
{
if (path == filePath || path.contains(filePath))
{
+1 -1
View File
@@ -322,7 +322,7 @@ FilePath FilePath::replaceExtension(const std::string& extension) const
bool FilePath::hasExtension(const std::vector<std::string>& extensions) const
{
std::string e = extension();
for (std::string ext : extensions)
for (const std::string& ext : extensions)
{
if (e == ext)
{
@@ -51,7 +51,7 @@ bool FileRegisterStateData::fileIsIndexed(const FilePath& filePath) const
void FileRegisterStateData::setIndexedFiles(const std::set<FilePath>& filePaths)
{
for (auto path : filePaths)
for (auto& path : filePaths)
{
m_filePaths[path] = STATE_INDEXED;
}
+6 -6
View File
@@ -42,7 +42,7 @@ void Tracer::printTraces()
std::lock_guard<std::mutex> lock(m_mutex);
size_t unfinishEvents = 0;
for (auto p : m_startedEvents)
for (auto& p : m_startedEvents)
{
unfinishEvents += p.second.size();
}
@@ -67,11 +67,11 @@ void Tracer::printTraces()
std::cout << "-----------------------------------------------------------------";
std::cout << "------------------------------------------------------------\n";
for (auto p : m_events)
for (auto& p : m_events)
{
std::cout << "thread: " << p.first << std::endl;
for (const std::shared_ptr<TraceEvent> event : p.second)
for (const std::shared_ptr<TraceEvent>& event : p.second)
{
std::cout.width(8 + 2 * event->depth);
std::cout << std::right << std::setprecision(3) << std::fixed << event->time;
@@ -104,9 +104,9 @@ void Tracer::printTraces()
std::map<std::string, AccumulatedTraceEvent> accumulatedEvents;
for (auto p : m_events)
for (auto& p : m_events)
{
for (const std::shared_ptr<TraceEvent> event : p.second)
for (const std::shared_ptr<TraceEvent>& event : p.second)
{
std::string name = event->eventName + event->functionName + event->locationName;
@@ -136,7 +136,7 @@ void Tracer::printTraces()
}
);
for (const std::pair<std::string, AccumulatedTraceEvent> p : accumulatedEvents)
for (const std::pair<std::string, AccumulatedTraceEvent>& p : accumulatedEvents)
{
sortedEvents.insert(p.second);
}
+2 -2
View File
@@ -88,7 +88,7 @@ namespace utility
{
std::deque<std::string> c;
for (std::string str : list)
for (const std::string& str : list)
{
if (str.size())
{
@@ -322,7 +322,7 @@ namespace utility
}
paramPart = "";
for (std::string str : paramLines)
for (const std::string& str : paramLines)
{
paramPart += "\n\t" + str;
size_t length = tabWidth + str.size();