FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix #13401 (cppcheck-addon-ctu-file-list filename should be unique for each process) by danmar · Pull Request #7082 · cppcheck-opensource/cppcheck · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 6 additions & 6 deletions lib/cppcheck.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1446,13 +1446,13 @@ void CppCheck::executeAddons(const std::vector<std::string>& files, const std::s
if (mSettings.addons.empty() || files.empty())
return;

FilesDeleter filesDeleter;
const bool isCtuInfo = endsWith(files[0], ".ctu-info");

FilesDeleter filesDeleter;
std::string fileList;

if (files.size() >= 2 || endsWith(files[0], ".ctu-info")) {
// TODO: can this conflict when using -j?
fileList = Path::getPathFromFilename(files[0]) + FILELIST;
if (files.size() >= 2) {
fileList = Path::getPathFromFilename(files[0]) + FILELIST + ("-" + std::to_string(mSettings.pid)) + ".txt";
std::ofstream fout(fileList);
filesDeleter.addFile(fileList);
// TODO: check if file could be created
Expand All @@ -1466,7 +1466,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files, const std::s
std::string ctuInfo;

for (const AddonInfo &addonInfo : mSettings.addonInfos) {
if (addonInfo.name != "misra" && !addonInfo.ctu && endsWith(files.back(), ".ctu-info"))
if (isCtuInfo && addonInfo.name != "misra" && !addonInfo.ctu)
continue;

const std::vector<picojson::value> results =
Expand Down Expand Up @@ -1532,7 +1532,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files, const std::s
}
}

if (!mSettings.buildDir.empty() && fileList.empty()) {
if (!mSettings.buildDir.empty() && !isCtuInfo) {
const std::string& ctuInfoFile = getCtuInfoFileName(files[0]);
std::ofstream fout(ctuInfoFile);
fout << ctuInfo;
Expand Down

Back | FazBrowse Home | New Git URL