GCC 9 gives this error which I believe is bogus:
qemuopts.c: In function 'qemuopts_to_config_channel':
qemuopts.c:987:29: error: '%.*s' directive output between 0 and 2147483647 bytes
may exceed minimum required size of 4095 [-Werror=format-overflow=]
987 | fprintf (fp, " %.*s = ", (int) k, values[j]);
| ^~~~
qemuopts.c:987:26: note: assuming directive output of 1 byte
987 | fprintf (fp, " %.*s = ", (int) k, values[j]);
| ^~~~~~~~~~~
---
m4/guestfs-c.m4 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
index 3fd44ed6b..e20721f5f 100644
--- a/m4/guestfs-c.m4
+++ b/m4/guestfs-c.m4
@@ -105,6 +105,9 @@ gl_WARN_ADD([-Wimplicit-fallthrough=4])
dnl GCC level 2 gives incorrect warnings, so use level 1.
gl_WARN_ADD([-Wformat-truncation=1])
+dnl GCC 9 at level 2 gives apparently bogus errors when %.*s is used.
+gl_WARN_ADD([-Wformat-overflow=1])
+
AC_SUBST([WARN_CFLAGS])
NO_SNV_CFLAGS=
--
2.20.1