From: Thomas Weißschuh Date: Thu, 30 Nov 2023 22:24:37 +0000 (+0100) Subject: build: use -std=c99 and -std=c++11 by default X-Git-Tag: v2.40-rc1~132^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6240e4458cdf5a17c7b795def33b81cb5a987aed;p=thirdparty%2Futil-linux.git build: use -std=c99 and -std=c++11 by default Relying on the compiler default is problematic: * New constructs may be introduced accidentally that break backwards compatibility. * Older compilers may default to a more restricted standard than the codebase is actually developed with. Explicitly select C99 (and C++11 for the fuzzing part). Autotools does not want to default to C99, so set it explcitly during CI. Signed-off-by: Thomas Weißschuh --- diff --git a/.github/workflows/cibuild.sh b/.github/workflows/cibuild.sh index bd77c053d7..be466daa25 100755 --- a/.github/workflows/cibuild.sh +++ b/.github/workflows/cibuild.sh @@ -5,8 +5,8 @@ set -ex PHASES=(${@:-CONFIGURE MAKE INSTALL CHECK DISTCHECK}) COMPILER="${COMPILER:?}" COMPILER_VERSION="${COMPILER_VERSION}" -CFLAGS=(-O1 -g) -CXXFLAGS=(-O1 -g) +CFLAGS=(-O1 -g -std=c99) +CXXFLAGS=(-O1 -g -std=c++11) LDFLAGS=() COVERITY_SCAN_TOOL_BASE="/tmp/coverity-scan-analysis" diff --git a/meson.build b/meson.build index fb2818a5d3..331d758298 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,11 @@ project('util-linux', 'c', version : run_command('tools/git-version-gen', check: true).stdout(), meson_version: '>=0.60.0', - license : 'GPLv2+') + license : 'GPLv2+', + default_options : [ + 'c_std=c99', + 'cpp_std=c++11', + ]) fs = import('fs') pkgconfig = import('pkgconfig')