Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cppcheck for openSUSE:Factory 
checked in at 2022-03-26 22:31:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cppcheck (Old)
 and      /work/SRC/openSUSE:Factory/.cppcheck.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cppcheck"

Sat Mar 26 22:31:28 2022 rev:23 rq:965031 version:2.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/cppcheck/cppcheck.changes        2022-03-21 
20:11:05.236383129 +0100
+++ /work/SRC/openSUSE:Factory/.cppcheck.new.1900/cppcheck.changes      
2022-03-26 22:31:50.146016874 +0100
@@ -1,0 +2,7 @@
+Sat Mar 26 14:06:09 UTC 2022 - Dirk M??ller <[email protected]>
+
+- update to 2.7.4:
+  * Fixes "undefined reference to `tinyxml2::"
+  * Replace tinyxml2_LIBRARY with tinyxml2_LIBRARIES
+
+-------------------------------------------------------------------

Old:
----
  cppcheck-2.7.1.tar.gz

New:
----
  cppcheck-2.7.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cppcheck.spec ++++++
--- /var/tmp/diff_new_pack.PN1bVP/_old  2022-03-26 22:31:50.754017706 +0100
+++ /var/tmp/diff_new_pack.PN1bVP/_new  2022-03-26 22:31:50.754017706 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           cppcheck
-Version:        2.7.1
+Version:        2.7.4
 Release:        0
 Summary:        A tool for static C/C++ code analysis
 License:        GPL-3.0-or-later

++++++ cppcheck-2.7.1.tar.gz -> cppcheck-2.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/.github/workflows/CI-unixish.yml 
new/cppcheck-2.7.4/.github/workflows/CI-unixish.yml
--- old/cppcheck-2.7.1/.github/workflows/CI-unixish.yml 2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/.github/workflows/CI-unixish.yml 2022-03-25 
06:58:59.000000000 +0100
@@ -27,7 +27,7 @@
         run: |
           sudo apt-get update
           sudo apt-get install libxml2-utils
-          sudo apt-get install z3 libz3-dev
+          sudo apt-get install libz3-dev libtinyxml2-dev
           sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev 
qt5-default
 
       - name: Fix missing z3_version.h
@@ -45,6 +45,20 @@
           python -m pip install pip --upgrade
           python -m pip install pytest
 
+      - name: CMake build on ubuntu (with GUI / system tinyxml2)
+        if: contains(matrix.os, 'ubuntu')
+        run: |
+          mkdir cmake.output.tinyxml2
+          cd cmake.output.tinyxml2
+          cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On 
-DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off ..
+          cmake --build . -- -j$(nproc)
+          cd ..
+
+      - name: Run CMake test (system tinyxml2)
+        if: contains(matrix.os, 'ubuntu')
+        run: |
+          cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
+
       - name: CMake build on ubuntu (with GUI)
         if: contains(matrix.os, 'ubuntu')
         run: |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/addons/cppcheckdata.py 
new/cppcheck-2.7.4/addons/cppcheckdata.py
--- old/cppcheck-2.7.1/addons/cppcheckdata.py   2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/addons/cppcheckdata.py   2022-03-25 06:58:59.000000000 
+0100
@@ -143,21 +143,11 @@
     def __init__(self, element):
         self.type = element.get('valueType-type')
         self.sign = element.get('valueType-sign')
-        bits = element.get('valueType-bits')
-        if bits:
-            self.bits = int(bits)
+        self.bits = int(element.get('valueType-bits', 0))
         self.typeScopeId = element.get('valueType-typeScope')
         self.originalTypeName = element.get('valueType-originalTypeName')
-        constness = element.get('valueType-constness')
-        if constness:
-            self.constness = int(constness)
-        else:
-            self.constness = 0
-        pointer = element.get('valueType-pointer')
-        if pointer:
-            self.pointer = int(pointer)
-        else:
-            self.pointer = 0
+        self.constness = int(element.get('valueType-constness', 0))
+        self.pointer = int(element.get('valueType-pointer', 0))
 
     def __repr__(self):
         attrs = ["type", "sign", "bits", "typeScopeId", "originalTypeName",
@@ -620,9 +610,7 @@
         self.isPointer = element.get('isPointer') == 'true'
         self.isReference = element.get('isReference') == 'true'
         self.isStatic = element.get('isStatic') == 'true'
-        self.constness = element.get('constness')
-        if self.constness:
-            self.constness = int(self.constness)
+        self.constness = int(element.get('constness',0))
 
     def __repr__(self):
         attrs = ["Id", "nameTokenId", "typeStartTokenId", "typeEndTokenId",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cli/CMakeLists.txt 
new/cppcheck-2.7.4/cli/CMakeLists.txt
--- old/cppcheck-2.7.1/cli/CMakeLists.txt       2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cli/CMakeLists.txt       2022-03-25 06:58:59.000000000 
+0100
@@ -35,7 +35,7 @@
     endif()
 endif()
 if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
-    target_link_libraries(cppcheck tinyxml2)
+    target_link_libraries(cppcheck ${tinyxml2_LIBRARIES})
 endif()
 
 add_dependencies(cppcheck copy_cfg)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cli/cmdlineparser.cpp 
new/cppcheck-2.7.4/cli/cmdlineparser.cpp
--- old/cppcheck-2.7.1/cli/cmdlineparser.cpp    2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cli/cmdlineparser.cpp    2022-03-25 06:58:59.000000000 
+0100
@@ -46,6 +46,10 @@
 #include <tinyxml2.h>
 #endif
 
+#ifdef __linux__
+#include <unistd.h>
+#endif
+
 static void addFilesToList(const std::string& fileList, 
std::vector<std::string>& pathNames)
 {
     // To keep things initially simple, if the file can't be opened, just be 
silent and move on.
@@ -122,6 +126,14 @@
     bool maxconfigs = false;
 
     mSettings->exename = argv[0];
+#ifdef __linux__
+    // Executing cppcheck in PATH. argv[0] does not contain the path.
+    if (mSettings->exename.find_first_of("/\\") == std::string::npos) {
+        char buf[PATH_MAX] = {0};
+        if (FileLister::fileExists("/proc/self/exe") && 
readlink("/proc/self/exe", buf, sizeof(buf)-1) > 0)
+            mSettings->exename = buf;
+    }
+#endif
 
     for (int i = 1; i < argc; i++) {
         if (argv[i][0] == '-') {
@@ -882,6 +894,7 @@
             else if (std::strcmp(argv[i], "--version") == 0) {
                 mShowVersion = true;
                 mExitAfterPrint = true;
+                mSettings->loadCppcheckCfg();
                 return true;
             }
 
@@ -923,7 +936,7 @@
         }
     }
 
-    mSettings->loadCppcheckCfg(argv[0]);
+    mSettings->loadCppcheckCfg();
 
     // Default template format..
     if (mSettings->templateFormat.empty()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cli/cppcheckexecutor.cpp 
new/cppcheck-2.7.4/cli/cppcheckexecutor.cpp
--- old/cppcheck-2.7.1/cli/cppcheckexecutor.cpp 2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cli/cppcheckexecutor.cpp 2022-03-25 06:58:59.000000000 
+0100
@@ -109,12 +109,16 @@
 
     if (success) {
         if (parser.getShowVersion() && !parser.getShowErrorMessages()) {
-            const char * const extraVersion = CppCheck::extraVersion();
-            if (*extraVersion != 0)
-                std::cout << "Cppcheck " << CppCheck::version() << " ("
-                          << extraVersion << ')' << std::endl;
-            else
-                std::cout << "Cppcheck " << CppCheck::version() << std::endl;
+            if (!settings.cppcheckCfgProductName.empty()) {
+                std::cout << settings.cppcheckCfgProductName << std::endl;
+            } else {
+                const char * const extraVersion = CppCheck::extraVersion();
+                if (*extraVersion != 0)
+                    std::cout << "Cppcheck " << CppCheck::version() << " ("
+                              << extraVersion << ')' << std::endl;
+                else
+                    std::cout << "Cppcheck " << CppCheck::version() << 
std::endl;
+            }
         }
 
         if (parser.getShowErrorMessages()) {
@@ -243,9 +247,9 @@
     int ret;
 
     if (cppCheck.settings().exceptionHandling)
-        ret = check_wrapper(cppCheck, argc, argv);
+        ret = check_wrapper(cppCheck);
     else
-        ret = check_internal(cppCheck, argc, argv);
+        ret = check_internal(cppCheck);
 
     mSettings = nullptr;
     return ret;
@@ -821,12 +825,12 @@
  * TODO Check for multi-threading issues!
  *
  */
-int CppCheckExecutor::check_wrapper(CppCheck& cppcheck, int argc, const char* 
const argv[])
+int CppCheckExecutor::check_wrapper(CppCheck& cppcheck)
 {
 #ifdef USE_WINDOWS_SEH
     FILE *outputFile = stdout;
     __try {
-        return check_internal(cppcheck, argc, argv);
+        return check_internal(cppcheck);
     } __except (filterException(GetExceptionCode(), 
GetExceptionInformation())) {
         // reporting to stdout may not be helpful within a GUI application...
         fputs("Please report this to the cppcheck developers!\n", outputFile);
@@ -854,23 +858,23 @@
     for (std::map<int, std::string>::const_iterator sig=listofsignals.begin(); 
sig!=listofsignals.end(); ++sig) {
         sigaction(sig->first, &act, nullptr);
     }
-    return check_internal(cppcheck, argc, argv);
+    return check_internal(cppcheck);
 #else
-    return check_internal(cppcheck, argc, argv);
+    return check_internal(cppcheck);
 #endif
 }
 
 /*
  * That is a method which gets called from check_wrapper
  * */
-int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const 
char* const argv[])
+int CppCheckExecutor::check_internal(CppCheck& cppcheck)
 {
     Settings& settings = cppcheck.settings();
     mSettings = &settings;
-    const bool std = tryLoadLibrary(settings.library, argv[0], "std.cfg");
+    const bool std = tryLoadLibrary(settings.library, settings.exename, 
"std.cfg");
 
     for (const std::string &lib : settings.libraries) {
-        if (!tryLoadLibrary(settings.library, argv[0], lib.c_str())) {
+        if (!tryLoadLibrary(settings.library, settings.exename, lib.c_str())) {
             const std::string msg("Failed to load the library " + lib);
             const std::list<ErrorMessage::FileLocation> callstack;
             ErrorMessage errmsg(callstack, emptyString, Severity::information, 
msg, "failedToLoadCfg", Certainty::normal);
@@ -879,22 +883,15 @@
         }
     }
 
-    bool posix = true;
-    if (settings.posix())
-        posix = tryLoadLibrary(settings.library, argv[0], "posix.cfg");
-    bool windows = true;
-    if (settings.isWindowsPlatform())
-        windows = tryLoadLibrary(settings.library, argv[0], "windows.cfg");
-
-    if (!std || !posix || !windows) {
+    if (!std) {
         const std::list<ErrorMessage::FileLocation> callstack;
-        const std::string msg("Failed to load " + std::string(!std ? "std.cfg" 
: !posix ? "posix.cfg" : "windows.cfg") + ". Your Cppcheck installation is 
broken, please re-install.");
+        const std::string msg("Failed to load std.cfg. Your Cppcheck 
installation is broken, please re-install.");
 #ifdef FILESDIR
         const std::string details("The Cppcheck binary was compiled with 
FILESDIR set to \""
                                   FILESDIR "\" and will therefore search for "
                                   "std.cfg in " FILESDIR "/cfg.");
 #else
-        const std::string 
cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(argv[0])) + 
"cfg");
+        const std::string 
cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(settings.exename))
 + "cfg");
         const std::string details("The Cppcheck binary was compiled without 
FILESDIR set. Either the "
                                   "std.cfg should be available in " + 
cfgfolder + " or the FILESDIR "
                                   "should be configured.");
@@ -1143,9 +1140,9 @@
     return mExceptionOutput;
 }
 
-bool CppCheckExecutor::tryLoadLibrary(Library& destination, const char* 
basepath, const char* filename)
+bool CppCheckExecutor::tryLoadLibrary(Library& destination, const std::string& 
basepath, const char* filename)
 {
-    const Library::Error err = destination.load(basepath, filename);
+    const Library::Error err = destination.load(basepath.c_str(), filename);
 
     if (err.errorcode == Library::ErrorCode::UNKNOWN_ELEMENT)
         std::cout << "cppcheck: Found unknown elements in configuration file 
'" << filename << "': " << err.reason << std::endl;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cli/cppcheckexecutor.h 
new/cppcheck-2.7.4/cli/cppcheckexecutor.h
--- old/cppcheck-2.7.1/cli/cppcheckexecutor.h   2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cli/cppcheckexecutor.h   2022-03-25 06:58:59.000000000 
+0100
@@ -112,7 +112,7 @@
      * Tries to load a library and prints warning/error messages
      * @return false, if an error occurred (except unknown XML elements)
      */
-    static bool tryLoadLibrary(Library& destination, const char* basepath, 
const char* filename);
+    static bool tryLoadLibrary(Library& destination, const std::string& 
basepath, const char* filename);
 
     /**
      * Execute a shell command and read the output from it. Returns true if 
command terminated successfully.
@@ -151,24 +151,20 @@
      *   - installs optional platform dependent signal handling
      *
      * @param cppcheck cppcheck instance
-     * @param argc from main()
-     * @param argv from main()
      **/
-    int check_wrapper(CppCheck& cppcheck, int argc, const char* const argv[]);
+    int check_wrapper(CppCheck& cppcheck);
 
     /**
      * Starts the checking.
      *
      * @param cppcheck cppcheck instance
-     * @param argc from main()
-     * @param argv from main()
      * @return EXIT_FAILURE if arguments are invalid or no input files
      *         were found.
      *         If errors are found and --error-exitcode is used,
      *         given value is returned instead of default 0.
      *         If no errors are found, 0 is returned.
      */
-    int check_internal(CppCheck& cppcheck, int argc, const char* const argv[]);
+    int check_internal(CppCheck& cppcheck);
 
     /**
      * Pointer to current settings; set while check() is running.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cmake/clang_tidy.cmake 
new/cppcheck-2.7.4/cmake/clang_tidy.cmake
--- old/cppcheck-2.7.1/cmake/clang_tidy.cmake   2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cmake/clang_tidy.cmake   2022-03-25 06:58:59.000000000 
+0100
@@ -11,11 +11,11 @@
 message(STATUS "RUN_CLANG_TIDY=${RUN_CLANG_TIDY}")
 if (RUN_CLANG_TIDY)
     # disable all compiler warnings since we are just interested in the tidy 
ones
-    add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} -p=${CMAKE_BINARY_DIR} 
-j ${NPROC} -extra-arg=-w -quiet)
+    add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} 
-checks=-performance-unnecessary-copy-initialization -p=${CMAKE_BINARY_DIR} -j 
${NPROC} -extra-arg=-w -quiet)
     if (BUILD_GUI)
         add_dependencies(run-clang-tidy gui-build-deps)
         if (BUILD_TESTS)
             add_dependencies(run-clang-tidy triage-build-ui-deps)
         endif()
     endif()
-endif()
\ No newline at end of file
+endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cmake/findDependencies.cmake 
new/cppcheck-2.7.4/cmake/findDependencies.cmake
--- old/cppcheck-2.7.1/cmake/findDependencies.cmake     2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/cmake/findDependencies.cmake     2022-03-25 
06:58:59.000000000 +0100
@@ -48,12 +48,13 @@
 
 if (NOT USE_BUNDLED_TINYXML2)
     find_package(tinyxml2 QUIET)
-    if (NOT tinyxml2_FOUND)
-        find_library(tinyxml2_LIBRARY tinyxml2)
-        if (NOT tinyxml2_LIBRARY)
+    if (TARGET tinyxml2::tinyxml2)
+        set(tinyxml2_LIBRARIES "tinyxml2::tinyxml2")
+    else()
+        find_library(tinyxml2_LIBRARIES tinyxml2)
+        if (NOT tinyxml2_LIBRARIES)
             message(FATAL_ERROR "tinyxml2 has not been found")
         else()
-            message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}")
             set(tinyxml2_FOUND 1)
         endif()
     endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cmake/printInfo.cmake 
new/cppcheck-2.7.4/cmake/printInfo.cmake
--- old/cppcheck-2.7.1/cmake/printInfo.cmake    2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cmake/printInfo.cmake    2022-03-25 06:58:59.000000000 
+0100
@@ -52,7 +52,11 @@
     message( STATUS "Z3_LIBRARIES =          ${Z3_LIBRARIES}" )
     message( STATUS "Z3_CXX_INCLUDE_DIRS =   ${Z3_CXX_INCLUDE_DIRS}" )
 endif()
+message( STATUS )
 message( STATUS "USE_BUNDLED_TINYXML2 =  ${USE_BUNDLED_TINYXML2}" )
+if (NOT USE_BUNDLED_TINYXML2)
+    message(STATUS "tinyxml2_LIBRARIES =    ${tinyxml2_LIBRARIES}")
+endif()
 message( STATUS )
 
 if(${ANALYZE_ADDRESS})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/cmake/versions.cmake 
new/cppcheck-2.7.4/cmake/versions.cmake
--- old/cppcheck-2.7.1/cmake/versions.cmake     2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/cmake/versions.cmake     2022-03-25 06:58:59.000000000 
+0100
@@ -1,5 +1,5 @@
 # Version for libraries CPP
-SET(VERSION "2.7")
+SET(VERSION "2.7.4")
 STRING(REGEX MATCHALL "[0-9]" VERSION_PARTS "${VERSION}")
 LIST(GET VERSION_PARTS 0 VERSION_MAJOR)
 LIST(GET VERSION_PARTS 1 VERSION_MINOR)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/gui/CMakeLists.txt 
new/cppcheck-2.7.4/gui/CMakeLists.txt
--- old/cppcheck-2.7.1/gui/CMakeLists.txt       2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/gui/CMakeLists.txt       2022-03-25 06:58:59.000000000 
+0100
@@ -36,7 +36,7 @@
         target_link_libraries(cppcheck-gui ${Z3_LIBRARIES})
     endif()
     if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
-        target_link_libraries(cppcheck-gui tinyxml2)
+        target_link_libraries(cppcheck-gui ${tinyxml2_LIBRARIES})
     endif()
     target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets 
Qt5::PrintSupport Qt5::Help)
     if(WITH_QCHART)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/gui/mainwindow.cpp 
new/cppcheck-2.7.4/gui/mainwindow.cpp
--- old/cppcheck-2.7.1/gui/mainwindow.cpp       2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/gui/mainwindow.cpp       2022-03-25 06:58:59.000000000 
+0100
@@ -67,6 +67,13 @@
     mExiting(false),
     mIsLogfileLoaded(false)
 {
+    {
+        Settings tempSettings;
+        tempSettings.loadCppcheckCfg();
+        mCppcheckCfgProductName = 
QString::fromStdString(tempSettings.cppcheckCfgProductName);
+        mCppcheckCfgAbout = 
QString::fromStdString(tempSettings.cppcheckCfgAbout);
+    }
+
     mUI.setupUi(this);
     mThread = new ThreadHandler(this);
     mThread->setDataDir(getDataDir());
@@ -507,8 +514,6 @@
     checkSettings.checkLibrary = checkLibrary;
     checkSettings.checkConfiguration = checkConfiguration;
 
-    
checkSettings.loadCppcheckCfg(QCoreApplication::applicationFilePath().toStdString());
-
     if (mProjectFile)
         qDebug() << "Checking project file" << mProjectFile->getFilename();
 
@@ -854,15 +859,10 @@
     result.exename = QCoreApplication::applicationFilePath().toStdString();
 
     const bool std = tryLoadLibrary(&result.library, "std.cfg");
-    bool posix = true;
-    if (result.posix())
-        posix = tryLoadLibrary(&result.library, "posix.cfg");
-    bool windows = true;
-    if (result.isWindowsPlatform())
-        windows = tryLoadLibrary(&result.library, "windows.cfg");
+    if (!std)
+        QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your 
Cppcheck installation is broken. You can use --data-dir=<directory> at the 
command line to specify where this file is located. Please note that --data-dir 
is supposed to be used by installation scripts and therefore the GUI does not 
start when it is used, all that happens is that the setting is 
configured.").arg("std.cfg"));
 
-    if (!std || !posix || !windows)
-        QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your 
Cppcheck installation is broken. You can use --data-dir=<directory> at the 
command line to specify where this file is located. Please note that --data-dir 
is supposed to be used by installation scripts and therefore the GUI does not 
start when it is used, all that happens is that the setting is 
configured.").arg(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg"));
+    result.loadCppcheckCfg();
 
     // If project file loaded, read settings from it
     if (mProjectFile) {
@@ -1356,8 +1356,18 @@
 
 void MainWindow::about()
 {
-    AboutDialog *dlg = new AboutDialog(CppCheck::version(), 
CppCheck::extraVersion(), this);
-    dlg->exec();
+    if (!mCppcheckCfgAbout.isEmpty()) {
+        QMessageBox msg(QMessageBox::Information,
+                        tr("About"),
+                        mCppcheckCfgAbout,
+                        QMessageBox::Ok,
+                        this);
+        msg.exec();
+    }
+    else {
+        AboutDialog *dlg = new AboutDialog(CppCheck::version(), 
CppCheck::extraVersion(), this);
+        dlg->exec();
+    }
 }
 
 void MainWindow::showLicense()
@@ -1445,6 +1455,9 @@
         nameWithVersion += " (" + extraVersion + ")";
     }
 
+    if (!mCppcheckCfgProductName.isEmpty())
+        nameWithVersion = mCppcheckCfgProductName;
+
     QString title;
     if (text.isEmpty())
         title = nameWithVersion;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/gui/mainwindow.h 
new/cppcheck-2.7.4/gui/mainwindow.h
--- old/cppcheck-2.7.1/gui/mainwindow.h 2022-03-12 13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/gui/mainwindow.h 2022-03-25 06:58:59.000000000 +0100
@@ -472,6 +472,9 @@
      * List of MRU menu actions. Needs also to store the separator.
      */
     QAction *mRecentProjectActs[MaxRecentProjects + 1];
+
+    QString mCppcheckCfgAbout;
+    QString mCppcheckCfgProductName;
 };
 /// @}
 #endif // MAINWINDOW_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cppcheck-2.7.1/gui/test/benchmark/simple/CMakeLists.txt 
new/cppcheck-2.7.4/gui/test/benchmark/simple/CMakeLists.txt
--- old/cppcheck-2.7.1/gui/test/benchmark/simple/CMakeLists.txt 2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/gui/test/benchmark/simple/CMakeLists.txt 2022-03-25 
06:58:59.000000000 +0100
@@ -1,11 +1,13 @@
 qt5_wrap_cpp(test-benchmark-simple_SRC benchmarksimple.h)
 add_custom_target(build-testbenchmark-simple-deps SOURCES 
${test-benchmark-simple_SRC})
 add_dependencies(gui-build-deps build-testbenchmark-simple-deps)
+if(USE_BUNDLED_TINYXML2)
+    list(APPEND test-benchmark-simple_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
+endif()
 add_executable(benchmark-simple
         ${test-benchmark-simple_SRC}
         benchmarksimple.cpp
         $<TARGET_OBJECTS:lib_objs>
-        $<TARGET_OBJECTS:tinyxml2_objs>
         $<TARGET_OBJECTS:simplecpp_objs>
         )
 target_include_directories(benchmark-simple PRIVATE ${CMAKE_SOURCE_DIR}/lib)
@@ -16,4 +18,7 @@
 endif()
 if (USE_Z3)
     target_link_libraries(benchmark-simple ${Z3_LIBRARIES})
+endif()
+if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
+    target_link_libraries(benchmark-simple ${tinyxml2_LIBRARIES})
 endif()
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/gui/test/xmlreportv2/CMakeLists.txt 
new/cppcheck-2.7.4/gui/test/xmlreportv2/CMakeLists.txt
--- old/cppcheck-2.7.1/gui/test/xmlreportv2/CMakeLists.txt      2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/gui/test/xmlreportv2/CMakeLists.txt      2022-03-25 
06:58:59.000000000 +0100
@@ -22,4 +22,7 @@
 endif()
 if (USE_Z3)
     target_link_libraries(test-xmlreportv2 ${Z3_LIBRARIES})
-endif()
\ No newline at end of file
+endif()
+if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
+    target_link_libraries(test-xmlreportv2 ${tinyxml2_LIBRARIES})
+endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/lib/importproject.cpp 
new/cppcheck-2.7.4/lib/importproject.cpp
--- old/cppcheck-2.7.1/lib/importproject.cpp    2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/lib/importproject.cpp    2022-03-25 06:58:59.000000000 
+0100
@@ -147,22 +147,21 @@
 
 void ImportProject::FileSettings::setIncludePaths(const std::string &basepath, 
const std::list<std::string> &in, std::map<std::string, std::string, 
cppcheck::stricmp> &variables)
 {
-    std::list<std::string> listInc;
-    // only parse each includePath once - so remove duplicates
-    std::list<std::string> uniqueIncludePaths = in;
-    uniqueIncludePaths.sort();
-    uniqueIncludePaths.unique();
-
-    for (const std::string &it : uniqueIncludePaths) {
-        if (it.empty())
+    std::set<std::string> found;
+    const std::list<std::string> copyIn(in);
+    includePaths.clear();
+    for (const std::string &ipath : copyIn) {
+        if (ipath.empty())
+            continue;
+        if (ipath.compare(0,2,"%(")==0)
             continue;
-        if (it.compare(0,2,"%(")==0)
+        std::string s(Path::fromNativeSeparators(ipath));
+        if (!found.insert(s).second)
             continue;
-        std::string s(Path::fromNativeSeparators(it));
         if (s[0] == '/' || (s.size() > 1U && s.compare(1,2,":/") == 0)) {
             if (!endsWith(s,'/'))
                 s += '/';
-            listInc.push_back(s);
+            includePaths.push_back(s);
             continue;
         }
 
@@ -177,9 +176,8 @@
         }
         if (s.empty())
             continue;
-        listInc.push_back(s + '/');
+        includePaths.push_back(s + '/');
     }
-    includePaths.swap(listInc);
 }
 
 ImportProject::Type ImportProject::import(const std::string &filename, 
Settings *settings)
@@ -409,28 +407,38 @@
 
         const std::string directory = dirpath;
 
-        std::ostringstream comm;
-        if (obj.find("arguments") != obj.end()) {
+        std::string command;
+        if (obj.count("arguments")) {
             if (obj["arguments"].is<picojson::array>()) {
                 for (const picojson::value& arg : 
obj["arguments"].get<picojson::array>()) {
                     if (arg.is<std::string>()) {
-                        comm << arg.get<std::string>() << " ";
+                        std::string str = arg.get<std::string>();
+                        if (str.find(" ") != std::string::npos)
+                            str = "\"" + str + "\"";
+                        command += str + " ";
                     }
                 }
             } else {
                 printError("'arguments' field in compilation database entry is 
not a JSON array");
                 return false;
             }
-        } else if (obj.find("command") != obj.end()) {
+        } else if (obj.count("command")) {
             if (obj["command"].is<std::string>()) {
-                comm << obj["command"].get<std::string>();
+                command = obj["command"].get<std::string>();
+            } else {
+                printError("'command' field in compilation database entry is 
not a string");
+                return false;
             }
         } else {
             printError("no 'arguments' or 'command' field found in compilation 
database entry");
             return false;
         }
 
-        const std::string command = comm.str();
+        if (!obj.count("file") || !obj["file"].is<std::string>()) {
+            printError("skip compilation database entry because it does not 
have a proper 'file' field");
+            continue;
+        }
+
         const std::string file = 
Path::fromNativeSeparators(obj["file"].get<std::string>());
 
         // Accept file?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/lib/settings.cpp 
new/cppcheck-2.7.4/lib/settings.cpp
--- old/cppcheck-2.7.1/lib/settings.cpp 2022-03-12 13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/lib/settings.cpp 2022-03-25 06:58:59.000000000 +0100
@@ -76,9 +76,9 @@
     certainty.setEnabled(Certainty::normal, true);
 }
 
-void Settings::loadCppcheckCfg(const std::string &executable)
+void Settings::loadCppcheckCfg()
 {
-    std::string fileName = Path::getPathFromFilename(executable) + 
"cppcheck.cfg";
+    std::string fileName = Path::getPathFromFilename(exename) + "cppcheck.cfg";
 #ifdef FILESDIR
     if (Path::fileExists(FILESDIR "/cppcheck.cfg"))
         fileName = FILESDIR "/cppcheck.cfg";
@@ -92,6 +92,10 @@
     if (!picojson::get_last_error().empty())
         return;
     picojson::object obj = json.get<picojson::object>();
+    if (obj.count("productName") && obj["productName"].is<std::string>())
+        cppcheckCfgProductName = obj["productName"].get<std::string>();
+    if (obj.count("about") && obj["about"].is<std::string>())
+        cppcheckCfgAbout = obj["about"].get<std::string>();
     if (obj.count("addons") && obj["addons"].is<picojson::array>()) {
         for (const picojson::value &v : obj["addons"].get<picojson::array>()) {
             const std::string &s = v.get<std::string>();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/lib/settings.h 
new/cppcheck-2.7.4/lib/settings.h
--- old/cppcheck-2.7.1/lib/settings.h   2022-03-12 13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/lib/settings.h   2022-03-25 06:58:59.000000000 +0100
@@ -97,7 +97,7 @@
 public:
     Settings();
 
-    void loadCppcheckCfg(const std::string &executable);
+    void loadCppcheckCfg();
 
     /** @brief addons, either filename of python/json file or json data */
     std::list<std::string> addons;
@@ -156,6 +156,12 @@
     /** @brief include paths excluded from checking the configuration */
     std::set<std::string> configExcludePaths;
 
+    /** cppcheck.cfg: Custom product name */
+    std::string cppcheckCfgProductName;
+
+    /** cppcheck.cfg: About text */
+    std::string cppcheckCfgAbout;
+
     /** @brief Are we running from DACA script? */
     bool daca;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/lib/version.h 
new/cppcheck-2.7.4/lib/version.h
--- old/cppcheck-2.7.1/lib/version.h    2022-03-12 13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/lib/version.h    2022-03-25 06:58:59.000000000 +0100
@@ -8,8 +8,8 @@
 #define STRINGIFY(x) STRING(x)
 #define STRING(VER) #VER
 #if CPPCHECK_MINOR == CPPCHECK_DEVMINOR
-#define CPPCHECK_VERSION_STRING STRINGIFY(CPPCHECK_MAJOR) "." 
STRINGIFY(CPPCHECK_DEVMINOR)
-#define CPPCHECK_VERSION CPPCHECK_MAJOR,CPPCHECK_MINOR,0,0
+#define CPPCHECK_VERSION_STRING STRINGIFY(CPPCHECK_MAJOR) "." 
STRINGIFY(CPPCHECK_DEVMINOR) ".4"
+#define CPPCHECK_VERSION CPPCHECK_MAJOR,CPPCHECK_MINOR,4,0
 #else
 #define CPPCHECK_VERSION_STRING STRINGIFY(CPPCHECK_MAJOR) "." 
STRINGIFY(CPPCHECK_DEVMINOR) " dev"
 #define CPPCHECK_VERSION CPPCHECK_MAJOR,CPPCHECK_MINOR,99,0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/oss-fuzz/CMakeLists.txt 
new/cppcheck-2.7.4/oss-fuzz/CMakeLists.txt
--- old/cppcheck-2.7.1/oss-fuzz/CMakeLists.txt  2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/oss-fuzz/CMakeLists.txt  2022-03-25 06:58:59.000000000 
+0100
@@ -1,11 +1,19 @@
 if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-    add_executable(fuzz-client EXCLUDE_FROM_ALL
+    set(fuzz-client_SRC
             main.cpp
             type2.cpp
+    )
+    if(USE_BUNDLED_TINYXML2)
+        list(APPEND fuzz-client_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
+    endif()
+    add_executable(fuzz-client EXCLUDE_FROM_ALL
+            ${fuzz-client_SRC}
             $<TARGET_OBJECTS:simplecpp_objs>
-            $<TARGET_OBJECTS:tinyxml2_objs>
             $<TARGET_OBJECTS:lib_objs>)
-    target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib 
${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml2 
${CMAKE_SOURCE_DIR}/externals)
+    target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib 
${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals)
+    if(USE_BUNDLED_TINYXML2)
+        target_include_directories(fuzz-client PRIVATE 
${CMAKE_SOURCE_DIR}/externals/tinyxml2/)
+    endif()
     target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer)
     # TODO: target_link_options() requires CMake >= 3.13
     #target_link_options(fuzz-client PRIVATE -fsanitize=fuzzer)
@@ -16,6 +24,9 @@
     if (USE_Z3)
         target_link_libraries(fuzz-client PRIVATE ${Z3_LIBRARIES})
     endif()
+    if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
+        target_link_libraries(fuzz-client PRIVATE ${tinyxml2_LIBRARIES})
+    endif()
 
     add_executable(translate EXCLUDE_FROM_ALL
             translate.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/test/CMakeLists.txt 
new/cppcheck-2.7.4/test/CMakeLists.txt
--- old/cppcheck-2.7.1/test/CMakeLists.txt      2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/test/CMakeLists.txt      2022-03-25 06:58:59.000000000 
+0100
@@ -26,7 +26,7 @@
         endif()
     endif()
     if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
-        target_link_libraries(testrunner tinyxml2)
+        target_link_libraries(testrunner ${tinyxml2_LIBRARIES})
     endif()
 
     if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/test/cfg/runtests.sh 
new/cppcheck-2.7.4/test/cfg/runtests.sh
--- old/cppcheck-2.7.1/test/cfg/runtests.sh     2022-03-12 13:03:04.000000000 
+0100
+++ new/cppcheck-2.7.4/test/cfg/runtests.sh     2022-03-25 06:58:59.000000000 
+0100
@@ -70,9 +70,9 @@
 # windows.cpp
 # Syntax check via g++ does not work because it can not find a valid windows.h
 #${CXX} ${CXX_OPT} ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A  ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W  ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64  ${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A --library=windows 
${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W --library=windows 
${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64  --library=windows 
${DIR}windows.cpp
 
 # wxwidgets.cpp
 set +e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/test/testimportproject.cpp 
new/cppcheck-2.7.4/test/testimportproject.cpp
--- old/cppcheck-2.7.1/test/testimportproject.cpp       2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/test/testimportproject.cpp       2022-03-25 
06:58:59.000000000 +0100
@@ -58,6 +58,9 @@
         TEST_CASE(importCompileCommands6); // Windows/CMake/Ninja generated 
comile_commands.json with spaces
         TEST_CASE(importCompileCommands7); // linux: "/home/danielm/cppcheck 2"
         TEST_CASE(importCompileCommands8); // Windows: 
"C:\Users\danielm\cppcheck"
+        TEST_CASE(importCompileCommands9);
+        TEST_CASE(importCompileCommands10); // #10887: include path with space
+        TEST_CASE(importCompileCommands11); // include path order
         TEST_CASE(importCompileCommandsArgumentsSection); // Handle arguments 
section
         TEST_CASE(importCompileCommandsNoCommandSection); // gracefully 
handles malformed json
         TEST_CASE(importCppcheckGuiProject);
@@ -209,7 +212,8 @@
         TestImporter importer;
         importer.importCompileCommands(istr);
         ASSERT_EQUALS(2, importer.fileSettings.size());
-        ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/second src/", 
importer.fileSettings.begin()->includePaths.front());
+        ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/src/", 
importer.fileSettings.begin()->includePaths.front());
+        ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/second src/", 
importer.fileSettings.begin()->includePaths.back());
     }
 
 
@@ -243,12 +247,64 @@
             }])";
         std::istringstream istr(json);
         TestImporter importer;
+        importer.importCompileCommands(istr); // Do not crash
+    }
+
+    void importCompileCommands9() const {
+        // IAR output 
(https://sourceforge.net/p/cppcheck/discussion/general/thread/608af51e0a/)
+        const char json[] =
+            R"([{
+              "arguments" : [
+                 "powershell.exe -WindowStyle Hidden -NoProfile 
-ExecutionPolicy Bypass -File 
d:\\Projekte\\xyz\\firmware\\app\\xyz-lib\\build.ps1 -IAR -COMPILER_PATH 
\"c:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 9.0\" -CONTROLLER 
CC1310F128 -LIB LIB_PERMANENT -COMPILER_DEFINES \"CC1310_HFXO_FREQ=24000000 
DEBUG\""
+              ],
+              "directory" : "d:\\Projekte\\xyz\\firmware\\app",
+              "type" : "PRE",
+              "file": "1.c"
+            }])";
+        std::istringstream istr(json);
+        TestImporter importer;
         importer.importCompileCommands(istr);
+    }
+
+    void importCompileCommands10() const { // #10887
+        const char json[] =
+            R"([{
+               "file": "/home/danielm/cppcheck/1/test folder/1.c" ,
+               "directory": "",
+               "arguments": [
+                   "iccavr.exe",
+                   "-I",
+                   "/home/danielm/cppcheck/test folder"
+               ]
+            }])";
+        std::istringstream istr(json);
+        TestImporter importer;
+        ASSERT_EQUALS(true, importer.importCompileCommands(istr));
+        ASSERT_EQUALS(1, importer.fileSettings.size());
+        const ImportProject::FileSettings &fs = importer.fileSettings.front();
+        ASSERT_EQUALS("/home/danielm/cppcheck/test folder/", 
fs.includePaths.front());
+    }
+
+    void importCompileCommands11() const { // include path order
+        const char json[] =
+            R"([{
+               "file": "1.c" ,
+               "directory": "/x",
+               "arguments": [
+                   "cc",
+                   "-I",
+                   "def",
+                   "-I",
+                   "abc"
+               ]
+            }])";
+        std::istringstream istr(json);
+        TestImporter importer;
+        ASSERT_EQUALS(true, importer.importCompileCommands(istr));
         ASSERT_EQUALS(1, importer.fileSettings.size());
-        ASSERT_EQUALS("FILESDIR=\"C:\\Program Files\\Cppcheck\"", 
importer.fileSettings.begin()->defines);
-        ASSERT_EQUALS(2, importer.fileSettings.begin()->includePaths.size());
-        ASSERT_EQUALS("C:/Users/danielm/cppcheck/build/lib/", 
importer.fileSettings.begin()->includePaths.front());
-        ASSERT_EQUALS("C:/Users/danielm/cppcheck/lib/", 
importer.fileSettings.begin()->includePaths.back());
+        const ImportProject::FileSettings &fs = importer.fileSettings.front();
+        ASSERT_EQUALS("/x/def/", fs.includePaths.front());
+        ASSERT_EQUALS("/x/abc/", fs.includePaths.back());
     }
 
     void importCompileCommandsArgumentsSection() const {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cppcheck-2.7.1/win_installer/productInfo.wxi 
new/cppcheck-2.7.4/win_installer/productInfo.wxi
--- old/cppcheck-2.7.1/win_installer/productInfo.wxi    2022-03-12 
13:03:04.000000000 +0100
+++ new/cppcheck-2.7.4/win_installer/productInfo.wxi    2022-03-25 
06:58:59.000000000 +0100
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Include>
-  <?define ProductName = "Cppcheck $(var.Platform) 2.7" ?>
+  <?define ProductName = "Cppcheck $(var.Platform) 2.7.4" ?>
   <?define ProductNameShort = "Cppcheck" ?>
-  <?define ProductVersion = "2.7" ?>
+  <?define ProductVersion = "2.7.4" ?>
 
   <?define ProductManufacturer = "The Cppcheck team" ?>
   <?define ProductDescription = "Cppcheck is a tool for static analysis of 
C/C++ code" ?>

Reply via email to