All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: add -Wno-format-truncation to QEMU_CFLAGS
@ 2017-07-20 14:57 Eduardo Otubo
  2017-07-20 15:23 ` no-reply
  2017-07-20 15:33 ` Daniel P. Berrange
  0 siblings, 2 replies; 4+ messages in thread
From: Eduardo Otubo @ 2017-07-20 14:57 UTC (permalink / raw)
  To: qemu-devel

Compilation breaks on GCC 7.1.1 20170622 (Fedora 26), thus adding
-Wno-format-truncation to QEMU_CFLAGS on configure script is neecssary.

    hw/usb/bus.c: In function ‘usb_port_location’:
    hw/usb/bus.c:410:66: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 15 [-Werror=format-truncation=]
             snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
                                                                      ^~
    In file included from /usr/include/stdio.h:939:0,
                     from /home/otubo/develop/qemu/otubo/include/qemu/osdep.h:68,
                     from hw/usb/bus.c:1:
    /usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 3 and 28 bytes into a destination of size 16
       return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            __bos (__s), __fmt, __va_arg_pack ());
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make: *** [/home/otubo/develop/qemu/otubo/rules.mak:66: hw/usb/bus.o] Error 1
    make: *** Waiting for unfinished jobs....

Signed-off-by: Eduardo Otubo <otubo@redhat.com>
---
This warning looks pretty much bogus to me. Since building with -Werror is
essential, we should add this flag to configure. If someone thinks this warning
is not a false positive, feel free to drop this patch.
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index befebe27e3..5d5507b3a0 100755
--- a/configure
+++ b/configure
@@ -482,6 +482,7 @@ ARFLAGS="${ARFLAGS-rv}"
 # left shift of signed integers is well defined and has the expected
 # 2s-complement style results. (Both clang and gcc agree that it
 # provides these semantics.)
+QEMU_CFLAGS="-Wno-format-truncation $QEMU_CFLALGS"
 QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-20 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20 14:57 [Qemu-devel] [PATCH] configure: add -Wno-format-truncation to QEMU_CFLAGS Eduardo Otubo
2017-07-20 15:23 ` no-reply
2017-07-20 15:33 ` Daniel P. Berrange
2017-07-20 16:02   ` Eduardo Otubo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.