From: Zbigniew Jędrzejewski-Szmek Date: Mon, 9 Mar 2026 12:18:22 +0000 (+0100) Subject: ci: reeanble compilation test with clang -O2, disable -Wmaybe-uninitialized for old gcc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F41003%2Fhead;p=thirdparty%2Fsystemd.git ci: reeanble compilation test with clang -O2, disable -Wmaybe-uninitialized for old gcc In CI we get spurious failures about unitialized variables with gcc versions older then (depending on the case) 12, 13, or 14. Let's only try to do this check with newer gcc which returns more useful results. At the same time, do compile with both gcc and clang at -O2, just disable the warning. The old logic seems to have been confused. We compile with -Wall, at least in some cases, which includes -Wmaybe-unitialized. So if we _don't_ want it, we need to explicitly disable it. --- diff --git a/.github/workflows/build-test.sh b/.github/workflows/build-test.sh index 3c6c6c50fee..506479a5584 100755 --- a/.github/workflows/build-test.sh +++ b/.github/workflows/build-test.sh @@ -12,7 +12,7 @@ success() { echo >&2 -e "\033[32;1m$1\033[0m"; } ARGS=( "--optimization=0 -Dopenssl=disabled -Dtpm=true -Dtpm2=enabled" "--optimization=s -Dutmp=false -Dc_args='-DOPENSSL_NO_UI_CONSOLE=1'" - "--optimization=2 -Dc_args=-Wmaybe-uninitialized -Ddns-over-tls=openssl" + "--optimization=2 -Ddns-over-tls=openssl" "--optimization=3 -Db_lto=true -Ddns-over-tls=false" "--optimization=3 -Db_lto=false -Dtpm2=disabled -Dlibfido2=disabled -Dp11kit=disabled -Defi=false -Dbootloader=disabled" "--optimization=3 -Dfexecve=true -Dstandalone-binaries=true -Dstatic-libsystemd=true -Dstatic-libudev=true" @@ -108,6 +108,11 @@ elif [[ "$COMPILER" == gcc ]]; then CFLAGS="" CXXFLAGS="" + # -Wmaybe-uninitialized works badly in old gcc versions + if [[ "$COMPILER_VERSION" -lt 14 ]]; then + CFLAGS="$CFLAGS -Wno-maybe-uninitialized" + fi + if ! apt-get -y install --dry-run "gcc-$COMPILER_VERSION" >/dev/null; then # Latest gcc stack deb packages provided by # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test @@ -162,11 +167,6 @@ ninja --version for args in "${ARGS[@]}"; do SECONDS=0 - if [[ "$COMPILER" == clang && "$args" =~ Wmaybe-uninitialized ]]; then - # -Wmaybe-uninitialized is not implemented in clang - continue - fi - info "Checking build with $args" # shellcheck disable=SC2086 if ! AR="$AR" \