test,lsudev: add attribute format to println()

../test/lsudev.c: In function ‘println’:
  ../test/lsudev.c:68:5: warning: function ‘println’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
     68 |     g_string_append_vprintf (output, fmt, args);
        |     ^~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Aleksander Morgado
2021-09-07 11:24:16 +02:00
parent ba5ad78ed9
commit 145bbb4010

View File

@@ -50,6 +50,8 @@ setup_signals (void)
sigaction (SIGINT, &action, NULL); sigaction (SIGINT, &action, NULL);
} }
static void println (guint indent, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
static void static void
println (guint indent, const char *fmt, ...) println (guint indent, const char *fmt, ...)
{ {
@@ -90,8 +92,7 @@ dump_device_and_parent (GUdevDevice *device, guint indent)
println (indent, "Action: %s", g_udev_device_get_action (device)); println (indent, "Action: %s", g_udev_device_get_action (device));
println (indent, "Seq Num: %lu", g_udev_device_get_seqnum (device)); println (indent, "Seq Num: %lu", g_udev_device_get_seqnum (device));
println (indent, "Dev File: %s", g_udev_device_get_device_file (device)); println (indent, "Dev File: %s", g_udev_device_get_device_file (device));
println (indent, "-----------");
println (indent, "");
println (indent, "Properties:"); println (indent, "Properties:");
/* Get longest property name length for alignment */ /* Get longest property name length for alignment */
@@ -111,8 +112,6 @@ dump_device_and_parent (GUdevDevice *device, guint indent)
println (indent + 2, "%s", propstr); println (indent + 2, "%s", propstr);
} }
println (indent, "");
parent = g_udev_device_get_parent (device); parent = g_udev_device_get_parent (device);
if (parent) { if (parent) {
dump_device_and_parent (parent, indent + 4); dump_device_and_parent (parent, indent + 4);