diff options
author | Lennart Poettering <lennart@poettering.net> | 2025-01-16 07:48:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-16 07:48:21 +0100 |
commit | 30adccf3d4c298e0b5f8cee19bab1d70c8726b2d (patch) | |
tree | 35e72bec00106daf8d55876ea68810face263ec2 | |
parent | pid1: add GracefulOptions= setting to .mount units (#36023) (diff) | |
parent | meson: enable -Wzero-as-null-pointer-constant (diff) | |
download | systemd-30adccf3d4c298e0b5f8cee19bab1d70c8726b2d.tar.xz systemd-30adccf3d4c298e0b5f8cee19bab1d70c8726b2d.zip |
meson: enable -Wzero-as-null-pointer-constant (#36028)
Support for C added in gcc 15:
https://github.com/gcc-mirror/gcc/commit/236c0829ee21a179c81b83f0d7f112ca23c47a4d
36 files changed, 65 insertions, 50 deletions
diff --git a/meson.build b/meson.build index de92fbe771..5c364e1379 100644 --- a/meson.build +++ b/meson.build @@ -412,6 +412,7 @@ possible_common_cc_flags = [ '-Wunterminated-string-initialization', '-Wunused-function', '-Wwrite-strings', + '-Wzero-as-null-pointer-constant', '-Wzero-length-bounds', # negative arguments are correctly detected starting with meson 0.46. diff --git a/src/basic/MurmurHash2.c b/src/basic/MurmurHash2.c index 43a89a0820..bb4cd6b906 100644 --- a/src/basic/MurmurHash2.c +++ b/src/basic/MurmurHash2.c @@ -16,9 +16,7 @@ #include "MurmurHash2.h" -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") -#endif //----------------------------------------------------------------------------- // Platform-specific functions and macros diff --git a/src/basic/filesystems-gperf.gperf b/src/basic/filesystems-gperf.gperf index c82fe98227..23c9372af2 100644 --- a/src/basic/filesystems-gperf.gperf +++ b/src/basic/filesystems-gperf.gperf @@ -1,5 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") +#endif #include <linux/magic.h> #include "filesystems.h" diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index 23565273dd..09bdb37300 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -276,8 +276,7 @@ int locale_is_installed(const char *name) { if (STR_IN_SET(name, "C", "POSIX")) /* These ones are always OK */ return true; - _cleanup_(freelocalep) locale_t loc = - newlocale(LC_ALL_MASK, name, 0); + _cleanup_(freelocalep) locale_t loc = newlocale(LC_ALL_MASK, name, (locale_t) 0); if (loc == (locale_t) 0) return errno == ENOMEM ? -ENOMEM : false; diff --git a/src/basic/lock-util.c b/src/basic/lock-util.c index db9905cb48..7dad009c1e 100644 --- a/src/basic/lock-util.c +++ b/src/basic/lock-util.c @@ -231,7 +231,7 @@ int lock_generic_with_timeout(int fd, LockType type, int operation, usec_t timeo .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, }; - timer_t id = 0; + timer_t id; if (timer_create(CLOCK_MONOTONIC, &sev, &id) < 0) { log_error_errno(errno, "Failed to allocate CLOCK_MONOTONIC timer: %m"); diff --git a/src/core/load-fragment-gperf.gperf.in b/src/core/load-fragment-gperf.gperf.in index 1033d08103..1363d7903f 100644 --- a/src/core/load-fragment-gperf.gperf.in +++ b/src/core/load-fragment-gperf.gperf.in @@ -268,8 +268,9 @@ {%- endmacro -%} %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "all-units.h" diff --git a/src/core/manager.c b/src/core/manager.c index 1b629b1378..72b9290dc0 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2002,7 +2002,7 @@ static void manager_preset_all(Manager *m) { UnitFilePresetMode mode = ENABLE_FIRST_BOOT_FULL_PRESET ? UNIT_FILE_PRESET_FULL : UNIT_FILE_PRESET_ENABLE_ONLY; - r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, 0, NULL, mode, NULL, 0); + r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, 0, NULL, mode, NULL, NULL); if (r < 0) log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, "Failed to populate /etc with preset unit settings, ignoring: %m"); diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index 35758b5b18..709657dd28 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -84,10 +84,10 @@ # define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) #endif -#if __GNUC__ >= 7 || (defined(__clang__) && __clang_major__ >= 10) -# define _fallthrough_ __attribute__((__fallthrough__)) -#else +#if defined(__clang__) && __clang_major__ < 10 # define _fallthrough_ +#else +# define _fallthrough_ __attribute__((__fallthrough__)) #endif #define XSTRINGIFY(x) #x diff --git a/src/home/homed-gperf.gperf b/src/home/homed-gperf.gperf index 39aca35b08..d5b798a411 100644 --- a/src/home/homed-gperf.gperf +++ b/src/home/homed-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index de7c3d8dbe..bb4ad1f99f 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -1455,7 +1455,7 @@ static int manager_generate_key_pair(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to open key file for writing: %m"); - if (PEM_write_PrivateKey(fprivate, m->private_key, NULL, NULL, 0, NULL, 0) <= 0) + if (PEM_write_PrivateKey(fprivate, m->private_key, NULL, NULL, 0, NULL, NULL) <= 0) return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write private key pair."); r = fflush_sync_and_check(fprivate); diff --git a/src/journal/journald-gperf.gperf b/src/journal/journald-gperf.gperf index 49987f5fae..317cfb6426 100644 --- a/src/journal/journald-gperf.gperf +++ b/src/journal/journald-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include <sys/socket.h> diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index 588fb0313b..90cf80f199 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -319,7 +319,7 @@ static int hwdb_new(const char *path, sd_hwdb **ret) { if (file_offset_beyond_memory_size(hwdb->st.st_size)) return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), "File %s is too long.", path); - hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0); + hwdb->map = mmap(NULL, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0); if (hwdb->map == MAP_FAILED) return log_debug_errno(errno, "Failed to map %s: %m", path); diff --git a/src/libsystemd/sd-journal/lookup3.c b/src/libsystemd/sd-journal/lookup3.c index c2a640687c..8e3dac05af 100644 --- a/src/libsystemd/sd-journal/lookup3.c +++ b/src/libsystemd/sd-journal/lookup3.c @@ -55,9 +55,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. # include <endian.h> /* attempt to define endianness */ #endif -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") -#endif /* * My best guess at if you are big-endian or little-endian. This may diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf index e7f39fed2a..f09387e6a8 100644 --- a/src/login/logind-gperf.gperf +++ b/src/login/logind-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index be010665c5..be61e208a0 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "bareudp.h" diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf index 21e8d12690..2eb847d119 100644 --- a/src/network/networkd-gperf.gperf +++ b/src/network/networkd-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index dc462b690c..9a25be666b 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <netinet/icmp6.h> #include <stddef.h> diff --git a/src/nspawn/nspawn-gperf.gperf b/src/nspawn/nspawn-gperf.gperf index 123ef0c6c8..4356e0f4fa 100644 --- a/src/nspawn/nspawn-gperf.gperf +++ b/src/nspawn/nspawn-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/oom/test-oomd-util.c b/src/oom/test-oomd-util.c index 53109c160d..d124132e0b 100644 --- a/src/oom/test-oomd-util.c +++ b/src/oom/test-oomd-util.c @@ -330,7 +330,7 @@ static void test_oomd_mem_and_swap_free_below(void) { static void test_oomd_sort_cgroups(void) { _cleanup_hashmap_free_ Hashmap *h = NULL; - _cleanup_free_ OomdCGroupContext **sorted_cgroups; + _cleanup_free_ OomdCGroupContext **sorted_cgroups = NULL; char **paths = STRV_MAKE("/herp.slice", "/herp.slice/derp.scope", "/herp.slice/derp.scope/sheep.service", @@ -408,12 +408,11 @@ static void test_oomd_sort_cgroups(void) { assert_se(oomd_sort_cgroup_contexts(h, compare_pgscan_rate_and_memory_usage, "/herp.slice/derp.scope", &sorted_cgroups) == 2); assert_se(sorted_cgroups[0] == &ctx[2]); assert_se(sorted_cgroups[1] == &ctx[1]); - assert_se(sorted_cgroups[2] == 0); - assert_se(sorted_cgroups[3] == 0); - assert_se(sorted_cgroups[4] == 0); - assert_se(sorted_cgroups[5] == 0); - assert_se(sorted_cgroups[6] == 0); - sorted_cgroups = mfree(sorted_cgroups); + ASSERT_NULL(sorted_cgroups[2]); + ASSERT_NULL(sorted_cgroups[3]); + ASSERT_NULL(sorted_cgroups[4]); + ASSERT_NULL(sorted_cgroups[5]); + ASSERT_NULL(sorted_cgroups[6]); } static void test_oomd_fetch_cgroup_oom_preference(void) { diff --git a/src/resolve/generate-dns_type-gperf.py b/src/resolve/generate-dns_type-gperf.py index 0d818fb3d9..0fd003a802 100755 --- a/src/resolve/generate-dns_type-gperf.py +++ b/src/resolve/generate-dns_type-gperf.py @@ -10,8 +10,9 @@ name, prefix, input = sys.argv[1:] print("""\ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \\"-Wzero-as-null-pointer-constant\\"") #endif %}""") print("""\ diff --git a/src/resolve/resolved-dnssd-gperf.gperf b/src/resolve/resolved-dnssd-gperf.gperf index a5158390c9..b31b30ec6e 100644 --- a/src/resolve/resolved-dnssd-gperf.gperf +++ b/src/resolve/resolved-dnssd-gperf.gperf @@ -1,5 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") +#endif #include <stddef.h> #include "conf-parser.h" #include "resolved-dnssd.h" diff --git a/src/resolve/resolved-gperf.gperf b/src/resolve/resolved-gperf.gperf index 68839352f5..d311754e76 100644 --- a/src/resolve/resolved-gperf.gperf +++ b/src/resolve/resolved-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 0d8a1f68eb..39aa3d3ec8 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -542,7 +542,7 @@ int mount_switch_root_full(const char *path, unsigned long mount_propagation_fla if (mount_propagation_flag == 0) return 0; - if (mount(NULL, ".", NULL, mount_propagation_flag | MS_REC, 0) < 0) + if (mount(NULL, ".", NULL, mount_propagation_flag | MS_REC, NULL) < 0) return log_debug_errno(errno, "Failed to turn new rootfs '%s' into %s mount: %m", mount_propagation_flag_to_string(mount_propagation_flag), path); diff --git a/src/shared/numa-util.c b/src/shared/numa-util.c index a954ea349e..b4f815277a 100644 --- a/src/shared/numa-util.c +++ b/src/shared/numa-util.c @@ -72,7 +72,7 @@ int apply_numa_policy(const NUMAPolicy *policy) { assert(policy); - if (get_mempolicy(NULL, NULL, 0, 0, 0) < 0 && errno == ENOSYS) + if (get_mempolicy(NULL, NULL, 0, NULL, 0) < 0 && errno == ENOSYS) return -EOPNOTSUPP; if (!numa_policy_is_valid(policy)) diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index 29d9dbbe2e..b4ae74f17a 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -5201,8 +5201,8 @@ static int tpm2_calculate_seal_ecc_seed( r = ecc_pkey_to_curve_x_y( parent_pkey, &curve_id, - /* ret_x= */ NULL, /* ret_x_size= */ 0, - /* ret_y= */ NULL, /* ret_y_size= */ 0); + /* ret_x= */ NULL, /* ret_x_size= */ NULL, + /* ret_y= */ NULL, /* ret_y_size= */ NULL); if (r < 0) return r; diff --git a/src/shared/vpick.c b/src/shared/vpick.c index c2ca800af5..08f6dd72d9 100644 --- a/src/shared/vpick.c +++ b/src/shared/vpick.c @@ -151,7 +151,7 @@ static int pin_choice( r = chaseat(toplevel_fd, inode_path, CHASE_AT_RESOLVE_IN_ROOT, - FLAGS_SET(flags, PICK_RESOLVE) ? &resolved_path : 0, + FLAGS_SET(flags, PICK_RESOLVE) ? &resolved_path : NULL, inode_fd < 0 ? &inode_fd : NULL); if (r < 0) return r; diff --git a/src/socket-activate/socket-activate.c b/src/socket-activate/socket-activate.c index 9234bb33cd..134ed3f0de 100644 --- a/src/socket-activate/socket-activate.c +++ b/src/socket-activate/socket-activate.c @@ -284,7 +284,7 @@ static int install_chld_handler(void) { .sa_handler = sigchld_hdl, }; - if (sigaction(SIGCHLD, &act, 0) < 0) + if (sigaction(SIGCHLD, &act, NULL) < 0) return log_error_errno(errno, "Failed to install SIGCHLD handler: %m"); return 0; diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index 60b568b2d2..dbd175ad70 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -955,7 +955,7 @@ TEST(read_full_file_socket) { _cleanup_close_ int rfd = -EBADF; /* child */ - rfd = accept4(listener, NULL, 0, SOCK_CLOEXEC); + rfd = accept4(listener, NULL, NULL, SOCK_CLOEXEC); assert_se(rfd >= 0); assert_se(getpeername(rfd, &peer.sa, &peerlen) >= 0); diff --git a/src/test/test-mempress.c b/src/test/test-mempress.c index 44f1f4cf5f..dfbd63e601 100644 --- a/src/test/test-mempress.c +++ b/src/test/test-mempress.c @@ -43,7 +43,7 @@ static void *fake_pressure_thread(void *p) { ASSERT_STREQ(buf, "hello"); assert_se(write(cfd, &(const char) { 'z' }, 1) == 1); - return 0; + return NULL; } static int fake_pressure_callback(sd_event_source *s, void *userdata) { diff --git a/src/test/test-netlink-manual.c b/src/test/test-netlink-manual.c index 8c1b0d407e..913998ad50 100644 --- a/src/test/test-netlink-manual.c +++ b/src/test/test-netlink-manual.c @@ -82,7 +82,7 @@ static int test_tunnel_configure(sd_netlink *rtnl) { assert_se(sd_netlink_message_close_container(m) >= 0); assert_se(sd_netlink_message_close_container(m) >= 0); - assert_se(sd_netlink_call(rtnl, m, -1, 0) == 1); + ASSERT_OK_POSITIVE(sd_netlink_call(rtnl, m, -1, NULL)); ASSERT_NULL((m = sd_netlink_message_unref(m))); @@ -108,7 +108,7 @@ static int test_tunnel_configure(sd_netlink *rtnl) { assert_se(sd_netlink_message_close_container(n) >= 0); assert_se(sd_netlink_message_close_container(n) >= 0); - assert_se(sd_netlink_call(rtnl, n, -1, 0) == 1); + ASSERT_OK_POSITIVE(sd_netlink_call(rtnl, n, -1, NULL)); ASSERT_NULL((n = sd_netlink_message_unref(n))); diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c index b400908978..d006e8b7b0 100644 --- a/src/test/test-seccomp.c +++ b/src/test/test-seccomp.c @@ -487,7 +487,7 @@ TEST(restrict_address_families) { safe_close(fd); assert_se(s = set_new(NULL)); - assert_se(set_put(s, INT_TO_PTR(AF_UNIX)) >= 0); + ASSERT_OK(set_put(s, INT_TO_PTR(AF_UNIX))); assert_se(seccomp_restrict_address_families(s, false) >= 0); @@ -510,7 +510,7 @@ TEST(restrict_address_families) { set_clear(s); - assert_se(set_put(s, INT_TO_PTR(AF_INET)) >= 0); + ASSERT_OK(set_put(s, INT_TO_PTR(AF_INET))); assert_se(seccomp_restrict_address_families(s, true) >= 0); @@ -751,7 +751,7 @@ TEST(restrict_archs) { assert_se(s = set_new(NULL)); #ifdef __x86_64__ - assert_se(set_put(s, UINT32_TO_PTR(SCMP_ARCH_X86+1)) >= 0); + ASSERT_OK(set_put(s, UINT32_TO_PTR(SCMP_ARCH_X86+1))); #endif assert_se(seccomp_restrict_archs(s) >= 0); @@ -901,7 +901,7 @@ TEST(native_syscalls_filtered) { /* Passing "native" or an empty set is equivalent, just do both here. */ assert_se(arch_s = set_new(NULL)); assert_se(seccomp_restrict_archs(arch_s) >= 0); - assert_se(set_put(arch_s, SCMP_ARCH_NATIVE) >= 0); + ASSERT_OK(set_put(arch_s, (void*) SCMP_ARCH_NATIVE)); assert_se(seccomp_restrict_archs(arch_s) >= 0); assert_se(access("/", F_OK) >= 0); diff --git a/src/timesync/timesyncd-gperf.gperf b/src/timesync/timesyncd-gperf.gperf index 731dea12e3..5543813f2d 100644 --- a/src/timesync/timesyncd-gperf.gperf +++ b/src/timesync/timesyncd-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/udev/generate-keyboard-keys-gperf.sh b/src/udev/generate-keyboard-keys-gperf.sh index 9f4364c172..fc34e4bd80 100755 --- a/src/udev/generate-keyboard-keys-gperf.sh +++ b/src/udev/generate-keyboard-keys-gperf.sh @@ -6,8 +6,9 @@ set -eu awk ' BEGIN { print "%{\n\ -#if __GNUC__ >= 7\n\ _Pragma(\"GCC diagnostic ignored \\\"-Wimplicit-fallthrough\\\"\")\n\ +#if __GNUC__ >= 15\n\ +_Pragma(\"GCC diagnostic ignored \\\"-Wzero-as-null-pointer-constant\\\"\")\n\ #endif\n\ %}" print "struct key_name { const char* name; unsigned short id; };" diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf index e4db56e844..61e7d62410 100644 --- a/src/udev/net/link-config-gperf.gperf +++ b/src/udev/net/link-config-gperf.gperf @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") #endif #include <stddef.h> #include "conf-parser.h" diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index 74057f6593..e47c3761d0 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -98,7 +98,7 @@ static int show_user(UserRecord *ur, Table *table) { break; case OUTPUT_JSON: - sd_json_variant_dump(ur->json, arg_json_format_flags, NULL, 0); + sd_json_variant_dump(ur->json, arg_json_format_flags, NULL, NULL); break; case OUTPUT_FRIENDLY: @@ -540,7 +540,7 @@ static int show_group(GroupRecord *gr, Table *table) { } case OUTPUT_JSON: - sd_json_variant_dump(gr->json, arg_json_format_flags, NULL, 0); + sd_json_variant_dump(gr->json, arg_json_format_flags, NULL, NULL); break; case OUTPUT_FRIENDLY: diff --git a/tools/generate-gperfs.py b/tools/generate-gperfs.py index 3887bb6ee9..1e22a61406 100755 --- a/tools/generate-gperfs.py +++ b/tools/generate-gperfs.py @@ -16,8 +16,9 @@ if __name__ == '__main__': print("""\ %{ -#if __GNUC__ >= 7 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"") +#if __GNUC__ >= 15 +_Pragma("GCC diagnostic ignored \\"-Wzero-as-null-pointer-constant\\"") #endif %}""") print(f"""\ |