diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 4e78ec3fb..9beb2f084 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -251,7 +251,8 @@ const char * CppCheck::extraVersion() unsigned int CppCheck::check(const std::string &path) { if (mSettings.clang) { - mErrorLogger.reportOut(std::string("Checking ") + path + "..."); + if (!mSettings.quiet) + mErrorLogger.reportOut(std::string("Checking ") + path + "..."); const std::string clang = Path::isCPP(path) ? "clang++" : "clang"; const std::string temp = mSettings.buildDir + (Path::isCPP(path) ? "/__temp__.cpp" : "/__temp__.c"); @@ -364,8 +365,10 @@ unsigned int CppCheck::check(const ImportProject::FileSettings &fs) temp.mSettings.userUndefs = fs.undefs; if (fs.platformType != Settings::Unspecified) temp.mSettings.platform(fs.platformType); - if (mSettings.clang) + if (mSettings.clang) { + temp.mSettings.includePaths.insert(temp.mSettings.includePaths.end(), fs.systemIncludePaths.cbegin(), fs.systemIncludePaths.cend()); temp.check(Path::simplifyPath(fs.filename)); + } std::ifstream fin(fs.filename); return temp.checkFile(Path::simplifyPath(fs.filename), fs.cfg, fin); } diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 51d593808..056c2cbc2 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -255,9 +255,10 @@ void ImportProject::FileSettings::parseCommand(const std::string &command) defs += ';'; } else if (F=='U') undefs.insert(fval); - else if (F=='I') - includePaths.push_back(fval); - else if (F=='s' && fval.compare(0,2,"td") == 0) { + else if (F=='I') { + if (std::find(includePaths.begin(), includePaths.end(), fval) == includePaths.end()) + includePaths.push_back(fval); + } else if (F=='s' && fval.compare(0,2,"td") == 0) { ++pos; const std::string stdval = readUntil(command, &pos, " "); standard = stdval;