]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build: use -std=c99 and -std=c++11 by default
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 30 Nov 2023 22:24:37 +0000 (23:24 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 1 Dec 2023 08:00:06 +0000 (09:00 +0100)
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 <thomas@t-8ch.de>
.github/workflows/cibuild.sh
meson.build

index bd77c053d73d8d5089a179f959b66491dd31ee32..be466daa25a9167d78e10751f7c68c06d9333a7a 100755 (executable)
@@ -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"
 
index fb2818a5d3ac92e6454a7b382de8ca5ac40c21fd..331d7582987b32dff25450f3c2b349357a6b0990 100644 (file)
@@ -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')