summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2025-01-15 18:41:51 +0100
committerMike Yuan <me@yhndnzj.com>2025-01-16 02:26:56 +0100
commit70923ed358d37e9b05d31556f1cb345e275c6f5d (patch)
treed2ac3dba6cf3a5a8a28e9072733417496fd65f5f
parenttree-wide: remove unnecessary gcc >= 7 version check (diff)
downloadsystemd-70923ed358d37e9b05d31556f1cb345e275c6f5d.tar.xz
systemd-70923ed358d37e9b05d31556f1cb345e275c6f5d.zip
meson: enable -Wzero-as-null-pointer-constant
Support for C added in gcc 15: https://github.com/gcc-mirror/gcc/commit/236c0829ee21a179c81b83f0d7f112ca23c47a4d
-rw-r--r--meson.build1
-rw-r--r--src/basic/filesystems-gperf.gperf3
-rw-r--r--src/basic/locale-util.c3
-rw-r--r--src/basic/lock-util.c2
-rw-r--r--src/core/load-fragment-gperf.gperf.in3
-rw-r--r--src/core/manager.c2
-rw-r--r--src/home/homed-gperf.gperf3
-rw-r--r--src/home/homed-manager.c2
-rw-r--r--src/journal/journald-gperf.gperf3
-rw-r--r--src/libsystemd/sd-hwdb/sd-hwdb.c2
-rw-r--r--src/login/logind-gperf.gperf3
-rw-r--r--src/network/netdev/netdev-gperf.gperf3
-rw-r--r--src/network/networkd-gperf.gperf3
-rw-r--r--src/network/networkd-network-gperf.gperf3
-rw-r--r--src/nspawn/nspawn-gperf.gperf3
-rw-r--r--src/oom/test-oomd-util.c13
-rwxr-xr-xsrc/resolve/generate-dns_type-gperf.py3
-rw-r--r--src/resolve/resolved-dnssd-gperf.gperf3
-rw-r--r--src/resolve/resolved-gperf.gperf3
-rw-r--r--src/shared/mount-util.c2
-rw-r--r--src/shared/numa-util.c2
-rw-r--r--src/shared/tpm2-util.c4
-rw-r--r--src/shared/vpick.c2
-rw-r--r--src/socket-activate/socket-activate.c2
-rw-r--r--src/test/test-fileio.c2
-rw-r--r--src/test/test-mempress.c2
-rw-r--r--src/test/test-netlink-manual.c4
-rw-r--r--src/test/test-seccomp.c8
-rw-r--r--src/timesync/timesyncd-gperf.gperf3
-rwxr-xr-xsrc/udev/generate-keyboard-keys-gperf.sh3
-rw-r--r--src/udev/net/link-config-gperf.gperf3
-rw-r--r--src/userdb/userdbctl.c4
-rwxr-xr-xtools/generate-gperfs.py3
33 files changed, 76 insertions, 29 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/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 a5656a42b3..5104c10719 100644
--- a/src/core/load-fragment-gperf.gperf.in
+++ b/src/core/load-fragment-gperf.gperf.in
@@ -269,6 +269,9 @@
%{
_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"
#include "conf-parser.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/home/homed-gperf.gperf b/src/home/homed-gperf.gperf
index 9c1028642e..d5b798a411 100644
--- a/src/home/homed-gperf.gperf
+++ b/src/home/homed-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "homed-conf.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 7163c402aa..317cfb6426 100644
--- a/src/journal/journald-gperf.gperf
+++ b/src/journal/journald-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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>
#include "conf-parser.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/login/logind-gperf.gperf b/src/login/logind-gperf.gperf
index da9fda6d4a..f09387e6a8 100644
--- a/src/login/logind-gperf.gperf
+++ b/src/login/logind-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "logind.h"
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
index 5cef68caa1..be61e208a0 100644
--- a/src/network/netdev/netdev-gperf.gperf
+++ b/src/network/netdev/netdev-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "batadv.h"
diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf
index e2b84f1384..2eb847d119 100644
--- a/src/network/networkd-gperf.gperf
+++ b/src/network/networkd-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "networkd-address-label.h"
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 891a96cc60..9a25be666b 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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 12b865299d..4356e0f4fa 100644
--- a/src/nspawn/nspawn-gperf.gperf
+++ b/src/nspawn/nspawn-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "nspawn-settings.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 b1837c7449..0fd003a802 100755
--- a/src/resolve/generate-dns_type-gperf.py
+++ b/src/resolve/generate-dns_type-gperf.py
@@ -11,6 +11,9 @@ name, prefix, input = sys.argv[1:]
print("""\
%{
_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
+#if __GNUC__ >= 15
+_Pragma("GCC diagnostic ignored \\"-Wzero-as-null-pointer-constant\\"")
+#endif
%}""")
print("""\
struct {}_name {{ const char* name; int id; }};
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 543115ea9e..d311754e76 100644
--- a/src/resolve/resolved-gperf.gperf
+++ b/src/resolve/resolved-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "resolved-conf.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 37eb56eed5..5543813f2d 100644
--- a/src/timesync/timesyncd-gperf.gperf
+++ b/src/timesync/timesyncd-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "timesyncd-conf.h"
diff --git a/src/udev/generate-keyboard-keys-gperf.sh b/src/udev/generate-keyboard-keys-gperf.sh
index 6d2f3606b8..fc34e4bd80 100755
--- a/src/udev/generate-keyboard-keys-gperf.sh
+++ b/src/udev/generate-keyboard-keys-gperf.sh
@@ -7,6 +7,9 @@ awk '
BEGIN {
print "%{\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; };"
print "%null-strings"
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf
index a313818e01..61e7d62410 100644
--- a/src/udev/net/link-config-gperf.gperf
+++ b/src/udev/net/link-config-gperf.gperf
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
%{
_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"
#include "ethtool-util.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 e2d6e30b7a..1e22a61406 100755
--- a/tools/generate-gperfs.py
+++ b/tools/generate-gperfs.py
@@ -17,6 +17,9 @@ if __name__ == '__main__':
print("""\
%{
_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
+#if __GNUC__ >= 15
+_Pragma("GCC diagnostic ignored \\"-Wzero-as-null-pointer-constant\\"")
+#endif
%}""")
print(f"""\
struct {name}_name {{ const char* name; int id; }};