qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] clang warnings too noisy
Date: Fri, 6 Mar 2015 13:06:09 -0600	[thread overview]
Message-ID: <CAJSP0QWdGTKYMLcyTWjUfAYA2R964T-ESkBpnVn4F-yVx2Nv6w@mail.gmail.com> (raw)

Hi Peter,
You are rejecting pull requests that produce warnings under clang.

clang 3.5.0 on Fedora 21 produces so much noise that it's extremely
tedious and error-prone to try finding relevant new warnings.

Are you using a different clang version which produces fewer warnings?

Is anyone working on making QEMU build cleanly under clang?  Under gcc
people regularly submit patches to keep the build clean (e.g. recent
gcc 5 fixes).

Currently I'm not happy wrangling with clang when very few people seem
to use it or care enough to make QEMU build cleanly.

Examples of noise produced by clang:

1. It complains about glib headers:
In file included from /home/stefanha/qemu/include/net/eth.h:32:
In file included from /home/stefanha/qemu/include/qemu/iov.h:17:
In file included from /home/stefanha/qemu/include/qemu-common.h:43:
In file included from /home/stefanha/qemu/include/glib-compat.h:19:
In file included from /usr/include/glib-2.0/glib.h:50:
In file included from /usr/include/glib-2.0/glib/ghash.h:33:
In file included from /usr/include/glib-2.0/glib/glist.h:32:
/usr/include/glib-2.0/glib/gmem.h:76:78: warning: unknown attribute
'__alloc_size__' ignored [-Wunknown-attributes]
gpointer g_malloc (gsize n_bytes) __attribute__((__malloc__))
__attribute__((__alloc_size__(1)));
                                                                             ^
/usr/include/glib-2.0/glib/gmem.h:78:79: warning: unknown attribute
'__alloc_size__' ignored [-Wunknown-attributes]

2. It complains about the 'return !strcmp(s, "?") || !strcmp(s,
"help")' in qemu-common.h:
/home/stefanha/qemu/include/qemu-common.h:150:1916: warning: array
index 3 is past the end of the array (which contains 2 elements)
[-Warray-bounds]
    return !__extension__ ({ size_t __s1_len, __s2_len;
(__builtin_constant_p (s) && __builtin_constant_p ("?") && (__s1_len =
strlen (s), __s2_len = strlen ("?"), (!((size_t)(const void *)((s) +
1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) &&
(!((size_t)(const void *)(("?") + 1) - (size_t)(const void *)("?") ==
1) || __s2_len >= 4)) ? __builtin_strcmp (s, "?") :
(__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) -
(size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len <
4) ? (__builtin_constant_p ("?") && ((size_t)(const void *)(("?") + 1)
- (size_t)(const void *)("?") == 1) ? __builtin_strcmp (s, "?") : ...

3. It complains about unused -I paths:
clang: warning: argument unused during compilation: '-I /home/stefanha/qemu/tcg'
clang: warning: argument unused during compilation: '-I
/home/stefanha/qemu/tcg/i386'
clang: warning: argument unused during compilation: '-I
/home/stefanha/qemu/linux-headers'

Stefan

             reply	other threads:[~2015-03-06 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 19:06 Stefan Hajnoczi [this message]
2015-03-06 23:47 ` [Qemu-devel] clang warnings too noisy Peter Maydell
2015-03-07 11:14   ` Paolo Bonzini
2015-03-07 11:29     ` Stefan Weil
2015-03-10 10:35   ` Stefan Hajnoczi
2015-03-07  9:04 ` Stefan Weil
2015-03-07  9:50   ` Stefan Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJSP0QWdGTKYMLcyTWjUfAYA2R964T-ESkBpnVn4F-yVx2Nv6w@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).