From 7756528e9bb79394c87d9161761e67e16eb2c47b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 7 Apr 2021 14:22:30 +0200 Subject: [PATCH] tree-wide: use the same comment for work-around initializations This should make it easier to remove those warnings when the compiler gets smarter. Not sure if I got them all... Double space before the comment start to make it easier to separate from the preceding line. --- src/basic/cgroup-util.c | 2 +- src/basic/copy.c | 2 +- src/core/main.c | 2 +- src/test/test-capability.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 8d3e5237a8c..fb68d286f0a 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -660,7 +660,7 @@ int cg_remove_xattr(const char *controller, const char *path, const char *name) int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) { _cleanup_fclose_ FILE *f = NULL; - const char *fs, *controller_str = NULL; /* silence gcc warning about unitialized variable */ + const char *fs, *controller_str = NULL; /* avoid false maybe-uninitialized warning */ int unified, r; assert(pid >= 0); diff --git a/src/basic/copy.c b/src/basic/copy.c index d25777cc4b4..af9ac842a11 100644 --- a/src/basic/copy.c +++ b/src/basic/copy.c @@ -1072,7 +1072,7 @@ int copy_file_full( _cleanup_close_ int fdf = -1; struct stat st; - int fdt = -1, r; + int r, fdt = -1; /* avoid false maybe-uninitialized warning */ assert(from); assert(to); diff --git a/src/core/main.c b/src/core/main.c index 74dd895c588..63254b4a9c8 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1367,7 +1367,7 @@ static int status_welcome(void) { static int write_container_id(void) { const char *c; - int r = 0; /* silence gcc warning about r being unitialized below */ + int r = 0; /* avoid false maybe-uninitialized warning */ c = getenv("container"); if (isempty(c)) diff --git a/src/test/test-capability.c b/src/test/test-capability.c index bd17dc0e790..5fa8fe242ef 100644 --- a/src/test/test-capability.c +++ b/src/test/test-capability.c @@ -242,7 +242,7 @@ static void test_ensure_cap_64bit(void) { } int main(int argc, char *argv[]) { - bool run_ambient = false; /* unnecessary initialization to silence gcc warning */ + bool run_ambient = false; /* avoid false maybe-uninitialized warning */ test_setup_logging(LOG_INFO); -- 2.47.3