From 869d1291a62591b0d28c8fa9102ce9712056d46a Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 6 Jan 2026 05:25:58 -0500 Subject: [PATCH] meson, ci: Raise the minimum to C11 and use C17 or C23 if available C11 has been available for 15 years now, and virtually all reasonable C compilers support it. But we also want to opportunistically use C17 or C23 as they are stricter, which helps us have better code. This also adds test runs for the oldest standard supported. Signed-off-by: Neal Gompa --- .gitlab-ci.yml | 25 ++++++++++++++++++++++++- meson.build | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bde40e7f..cebec3b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -175,6 +175,11 @@ armv7-debian-container_prep: variables: MESON_BUILD_TYPE: "-Dbuildtype=release" +.build-oldstd: + stage: "Other build configurations" + variables: + MESON_ARGS: "-Dc_std=c11" + # OS/architecture-specific variants .build-env-debian-x86_64: @@ -222,7 +227,7 @@ armv7-debian-container_prep: - .ci-rules stage: "Build and test" script: - - meson setup $BUILDDIR --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons --fatal-meson-warnings -Dwerror=true ${MESON_BUILD_TYPE} + - meson setup $BUILDDIR --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons --fatal-meson-warnings -Dwerror=true ${MESON_BUILD_TYPE} ${MESON_ARGS} - ninja -C $BUILDDIR -k0 -j${FDO_CI_CONCURRENT:-4} - meson test -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4} - ninja -C $BUILDDIR clean @@ -278,6 +283,12 @@ x86_64-release-debian-build: - .do-build - .build-release +x86_64-oldstd-debian-build: + extends: + - .build-env-debian-x86_64 + - .do-build + - .build-oldstd + aarch64-debian-build: extends: - .build-env-debian-aarch64 @@ -289,6 +300,12 @@ aarch64-release-debian-build: - .do-build - .build-release +aarch64-oldstd-debian-build: + extends: + - .build-env-debian-aarch64 + - .do-build + - .build-oldstd + armv7-debian-build: extends: - .build-env-debian-armv7 @@ -300,6 +317,12 @@ armv7-release-debian-build: - .do-build - .build-release +armv7-oldstd-debian-build: + extends: + - .build-env-debian-armv7 + - .do-build + - .build-oldstd + # Base variables used for anything using a FreeBSD environment .os-freebsd: variables: diff --git a/meson.build b/meson.build index 7ad5ac06..2109e418 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( default_options: [ 'warning_level=2', 'buildtype=debugoptimized', - 'c_std=c99', + 'c_std=' + (meson.version().version_compare('>=1.3.0') ? 'c23,c17,c11' : 'c11'), ] )