qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] clang warnings too noisy


From: Peter Maydell
Subject: Re: [Qemu-devel] clang warnings too noisy
Date: Sat, 7 Mar 2015 08:47:19 +0900

On 7 March 2015 at 04:06, Stefan Hajnoczi <address@hidden> wrote:
> 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?

I use the stock clangs for OSX 10.9.5 and Ubuntu trusty:
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

> 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).

Yes, I have been working on making QEMU build cleanly under clang,
why do you think I've been rejecting pulls which add warnings and
submitting patches which fix existing warnings?
It currently builds totally cleanly on the clang I use. I have my
config set up with -Werror now and would like to keep it that way.

(The OSX build has warnings about deprecated audio APIs still but
is otherwise clean.)

> 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]

I think this is a glib bug...

> 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'

Are you sure 3 isn't because you're running clang under ccache?

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]