From 05d933c18d179203ffd27a211247250cd3f50e40 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Wed, 10 Sep 2025 12:39:49 +0200 Subject: [PATCH] Enable -Wall -Wextra for all Linux runners With some exceptions. --- .github/workflows/linux.bash | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.bash b/.github/workflows/linux.bash index 6b4e9d16f..dffe4c456 100755 --- a/.github/workflows/linux.bash +++ b/.github/workflows/linux.bash @@ -5,6 +5,11 @@ export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/lib64/ccache:$PATH" export CCACHE_DIR=/icinga2/ccache export CTEST_OUTPUT_ON_FAILURE=1 CMAKE_OPTS=() +# -Wstringop-overflow is notorious for false positives and has been a problem for years. +# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 +# -Wtemplate-id-cdtor leaks from using the generated headers. We should reenable this once +# we're considering moving to C++20 and/or the -ti.hpp files are generated differently. +WARN_FLAGS="-Wall -Wextra -Wno-template-id-cdtor -Wno-stringop-overflow" case "$DISTRO" in alpine:*) @@ -79,14 +84,21 @@ esac case "$DISTRO" in alpine:*) - CMAKE_OPTS+=(-DUSE_SYSTEMD=OFF -DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF) + CMAKE_OPTS+=( + -DUSE_SYSTEMD=OFF + -DICINGA2_WITH_MYSQL=OFF + -DICINGA2_WITH_PGSQL=OFF + -DCMAKE_{C,CXX}_FLAGS="${WARN_FLAGS}" + ) ;; debian:*|ubuntu:*) CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON) source <(dpkg-buildflags --export=sh) + export CFLAGS="${CFLAGS} ${WARN_FLAGS}" + export CXXFLAGS="${CXXFLAGS} ${WARN_FLAGS}" ;; *) - CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}')") + CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}') ${WARN_FLAGS}") export LDFLAGS="$(rpm -E '%{?build_ldflags}')" ;; esac