From a9f55f4985d84d1ee2651abc29b0dafb5e7c49f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 2 Feb 2020 16:35:42 +0100 Subject: [PATCH 1/2] CLI: add -isystem include paths when running Clang --- lib/cppcheck.cpp | 7 +++++-- lib/importproject.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) 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; From 60c3d4c482e856a6f0837f0f4af96266fa091bb1 Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Sun, 2 Feb 2020 16:36:19 +0100 Subject: [PATCH 2/2] daca@home: Add links to packages on time page (#2518) Also, increase the size of the package field to match the setting for the other pages (some packages are too small to fit at the moment). --- tools/donate-cpu-server.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 67dc65b44..2e3542b9d 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -22,7 +22,7 @@ import operator # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # changes) -SERVER_VERSION = "1.3.3" +SERVER_VERSION = "1.3.4" OLD_VERSION = '1.90' @@ -82,8 +82,7 @@ def overviewReport() -> str: return html -def fmt(a: str, b: str, c: str = None, d: str = None, e: str = None, link: bool = True) -> str: - column_width = [40, 10, 5, 7, 7, 8] +def fmt(a: str, b: str, c: str = None, d: str = None, e: str = None, link: bool = True, column_width = [40, 10, 5, 7, 7, 8]) -> str: ret = a while len(ret) < column_width[0]: ret += ' ' @@ -615,12 +614,9 @@ def timeReport(resultPath: str) -> str: html = 'Time report\n' html += '

Time report

\n' html += '
\n'
-    column_widths = [25, 10, 10, 10]
+    column_width = [40, 10, 10, 10, 10]
     html += ''
-    html += 'Package '.ljust(column_widths[0]) + ' ' + \
-            OLD_VERSION.rjust(column_widths[1]) + ' ' + \
-            'Head'.rjust(column_widths[2]) + ' ' + \
-            'Factor'.rjust(column_widths[3])
+    html += fmt('Package', OLD_VERSION, 'Head', 'Factor', column_width=column_width)
     html += '\n'
 
     total_time_base = 0.0
@@ -656,10 +652,8 @@ def timeReport(resultPath: str) -> str:
                     time_factor = time_head / time_base
                 else:
                     time_factor = 0.0
-                html += filename[len(resultPath)+1:].ljust(column_widths[0]) + ' ' + \
-                    split_line[2].rjust(column_widths[1]) + ' ' + \
-                    split_line[1].rjust(column_widths[2]) + ' ' + \
-                    '{:.2f}'.format(time_factor).rjust(column_widths[3]) + '\n'
+                html += fmt(filename[len(resultPath)+1:], split_line[2], split_line[1],
+                    '{:.2f}'.format(time_factor), column_width=column_width) + '\n'
             break
 
     html += '\n'
@@ -670,10 +664,10 @@ def timeReport(resultPath: str) -> str:
     else:
         total_time_factor = 0.0
     html += 'Time for all packages (not just the ones listed above):\n'
-    html += 'Total time: '.ljust(column_widths[0]) + ' ' + \
-            '{:.1f}'.format(total_time_base).rjust(column_widths[1]) + ' ' + \
-            '{:.1f}'.format(total_time_head).rjust(column_widths[2]) + ' ' + \
-            '{:.2f}'.format(total_time_factor).rjust(column_widths[3])
+    html += fmt('Total time:',
+            '{:.1f}'.format(total_time_base),
+            '{:.1f}'.format(total_time_head),
+            '{:.2f}'.format(total_time_factor), link=False, column_width=column_width)
 
     html += '\n'
     html += '
\n'