From 0409b5d0eb94719963f65e3cf12c692fa03a2a64 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/2] Fix #14850 (Compilation fails on oraclelinux:8 (g++ 8.5.0 released in 2021)) --- .github/workflows/CI-unixish-docker.yml | 17 ++++++++++++++++- lib/checks.h | 2 +- lib/settings.cpp | 4 ++-- lib/settings.h | 16 ++++++++++++++-- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index a38feb452f0..9f594b8692b 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -30,6 +30,9 @@ jobs: - image: "alpine:3.23" with_gui: false # it appears FindQt6.cmake is not provided by any package full_build: false # FIXME: test-signalhandler.cpp fails to build since feenableexcept() is missing + - image: "oraclelinux:8" + with_gui: false # no qt6 are installed, missing GUI in old distros is OK + full_build: true fail-fast: false # Prefer quick result runs-on: ubuntu-22.04 @@ -63,6 +66,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 +96,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 +120,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 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 diff --git a/lib/settings.cpp b/lib/settings.cpp index 95d4c4e953b..c0539bbeaba 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&&) CPPCHECK_NOEXCEPT = default; +Settings & Settings::operator=(Settings &&) CPPCHECK_NOEXCEPT = default; std::string Settings::loadCppcheckCfg(Settings& settings, Suppressions& suppressions, bool debug) { diff --git a/lib/settings.h b/lib/settings.h index 04ddb9adb9a..4ec8f794fa5 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -94,6 +94,18 @@ class SimpleEnableGroup { }; +#if defined(__GNUC__) && !defined(__clang__) && __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 CPPCHECK_NOEXCEPT +#else +#define CPPCHECK_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 +125,8 @@ class CPPCHECKLIB WARN_UNUSED Settings { Settings(const Settings&); Settings& operator=(const Settings&); - Settings(Settings&&) noexcept; - Settings& operator=(Settings&&) noexcept; + Settings(Settings&&) CPPCHECK_NOEXCEPT; + Settings& operator=(Settings&&) CPPCHECK_NOEXCEPT; static std::string loadCppcheckCfg(Settings& settings, Suppressions& suppressions, bool debug = false); From f489f9932ca3ec66af920b0de73db1aa1f2cd998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 18 Jun 2026 13:31:36 +0200 Subject: [PATCH 2/2] gcc --- .github/workflows/CI-gcc-versions.yml | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/CI-gcc-versions.yml diff --git a/.github/workflows/CI-gcc-versions.yml b/.github/workflows/CI-gcc-versions.yml new file mode 100644 index 00000000000..a586a77aa82 --- /dev/null +++ b/.github/workflows/CI-gcc-versions.yml @@ -0,0 +1,38 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: CI-gcc-versions + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + strategy: + matrix: + image: ["gcc:6.5", "gcc:7.5", "gcc:8.5", "gcc:9.5"] + fail-fast: false + + runs-on: ubuntu-22.04 + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Build cppcheck + run: | + make -j$(nproc) CXXOPTS="-Werror"