'-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.
/* 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"
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;
.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");
%{
_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"
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");
/* 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"
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);
/* 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"
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);
/* 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"
/* 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"
/* 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"
/* 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>
/* 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"
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",
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) {
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; }};
/* 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"
/* 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"
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);
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))
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;
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;
.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;
_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);
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) {
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)));
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)));
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);
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);
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);
/* 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);
/* 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"
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"
/* 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"
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:
}
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:
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; }};