diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 6ee2b849fab5..167f80733d0a 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -233,7 +233,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[]) } if (!pathnamesRef.empty()) { - std::list filesResolved; + std::list filesResolved; // TODO: this needs to be inlined into PathMatch as it depends on the underlying filesystem #if defined(_WIN32) // For Windows we want case-insensitive path matching @@ -273,7 +273,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[]) } } - std::list files; + std::list files; if (!mSettings.fileFilters.empty()) { std::copy_if(filesResolved.cbegin(), filesResolved.cend(), std::inserter(files, files.end()), [&](const decltype(filesResolved)::value_type& entry) { return matchglobs(mSettings.fileFilters, entry.path()); diff --git a/cli/cmdlineparser.h b/cli/cmdlineparser.h index 74079243d264..f7d240b55cc0 100644 --- a/cli/cmdlineparser.h +++ b/cli/cmdlineparser.h @@ -84,7 +84,7 @@ class CmdLineParser { /** * Return the files user gave to command line. */ - const std::list& getFiles() const { + const std::list& getFiles() const { return mFiles; } @@ -159,7 +159,7 @@ class CmdLineParser { CmdLineLogger &mLogger; std::vector mPathNames; - std::list mFiles; + std::list mFiles; std::list mFileSettings; std::vector mIgnoredPaths; Settings &mSettings; diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index c95e02242e59..6047647fcd5a 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -218,7 +218,7 @@ int CppCheckExecutor::check_wrapper(const Settings& settings) return check_internal(settings); } -bool CppCheckExecutor::reportSuppressions(const Settings &settings, const SuppressionList& suppressions, bool unusedFunctionCheckEnabled, const std::list &files, const std::list& fileSettings, ErrorLogger& errorLogger) { +bool CppCheckExecutor::reportSuppressions(const Settings &settings, const SuppressionList& suppressions, bool unusedFunctionCheckEnabled, const std::list &files, const std::list& fileSettings, ErrorLogger& errorLogger) { const auto& suppr = suppressions.getSuppressions(); if (std::any_of(suppr.begin(), suppr.end(), [](const SuppressionList::Suppression& s) { return s.errorId == "unmatchedSuppression" && s.fileName.empty() && s.lineNumber == SuppressionList::Suppression::NO_LINE; @@ -230,7 +230,7 @@ bool CppCheckExecutor::reportSuppressions(const Settings &settings, const Suppre // the two inputs may only be used exclusively assert(!(!files.empty() && !fileSettings.empty())); - for (std::list::const_iterator i = files.cbegin(); i != files.cend(); ++i) { + for (std::list::const_iterator i = files.cbegin(); i != files.cend(); ++i) { err |= SuppressionList::reportUnmatchedSuppressions( suppressions.getUnmatchedLocalSuppressions(i->path(), unusedFunctionCheckEnabled), errorLogger); } @@ -260,7 +260,7 @@ int CppCheckExecutor::check_internal(const Settings& settings) const if (!settings.buildDir.empty()) { std::list fileNames; - for (std::list::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) + for (std::list::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) fileNames.emplace_back(i->path()); AnalyzerInformation::writeFilesTxt(settings.buildDir, fileNames, settings.userDefines, mFileSettings); } diff --git a/cli/cppcheckexecutor.h b/cli/cppcheckexecutor.h index 316a7122d0ab..86d938c58b93 100644 --- a/cli/cppcheckexecutor.h +++ b/cli/cppcheckexecutor.h @@ -31,7 +31,7 @@ class Settings; class ErrorLogger; class SuppressionList; -class PathWithDetails; +class FileWithDetails; /** * This class works as an example of how CppCheck can be used in external @@ -82,7 +82,7 @@ class CppCheckExecutor { protected: - static bool reportSuppressions(const Settings &settings, const SuppressionList& suppressions, bool unusedFunctionCheckEnabled, const std::list &files, const std::list& fileSettings, ErrorLogger& errorLogger); + static bool reportSuppressions(const Settings &settings, const SuppressionList& suppressions, bool unusedFunctionCheckEnabled, const std::list &files, const std::list& fileSettings, ErrorLogger& errorLogger); /** * Wrapper around check_internal @@ -107,7 +107,7 @@ class CppCheckExecutor { /** * Filename associated with size of file */ - std::list mFiles; + std::list mFiles; std::list mFileSettings; diff --git a/cli/executor.cpp b/cli/executor.cpp index 16a85dccfe2a..d60e901e8e90 100644 --- a/cli/executor.cpp +++ b/cli/executor.cpp @@ -30,7 +30,7 @@ struct FileSettings; -Executor::Executor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger) +Executor::Executor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger) : mFiles(files), mFileSettings(fileSettings), mSettings(settings), mSuppressions(suppressions), mErrorLogger(errorLogger) { // the two inputs may only be used exclusively diff --git a/cli/executor.h b/cli/executor.h index 297c3a97b936..74cf3c49c9c1 100644 --- a/cli/executor.h +++ b/cli/executor.h @@ -31,7 +31,7 @@ class ErrorLogger; class ErrorMessage; class SuppressionList; struct FileSettings; -class PathWithDetails; +class FileWithDetails; /// @addtogroup CLI /// @{ @@ -42,7 +42,7 @@ class PathWithDetails; */ class Executor { public: - Executor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger); + Executor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger); virtual ~Executor() = default; Executor(const Executor &) = delete; @@ -68,7 +68,7 @@ class Executor { */ bool hasToLog(const ErrorMessage &msg); - const std::list &mFiles; + const std::list &mFiles; const std::list& mFileSettings; const Settings &mSettings; SuppressionList &mSuppressions; diff --git a/cli/filelister.cpp b/cli/filelister.cpp index 697fc54266e1..88ebbc711f70 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -41,12 +41,12 @@ // When compiling Unicode targets WinAPI automatically uses *W Unicode versions // of called functions. Thus, we explicitly call *A versions of the functions. -std::string FileLister::recursiveAddFiles(std::list&files, const std::string &path, const std::set &extra, const PathMatch& ignored) +std::string FileLister::recursiveAddFiles(std::list&files, const std::string &path, const std::set &extra, const PathMatch& ignored) { return addFiles(files, path, extra, true, ignored); } -std::string FileLister::addFiles(std::list&files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored) +std::string FileLister::addFiles(std::list&files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored) { if (path.empty()) return "no path specified"; @@ -123,7 +123,7 @@ std::string FileLister::addFiles(std::list&files, const std::st // Directory if (recursive) { if (!ignored.match(fname)) { - std::list filesSorted; + std::list filesSorted; std::string err = FileLister::recursiveAddFiles(filesSorted, fname, extra, ignored); if (!err.empty()) @@ -166,7 +166,7 @@ std::string FileLister::addFiles(std::list&files, const std::st #include #include -static std::string addFiles2(std::list &files, +static std::string addFiles2(std::list &files, const std::string &path, const std::set &extra, bool recursive, @@ -189,7 +189,7 @@ static std::string addFiles2(std::list &files, std::string new_path = path; new_path += '/'; - std::list filesSorted; + std::list filesSorted; while (const dirent* dir_result = readdir(dir)) { if ((std::strcmp(dir_result->d_name, ".") == 0) || @@ -236,12 +236,12 @@ static std::string addFiles2(std::list &files, return ""; } -std::string FileLister::recursiveAddFiles(std::list &files, const std::string &path, const std::set &extra, const PathMatch& ignored) +std::string FileLister::recursiveAddFiles(std::list &files, const std::string &path, const std::set &extra, const PathMatch& ignored) { return addFiles(files, path, extra, true, ignored); } -std::string FileLister::addFiles(std::list &files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored) +std::string FileLister::addFiles(std::list &files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored) { if (path.empty()) return "no path specified"; diff --git a/cli/filelister.h b/cli/filelister.h index e26899e2ce6a..81f6d6ff8fa3 100644 --- a/cli/filelister.h +++ b/cli/filelister.h @@ -26,7 +26,7 @@ #include class PathMatch; -class PathWithDetails; +class FileWithDetails; /// @addtogroup CLI /// @{ @@ -44,7 +44,7 @@ class FileLister { * @param ignored ignored paths * @return On success, an empty string is returned. On error, a error message is returned. */ - static std::string recursiveAddFiles(std::list &files, const std::string &path, const PathMatch& ignored) { + static std::string recursiveAddFiles(std::list &files, const std::string &path, const PathMatch& ignored) { const std::set extra; return recursiveAddFiles(files, path, extra, ignored); } @@ -60,7 +60,7 @@ class FileLister { * @param ignored ignored paths * @return On success, an empty string is returned. On error, a error message is returned. */ - static std::string recursiveAddFiles(std::list &files, const std::string &path, const std::set &extra, const PathMatch& ignored); + static std::string recursiveAddFiles(std::list &files, const std::string &path, const std::set &extra, const PathMatch& ignored); /** * @brief (Recursively) add source files to a map. @@ -74,7 +74,7 @@ class FileLister { * @param ignored ignored paths * @return On success, an empty string is returned. On error, a error message is returned. */ - static std::string addFiles(std::list &files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored); + static std::string addFiles(std::list &files, const std::string &path, const std::set &extra, bool recursive, const PathMatch& ignored); }; /// @} diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index 015786fdf434..912f15c6b637 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -63,7 +63,7 @@ enum class Color; using std::memset; -ProcessExecutor::ProcessExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) +ProcessExecutor::ProcessExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) : Executor(files, fileSettings, settings, suppressions, errorLogger) , mExecuteCommand(std::move(executeCommand)) { @@ -233,7 +233,7 @@ unsigned int ProcessExecutor::check() unsigned int fileCount = 0; unsigned int result = 0; - const std::size_t totalfilesize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const PathWithDetails& p) { + const std::size_t totalfilesize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const FileWithDetails& p) { return v + p.size(); }); @@ -241,7 +241,7 @@ unsigned int ProcessExecutor::check() std::map childFile; std::map pipeFile; std::size_t processedsize = 0; - std::list::const_iterator iFile = mFiles.cbegin(); + std::list::const_iterator iFile = mFiles.cbegin(); std::list::const_iterator iFileSettings = mFileSettings.cbegin(); for (;;) { // Start a new child @@ -330,7 +330,7 @@ unsigned int ProcessExecutor::check() std::size_t size = 0; if (p != pipeFile.end()) { pipeFile.erase(p); - const auto fs = std::find_if(mFiles.cbegin(), mFiles.cend(), [&name](const PathWithDetails& entry) { + const auto fs = std::find_if(mFiles.cbegin(), mFiles.cend(), [&name](const FileWithDetails& entry) { return entry.path() == name; }); if (fs != mFiles.end()) { diff --git a/cli/processexecutor.h b/cli/processexecutor.h index 5504bb4259a6..9e94557c5b8a 100644 --- a/cli/processexecutor.h +++ b/cli/processexecutor.h @@ -31,7 +31,7 @@ class Settings; class ErrorLogger; class SuppressionList; struct FileSettings; -class PathWithDetails; +class FileWithDetails; /// @addtogroup CLI /// @{ @@ -42,7 +42,7 @@ class PathWithDetails; */ class ProcessExecutor : public Executor { public: - ProcessExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); + ProcessExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); ProcessExecutor(const ProcessExecutor &) = delete; ProcessExecutor& operator=(const ProcessExecutor &) = delete; diff --git a/cli/singleexecutor.cpp b/cli/singleexecutor.cpp index b55dfb6472c5..da3e0fcc34a3 100644 --- a/cli/singleexecutor.cpp +++ b/cli/singleexecutor.cpp @@ -30,7 +30,7 @@ class ErrorLogger; -SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger) +SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger) : Executor(files, fileSettings, settings, suppressions, errorLogger) , mCppcheck(cppcheck) { @@ -42,14 +42,14 @@ unsigned int SingleExecutor::check() { unsigned int result = 0; - const std::size_t totalfilesize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const PathWithDetails& f) { + const std::size_t totalfilesize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const FileWithDetails& f) { return v + f.size(); }); std::size_t processedsize = 0; unsigned int c = 0; - for (std::list::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) { + for (std::list::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) { result += mCppcheck.check(i->path()); processedsize += i->size(); ++c; diff --git a/cli/singleexecutor.h b/cli/singleexecutor.h index 291a0752ce2d..b1d9ef5c67f8 100644 --- a/cli/singleexecutor.h +++ b/cli/singleexecutor.h @@ -31,12 +31,12 @@ class Settings; class CppCheck; class SuppressionList; struct FileSettings; -class PathWithDetails; +class FileWithDetails; class SingleExecutor : public Executor { public: - SingleExecutor(CppCheck &cppcheck, const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger); + SingleExecutor(CppCheck &cppcheck, const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger); SingleExecutor(const SingleExecutor &) = delete; SingleExecutor& operator=(const SingleExecutor &) = delete; diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 5af02fa8d2e5..4525166d5084 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -39,7 +39,7 @@ enum class Color; -ThreadExecutor::ThreadExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) +ThreadExecutor::ThreadExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) : Executor(files, fileSettings, settings, suppressions, errorLogger) , mExecuteCommand(std::move(executeCommand)) { @@ -81,14 +81,14 @@ class SyncLogForwarder : public ErrorLogger class ThreadData { public: - ThreadData(ThreadExecutor &threadExecutor, ErrorLogger &errorLogger, const Settings &settings, const std::list &files, const std::list &fileSettings, CppCheck::ExecuteCmdFn executeCommand) + ThreadData(ThreadExecutor &threadExecutor, ErrorLogger &errorLogger, const Settings &settings, const std::list &files, const std::list &fileSettings, CppCheck::ExecuteCmdFn executeCommand) : mFiles(files), mFileSettings(fileSettings), mSettings(settings), mExecuteCommand(std::move(executeCommand)), logForwarder(threadExecutor, errorLogger) { mItNextFile = mFiles.begin(); mItNextFileSettings = mFileSettings.begin(); mTotalFiles = mFiles.size() + mFileSettings.size(); - mTotalFileSize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const PathWithDetails& p) { + mTotalFileSize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const FileWithDetails& p) { return v + p.size(); }); } @@ -140,8 +140,8 @@ class ThreadData } private: - const std::list &mFiles; - std::list::const_iterator mItNextFile; + const std::list &mFiles; + std::list::const_iterator mItNextFile; const std::list &mFileSettings; std::list::const_iterator mItNextFileSettings; diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index c4afbaa5f7a9..c22337839512 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -31,7 +31,7 @@ class Settings; class ErrorLogger; class SuppressionList; struct FileSettings; -class PathWithDetails; +class FileWithDetails; /// @addtogroup CLI /// @{ @@ -44,7 +44,7 @@ class ThreadExecutor : public Executor { friend class SyncLogForwarder; public: - ThreadExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); + ThreadExecutor(const std::list &files, const std::list& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); ThreadExecutor(const ThreadExecutor &) = delete; ThreadExecutor& operator=(const ThreadExecutor &) = delete; diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index 1dfccf2ebacc..daea05568590 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -111,9 +111,9 @@ void CheckThread::run() if (!mFiles.isEmpty() || mAnalyseWholeProgram) { mAnalyseWholeProgram = false; qDebug() << "Whole program analysis"; - std::list files2; + std::list files2; std::transform(mFiles.cbegin(), mFiles.cend(), std::back_inserter(files2), [&](const QString& file) { - return PathWithDetails{file.toStdString(), 0}; + return FileWithDetails{file.toStdString(), 0}; }); mCppcheck.analyseWholeProgram(mCppcheck.settings().buildDir, files2, {}); mFiles.clear(); diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index cb9c69ae9825..f9b657066982 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1460,7 +1460,7 @@ void CppCheck::executeAddons(const std::vector& files, const std::s } } -void CppCheck::executeAddonsWholeProgram(const std::list &files) +void CppCheck::executeAddonsWholeProgram(const std::list &files) { if (mSettings.addons.empty()) return; @@ -1755,7 +1755,7 @@ bool CppCheck::analyseWholeProgram() return errors && (mExitCode > 0); } -unsigned int CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list> &files, const std::list& fileSettings) +unsigned int CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list> &files, const std::list& fileSettings) { executeAddonsWholeProgram(files); // TODO: pass FileSettings if (buildDir.empty()) { @@ -1825,7 +1825,7 @@ unsigned int CppCheck::analyseWholeProgram(const std::string &buildDir, const st return mExitCode; } -void CppCheck::removeCtuInfoFiles(const std::list &files, const std::list& fileSettings) +void CppCheck::removeCtuInfoFiles(const std::list &files, const std::list& fileSettings) { if (mSettings.buildDir.empty()) { for (const auto& f: files) { diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 99359759f035..2ca1f0238e94 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -44,7 +44,7 @@ enum class SHOWTIME_MODES; struct FileSettings; class CheckUnusedFunctions; class Tokenizer; -class PathWithDetails; +class FileWithDetails; namespace simplecpp { class TokenList; } @@ -143,10 +143,10 @@ class CPPCHECKLIB CppCheck : ErrorLogger { void analyseClangTidy(const FileSettings &fileSettings); /** analyse whole program use .analyzeinfo files */ - unsigned int analyseWholeProgram(const std::string &buildDir, const std::list &files, const std::list& fileSettings); + unsigned int analyseWholeProgram(const std::string &buildDir, const std::list &files, const std::list& fileSettings); /** Remove *.ctu-info files */ - void removeCtuInfoFiles(const std::list& files, const std::list& fileSettings); // cppcheck-suppress functionConst // has side effects + void removeCtuInfoFiles(const std::list& files, const std::list& fileSettings); // cppcheck-suppress functionConst // has side effects static void resetTimerResults(); static void printTimerResults(SHOWTIME_MODES mode); @@ -193,7 +193,7 @@ class CPPCHECKLIB CppCheck : ErrorLogger { /** * Execute addons */ - void executeAddonsWholeProgram(const std::list &files); + void executeAddonsWholeProgram(const std::list &files); #ifdef HAVE_RULES /** diff --git a/lib/filesettings.h b/lib/filesettings.h index 5f23b9a1a6b4..d6edc1e443de 100644 --- a/lib/filesettings.h +++ b/lib/filesettings.h @@ -27,14 +27,14 @@ #include #include -class PathWithDetails +class FileWithDetails { public: - explicit PathWithDetails(std::string path) - : PathWithDetails(std::move(path), 0) + explicit FileWithDetails(std::string path) + : FileWithDetails(std::move(path), 0) {} - PathWithDetails(std::string path, std::size_t size) + FileWithDetails(std::string path, std::size_t size) : mPath(std::move(path)) , mSize(size) {} @@ -56,18 +56,18 @@ class PathWithDetails /** File settings. Multiple configurations for a file is allowed. */ struct CPPCHECKLIB FileSettings { explicit FileSettings(std::string path) - : path(std::move(path)) + : file(std::move(path)) {} FileSettings(std::string path, std::size_t size) - : path(std::move(path), size) + : file(std::move(path), size) {} std::string cfg; - PathWithDetails path; + FileWithDetails file; const std::string& filename() const { - return path.path(); + return file.path(); } std::string defines; // TODO: handle differently diff --git a/lib/importproject.cpp b/lib/importproject.cpp index f497e0eb70cc..6a30ae468503 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -1339,7 +1339,7 @@ void ImportProject::setRelativePaths(const std::string &filename) return; const std::vector basePaths{Path::fromNativeSeparators(Path::getCurrentPath())}; for (auto &fs: fileSettings) { - fs.path = PathWithDetails{Path::getRelativePath(fs.filename(), basePaths)}; + fs.file = FileWithDetails{Path::getRelativePath(fs.filename(), basePaths)}; for (auto &includePath: fs.includePaths) includePath = Path::getRelativePath(includePath, basePaths); } diff --git a/test/helpers.cpp b/test/helpers.cpp index 39093386aa4e..85391067d4f2 100644 --- a/test/helpers.cpp +++ b/test/helpers.cpp @@ -83,7 +83,7 @@ ScopedFile::~ScopedFile() { // TODO: remove all files // TODO: simplify the function call // hack to be able to delete *.plist output files - std::list files; + std::list files; const std::string res = FileLister::addFiles(files, mPath, {".plist"}, false, PathMatch({})); if (!res.empty()) { std::cout << "ScopedFile(" << mPath + ") - generating file list failed (" << res << ")" << std::endl; diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp index 25101809dce5..7eb5bb4e09b1 100644 --- a/test/testfilelister.cpp +++ b/test/testfilelister.cpp @@ -59,7 +59,7 @@ class TestFileLister : public TestFixture { const std::string adddir = findBaseDir() + "."; // Recursively add add files.. - std::list files; + std::list files; std::vector masks; PathMatch matcher(std::move(masks)); std::string err = FileLister::recursiveAddFiles(files, adddir, matcher); @@ -76,7 +76,7 @@ class TestFileLister : public TestFixture { #endif const auto find_file = [&](const std::string& name) { - return std::find_if(files.cbegin(), files.cend(), [&name](const PathWithDetails& entry) { + return std::find_if(files.cbegin(), files.cend(), [&name](const FileWithDetails& entry) { return entry.path() == name; }); }; @@ -93,7 +93,7 @@ class TestFileLister : public TestFixture { } void recursiveAddFilesEmptyPath() const { - std::list files; + std::list files; const std::string err = FileLister::recursiveAddFiles(files, "", PathMatch({})); ASSERT_EQUALS("no path specified", err); } @@ -101,7 +101,7 @@ class TestFileLister : public TestFixture { void excludeFile1() const { const std::string basedir = findBaseDir(); - std::list files; + std::list files; std::vector ignored{"lib/token.cpp"}; PathMatch matcher(ignored); std::string err = FileLister::recursiveAddFiles(files, basedir + "lib/token.cpp", matcher); @@ -112,7 +112,7 @@ class TestFileLister : public TestFixture { void excludeFile2() const { const std::string basedir = findBaseDir(); - std::list files; + std::list files; std::vector ignored; PathMatch matcher(ignored); std::string err = FileLister::recursiveAddFiles(files, basedir + "lib/token.cpp", matcher); diff --git a/test/testfilesettings.cpp b/test/testfilesettings.cpp index b9260b8756eb..a7764ca1034b 100644 --- a/test/testfilesettings.cpp +++ b/test/testfilesettings.cpp @@ -30,32 +30,32 @@ class TestFileSettings : public TestFixture { void path() const { { - const PathWithDetails p{"file.cpp"}; + const FileWithDetails p{"file.cpp"}; ASSERT_EQUALS("file.cpp", p.path()); ASSERT_EQUALS(0, p.size()); } { - const PathWithDetails p{"file.cpp", 123}; + const FileWithDetails p{"file.cpp", 123}; ASSERT_EQUALS("file.cpp", p.path()); ASSERT_EQUALS(123, p.size()); } { - const PathWithDetails p{"in/file.cpp"}; + const FileWithDetails p{"in/file.cpp"}; ASSERT_EQUALS("in/file.cpp", p.path()); ASSERT_EQUALS(0, p.size()); } { - const PathWithDetails p{"in\\file.cpp"}; + const FileWithDetails p{"in\\file.cpp"}; ASSERT_EQUALS("in\\file.cpp", p.path()); ASSERT_EQUALS(0, p.size()); } { - const PathWithDetails p{"in/../file.cpp"}; + const FileWithDetails p{"in/../file.cpp"}; ASSERT_EQUALS("in/../file.cpp", p.path()); ASSERT_EQUALS(0, p.size()); } { - const PathWithDetails p{"in\\..\\file.cpp"}; + const FileWithDetails p{"in\\..\\file.cpp"}; ASSERT_EQUALS("in\\..\\file.cpp", p.path()); ASSERT_EQUALS(0, p.size()); } diff --git a/test/testprocessexecutor.cpp b/test/testprocessexecutor.cpp index 62e8784bcdbf..c62253ab3590 100644 --- a/test/testprocessexecutor.cpp +++ b/test/testprocessexecutor.cpp @@ -68,7 +68,7 @@ class TestProcessExecutorBase : public TestFixture { void check(unsigned int jobs, int files, int result, const std::string &data, const CheckOptions& opt = make_default_obj{}) { std::list fileSettings; - std::list filelist; + std::list filelist; if (opt.filesList.empty()) { for (int i = 1; i <= files; ++i) { std::string f_s = fprefix() + "_" + std::to_string(i) + ".cpp"; @@ -108,7 +108,7 @@ class TestProcessExecutorBase : public TestFixture { std::vector> scopedfiles; scopedfiles.reserve(filelist.size()); - for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) + for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) scopedfiles.emplace_back(new ScopedFile(i->path(), data)); // clear files list so only fileSettings are used diff --git a/test/testsingleexecutor.cpp b/test/testsingleexecutor.cpp index 135ac3752a17..6c85c50d239b 100644 --- a/test/testsingleexecutor.cpp +++ b/test/testsingleexecutor.cpp @@ -73,7 +73,7 @@ class TestSingleExecutorBase : public TestFixture { void check(int files, int result, const std::string &data, const CheckOptions& opt = make_default_obj{}) { std::list fileSettings; - std::list filelist; + std::list filelist; if (opt.filesList.empty()) { for (int i = 1; i <= files; ++i) { std::string f_s = fprefix() + "_" + zpad3(i) + ".cpp"; @@ -115,7 +115,7 @@ class TestSingleExecutorBase : public TestFixture { std::vector> scopedfiles; scopedfiles.reserve(filelist.size()); - for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) + for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) scopedfiles.emplace_back(new ScopedFile(i->path(), data)); // clear files list so only fileSettings are used diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index fb7ad16d249a..5e31520ce965 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -229,7 +229,7 @@ class TestSuppressions : public TestFixture { unsigned int _checkSuppression(std::map &f, bool useFS, const std::string &suppression = emptyString) { std::list fileSettings; - std::list filelist; + std::list filelist; for (std::map::const_iterator i = f.cbegin(); i != f.cend(); ++i) { filelist.emplace_back(i->first, i->second.size()); if (useFS) { @@ -277,7 +277,7 @@ class TestSuppressions : public TestFixture { unsigned int _checkSuppressionThreads(const char code[], bool useFS, const std::string &suppression = emptyString) { std::list fileSettings; - std::list filelist; + std::list filelist; filelist.emplace_back("test.cpp", strlen(code)); if (useFS) { fileSettings.emplace_back("test.cpp", strlen(code)); @@ -294,7 +294,7 @@ class TestSuppressions : public TestFixture { std::vector> scopedfiles; scopedfiles.reserve(filelist.size()); - for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) + for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) scopedfiles.emplace_back(new ScopedFile(i->path(), code)); // clear files list so only fileSettings are used @@ -321,7 +321,7 @@ class TestSuppressions : public TestFixture { unsigned int _checkSuppressionProcesses(const char code[], bool useFS, const std::string &suppression = emptyString) { std::list fileSettings; - std::list filelist; + std::list filelist; filelist.emplace_back("test.cpp", strlen(code)); if (useFS) { fileSettings.emplace_back("test.cpp", strlen(code)); @@ -338,7 +338,7 @@ class TestSuppressions : public TestFixture { std::vector> scopedfiles; scopedfiles.reserve(filelist.size()); - for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) + for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) scopedfiles.emplace_back(new ScopedFile(i->path(), code)); // clear files list so only fileSettings are used diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index 318a269cf12e..f353158457b6 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -68,7 +68,7 @@ class TestThreadExecutorBase : public TestFixture { void check(unsigned int jobs, int files, int result, const std::string &data, const CheckOptions& opt = make_default_obj{}) { std::list fileSettings; - std::list filelist; + std::list filelist; if (opt.filesList.empty()) { for (int i = 1; i <= files; ++i) { std::string f_s = fprefix() + "_" + std::to_string(i) + ".cpp"; @@ -109,7 +109,7 @@ class TestThreadExecutorBase : public TestFixture { std::vector> scopedfiles; scopedfiles.reserve(filelist.size()); - for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) + for (std::list::const_iterator i = filelist.cbegin(); i != filelist.cend(); ++i) scopedfiles.emplace_back(new ScopedFile(i->path(), data)); // clear files list so only fileSettings are used diff --git a/tools/dmake/dmake.cpp b/tools/dmake/dmake.cpp index 3e25552fe7a4..458c8ca1cade 100644 --- a/tools/dmake/dmake.cpp +++ b/tools/dmake/dmake.cpp @@ -160,7 +160,7 @@ static void compilefiles(std::ostream &fout, const std::vector &fil static std::string getCppFiles(std::vector &files, const std::string &path, bool recursive) { - std::list filelist; + std::list filelist; const std::set extra; const std::vector masks; const PathMatch matcher(masks);