qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel <qemu-devel@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] clang 3.5.0 errors
Date: Tue, 17 Mar 2015 15:30:45 -0400	[thread overview]
Message-ID: <550880E5.8020505@redhat.com> (raw)

Since we seem to be rejecting patches that introduce clang warnings on 
Peter Maydell's OSX configuration, I felt like I should detail the long 
list of errors we currently have that prevent me from thoroughly testing 
with clang in 3.5.0.

There are five classes of errors that currently plague our fair project:


-Wunknown-attributes currently complains about the many instances of 
__alloc_size__ used about the code, because clang ignores this 
attribute. We can stifle this warning with -Wno-unknown-attributes as 
Stefan tried to, but this apparently causes further warnings and errors 
in versions of clang/gcc that do not recognize this option.


-Wunused-command-line-argument currently complains about the many 
include flags passed to each CC incantation -- presumably this is not 
really fixable, because we'd have to fix our Makefile to be a lot 
smarter than it is. We probably need to stifle these warnings 
conditionally like unknown-attributes, above.


-Wparentheses-equality complains about functions like our QLIST 
functions, because once values get wrapped by a few macros, they have 
many unnecessary parentheses. Since that's "good practice" with macros, 
I think there's no way around needing to disable this warning.


-Wself-assign complains about many functions within softmmu_template.h, 
because of our TGT_LE macro which is a no-op on my machine. Clang gets 
upset about "x = (x)" as a worthless self assignment. Maybe we can avoid 
these errors by using a standard macro instead of one we rolled 
ourselves, but otherwise this error needs to get quieted, too.


-Wtautological-compare also comes up a few times, because we 
occasionally use macros to check if one symbolic value is equivalent to 
another. When both values are bound at preprocessor time to the same 
symbol, runtime conditionals become tautological comparisons.

In qemu/target-mips/translate.c:1965:166, there's an instance of 
FOP_CONDNS being expanded with ifmt = 'FMT_D', so when we get to this 
conditional: 'if (ifmt == FMT_D)', we trigger the tautological 
comparison error.

This is a particular error we probably don't want to disable, but we'll 
need to rework some of these macros to avoid runtime checking of 
compile-time constructs.



Input on which errors should be quieted and which errors should be fixed 
in code is welcome. My hunch is to ignore #1, #2, #3. We might be able 
to fix #4 in code, but it should also be safe to ignore. #5 I suspect we 
really want to fix in code, because the tautological comparison is a 
good warning for type mismatches and we wouldn't want to miss those.

Thanks,
--js

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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 19:30 John Snow [this message]
2015-03-17 19:34 ` [Qemu-devel] clang 3.5.0 errors Peter Maydell
2015-03-17 19:59   ` John Snow
2015-03-17 23:07     ` Peter Maydell
2015-03-18 19:22       ` John Snow
2015-03-18 20:28         ` Peter Maydell
2015-03-18 22:22           ` John Snow
2015-03-18 22:48             ` Peter Maydell

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=550880E5.8020505@redhat.com \
    --to=jsnow@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).