]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: fix the string concatenation warning with clang-12 18470/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 8 Feb 2021 10:26:26 +0000 (11:26 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 8 Feb 2021 11:22:03 +0000 (12:22 +0100)
e.g.:
./src/shared/dissect-image.c:2218:39: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
                                      "/usr/lib/os-release\0",
                                      ^
../src/shared/dissect-image.c:2217:39: note: place parentheses around the string literal to silence warning
                [META_OS_RELEASE]   = "/etc/os-release\0"
                                      ^
1 error generated.

See: https://reviews.llvm.org/D85545

src/shared/dissect-image.c
src/xdg-autostart-generator/test-xdg-autostart.c

index 1643ae73be42e2313d7285a37df4c2a892b0d037..de94d3399cea3a6d448a76a7ef80dac56ed8c35f 100644 (file)
@@ -2214,8 +2214,8 @@ int dissected_image_acquire_metadata(DissectedImage *m) {
                 [META_HOSTNAME]     = "/etc/hostname\0",
                 [META_MACHINE_ID]   = "/etc/machine-id\0",
                 [META_MACHINE_INFO] = "/etc/machine-info\0",
-                [META_OS_RELEASE]   = "/etc/os-release\0"
-                                      "/usr/lib/os-release\0",
+                [META_OS_RELEASE]   = ("/etc/os-release\0"
+                                       "/usr/lib/os-release\0"),
         };
 
         _cleanup_strv_free_ char **machine_info = NULL, **os_release = NULL;
index a437e2cfedda3d5bd5da87e6a6bf81a35581f3b3..0b5f0b5db40ca9cf7da6aeddc74cdd2c161b2f83 100644 (file)
@@ -37,17 +37,17 @@ static void test_xdg_format_exec_start(void) {
 }
 
 static const char* const xdg_desktop_file[] = {
-        "[Desktop Entry]\n"
-        "Exec\t =\t /bin/sleep 100\n" /* Whitespace Before/After = must be ignored */
-        "OnlyShowIn = A;B;\n"
-        "NotShowIn=C;;D\\\\\\;;E\n", /* "C", "", "D\;", "E" */
+        ("[Desktop Entry]\n"
+         "Exec\t =\t /bin/sleep 100\n" /* Whitespace Before/After = must be ignored */
+         "OnlyShowIn = A;B;\n"
+         "NotShowIn=C;;D\\\\\\;;E\n"), /* "C", "", "D\;", "E" */
 
-        "[Desktop Entry]\n"
-        "Exec=a\n"
-        "Exec=b\n",
+        ("[Desktop Entry]\n"
+         "Exec=a\n"
+         "Exec=b\n"),
 
-        "[Desktop Entry]\n"
-        "Hidden=\t true\n",
+        ("[Desktop Entry]\n"
+         "Hidden=\t true\n"),
 };
 
 static void test_xdg_desktop_parse(unsigned i, const char *s) {