]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: bump C std to gnu17
authorMike Yuan <me@yhndnzj.com>
Thu, 16 Jan 2025 17:50:54 +0000 (18:50 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 17 Jan 2025 19:46:37 +0000 (19:46 +0000)
GCC 8.4 (our baseline) defaults to gnu17 already.

docs/CODING_STYLE.md
meson.build
src/basic/missing_threads.h

index 48fa4b093d0f06157eec9ba1733b9d1ea107d5e8..b8b420c1423c77c3e19f83dc8d2a04ee578c6559 100644 (file)
@@ -151,16 +151,16 @@ SPDX-License-Identifier: LGPL-2.1-or-later
 
 ## Code Organization and Semantics
 
-- For our codebase we intend to use ISO C11 *with* GNU extensions (aka
-  "gnu11"). Public APIs (i.e. those we expose via `libsystemd.so`
+- For our codebase we intend to use ISO C17 *with* GNU extensions (aka
+  "gnu17"). Public APIs (i.e. those we expose via `libsystemd.so`
   i.e. `systemd/sd-*.h`) should only use ISO C89 however (with a very limited
   set of conservative and common extensions, such as fixed size integer types
-  from `<inttypes.h>`), so that we don't force consuming programs into C11
+  from `<inttypes.h>`), so that we don't force consuming programs into C17
   mode. (This discrepancy in particular means one thing: internally we use C99
   `bool` booleans, externally C89-compatible `int` booleans which generally
   have different size in memory and slightly different semantics, also see
   below.)  Both for internal and external code it's OK to use even newer
-  features and GCC extension than "gnu11", as long as there's reasonable
+  features and GCC extension than "gnu17", as long as there's reasonable
   fallback #ifdeffery in place to ensure compatibility is retained with older
   compilers.
 
index 617d6d245283f3fc138856fa9e319ade8a95e7c8..d567f25566435215ee4d1c3bc7b419b65b8676ef 100644 (file)
@@ -4,7 +4,7 @@ project('systemd', 'c',
         version : files('meson.version'),
         license : 'LGPLv2+',
         default_options: [
-                'c_std=gnu11',
+                'c_std=gnu17',
                 'prefix=/usr',
                 'sysconfdir=/etc',
                 'localstatedir=/var',
@@ -1761,7 +1761,7 @@ python_39 = python.language_version().version_compare('>=3.9')
 
 if conf.get('BPF_FRAMEWORK') == 1
         bpf_clang_flags = [
-                '-std=gnu11',
+                '-std=gnu17',
                 '-Wno-compare-distinct-pointer-types',
                 '-fno-stack-protector',
                 '-O2',
@@ -1772,7 +1772,7 @@ if conf.get('BPF_FRAMEWORK') == 1
         ]
 
         bpf_gcc_flags = [
-                '-std=gnu11',
+                '-std=gnu17',
                 '-fno-stack-protector',
                 '-fno-ssa-phiopt',
                 '-O2',
index d48e05d586bf718481f9a36f7f9bc9d70c37c9bd..c7da1dbd5e0e27bb8d8a4566fd964f835417299a 100644 (file)
@@ -5,7 +5,7 @@
 #if HAVE_THREADS_H
 #  include <threads.h>
 #elif !(defined(thread_local))
-#  if __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__))
+#  ifndef __STDC_NO_THREADS__
 #    define thread_local _Thread_local
 #  else
 #    define thread_local __thread