From 34bd5992f9f6c7750fae4546ccd411fd94c685db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 13:45:48 +0200 Subject: [PATCH 1/7] Fix #14850 (Compilation fails on oraclelinux:8 (g++ 8.5.0 released in 2021)) --- .github/workflows/CI-unixish-docker.yml | 28 ++++++++++++++++++++++++- lib/settings.cpp | 4 ++-- lib/settings.h | 11 ++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index a38feb452f0..916ab4bace6 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -63,6 +63,12 @@ jobs: run: | apk add cmake make g++ pcre-dev + - name: Install missing software on Oracle Linux + if: contains(matrix.image, 'oraclelinux') + run: | + yum install -y git python3 which epel-release + yum install -y cmake3 gcc-c++ make pcre-devel + # needs to be called after the package installation since # - it doesn't call "apt-get update" - name: ccache @@ -87,7 +93,7 @@ jobs: strategy: matrix: - image: ["ubuntu:24.04", "ubuntu:25.10", "alpine:3.23"] + image: ["ubuntu:24.04", "ubuntu:25.10", "alpine:3.23", "oraclelinux:8"] fail-fast: false # Prefer quick result runs-on: ubuntu-22.04 @@ -111,6 +117,12 @@ jobs: run: | apk add make g++ pcre-dev bash python3 libxml2-utils + - name: Install missing software on Oracle Linux + if: contains(matrix.image, 'oraclelinux') + run: | + yum install -y git python3 which epel-release + yum install -y cmake3 gcc-c++ make pcre-devel + # needs to be called after the package installation since # - it doesn't call "apt-get update" - name: ccache @@ -121,15 +133,29 @@ jobs: # /usr/lib/ccache/bin - Alpine Linux - name: Build cppcheck + if: "!contains(matrix.image, 'oraclelinux')" run: | export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" + - name: Build cppcheck (Oracle Linux) + if: contains(matrix.image, 'oraclelinux') + run: | + export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" CPPFLAGS="-DGCC_BUG_HACK_NOEXCEPT" + - name: Build test + if: "!contains(matrix.image, 'oraclelinux')" run: | export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" testrunner + - name: Build test (Oracle Linux) + if: contains(matrix.image, 'oraclelinux') + run: | + export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" CPPFLAGS="-DGCC_BUG_HACK_NOEXCEPT" testrunner + - name: Run test run: | make -j$(nproc) HAVE_RULES=yes test diff --git a/lib/settings.cpp b/lib/settings.cpp index 95d4c4e953b..57c5def45a0 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -79,8 +79,8 @@ Settings::~Settings() = default; Settings::Settings(const Settings&) = default; Settings & Settings::operator=(const Settings &) = default; -Settings::Settings(Settings&&) noexcept = default; -Settings & Settings::operator=(Settings &&) noexcept = default; +Settings::Settings(Settings&&) NOEXCEPT = default; +Settings & Settings::operator=(Settings &&) NOEXCEPT = default; std::string Settings::loadCppcheckCfg(Settings& settings, Suppressions& suppressions, bool debug) { diff --git a/lib/settings.h b/lib/settings.h index 04ddb9adb9a..7f6e772a7c9 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -94,6 +94,13 @@ class SimpleEnableGroup { }; +#ifdef GCC_BUG_HACK_NOEXCEPT +#define NOEXCEPT +#else +#define NOEXCEPT noexcept +#endif + + /** * @brief This is just a container for general settings so that we don't need * to pass individual values to functions or constructors now or in the @@ -113,8 +120,8 @@ class CPPCHECKLIB WARN_UNUSED Settings { Settings(const Settings&); Settings& operator=(const Settings&); - Settings(Settings&&) noexcept; - Settings& operator=(Settings&&) noexcept; + Settings(Settings&&) NOEXCEPT; + Settings& operator=(Settings&&) NOEXCEPT; static std::string loadCppcheckCfg(Settings& settings, Suppressions& suppressions, bool debug = false); From bb014c5933fc591aeb458c3f01e2f28c4e5c8c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 15:10:00 +0200 Subject: [PATCH 2/7] format --- lib/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/settings.h b/lib/settings.h index 7f6e772a7c9..ae69aca4437 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -96,7 +96,7 @@ class SimpleEnableGroup { #ifdef GCC_BUG_HACK_NOEXCEPT #define NOEXCEPT -#else +#else #define NOEXCEPT noexcept #endif From 0850befc53609ef098f9f74fb36a0c7576f5ca7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 15:18:47 +0200 Subject: [PATCH 3/7] cleanup --- .github/workflows/CI-unixish-docker.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 916ab4bace6..4515a1ae622 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -63,12 +63,6 @@ jobs: run: | apk add cmake make g++ pcre-dev - - name: Install missing software on Oracle Linux - if: contains(matrix.image, 'oraclelinux') - run: | - yum install -y git python3 which epel-release - yum install -y cmake3 gcc-c++ make pcre-devel - # needs to be called after the package installation since # - it doesn't call "apt-get update" - name: ccache From 50fec8ea54d79022c100fd9988d711d84bc2e1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 17:42:31 +0200 Subject: [PATCH 4/7] rely on gcc version --- lib/settings.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/settings.h b/lib/settings.h index ae69aca4437..3af7f08fb71 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -94,7 +94,12 @@ class SimpleEnableGroup { }; -#ifdef GCC_BUG_HACK_NOEXCEPT +#if defined(__GNUC__) && __GNUC__ <= 9 +// Hack to workaround GCC bug. +// Details: https://trac.cppcheck.net/ticket/14850 +// seen on: +// oraclelinux:8, g++-8.5 +// ubuntu:20.04, g++-9.4.0 #define NOEXCEPT #else #define NOEXCEPT noexcept From e4b28088ca66b502f9b040dc9f3a0cc1337132eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 17:48:10 +0200 Subject: [PATCH 5/7] cleanup --- .github/workflows/CI-unixish-docker.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 4515a1ae622..d4468732028 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -127,29 +127,15 @@ jobs: # /usr/lib/ccache/bin - Alpine Linux - name: Build cppcheck - if: "!contains(matrix.image, 'oraclelinux')" run: | export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" - - name: Build cppcheck (Oracle Linux) - if: contains(matrix.image, 'oraclelinux') - run: | - export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" CPPFLAGS="-DGCC_BUG_HACK_NOEXCEPT" - - name: Build test - if: "!contains(matrix.image, 'oraclelinux')" run: | export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" testrunner - - name: Build test (Oracle Linux) - if: contains(matrix.image, 'oraclelinux') - run: | - export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" CPPFLAGS="-DGCC_BUG_HACK_NOEXCEPT" testrunner - - name: Run test run: | make -j$(nproc) HAVE_RULES=yes test From 1c6d7dd6e4b365575c3086d294d9a75d16a47cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 20:28:42 +0200 Subject: [PATCH 6/7] remove redundant semicolon --- lib/checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checks.h b/lib/checks.h index ec4a78c2008..9c053b81405 100644 --- a/lib/checks.h +++ b/lib/checks.h @@ -29,6 +29,6 @@ namespace CheckInstances { /** List of registered check classes. This is used by Cppcheck to run checks and generate documentation */ CPPCHECKLIB const std::list& get(); -}; +} #endif // checksH From 82d06df241c83a24cc9ceab012350c2bfc635b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jun 2026 20:44:51 +0200 Subject: [PATCH 7/7] clang-tidy --- lib/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/settings.h b/lib/settings.h index 3af7f08fb71..14d07404ebf 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -94,7 +94,7 @@ class SimpleEnableGroup { }; -#if defined(__GNUC__) && __GNUC__ <= 9 +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 9 // Hack to workaround GCC bug. // Details: https://trac.cppcheck.net/ticket/14850 // seen on: