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 <neal@gompa.dev>
This commit is contained in:
Neal Gompa 2026-01-06 05:25:58 -05:00
parent f72e3fae4a
commit 869d1291a6
2 changed files with 25 additions and 2 deletions

View file

@ -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:

View file

@ -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'),
]
)