qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>, Eric Blake <eblake@redhat.com>
Subject: Re: [Qemu-devel] [PULL 00/11] Ide patches
Date: Wed, 20 Sep 2017 13:55:54 -0400	[thread overview]
Message-ID: <93915fa3-cadb-7639-79bf-e23c39129352@redhat.com> (raw)
In-Reply-To: <824faf32-38bc-f3b9-cafb-f60cbd7fd8a7@ilande.co.uk>



On 09/20/2017 01:02 PM, Mark Cave-Ayland wrote:
> On 18/09/17 19:14, Peter Maydell wrote:
> 
>> On 18 September 2017 at 19:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 18 September 2017 at 18:55, John Snow <jsnow@redhat.com> wrote:
>>>> On 09/16/2017 10:34 AM, Peter Maydell wrote:
>>>>> Hi; I'm afraid this doesn't build with clang:
>>>>>
>>>>> /home/petmay01/linaro/qemu-for-merges/hw/ide/core.c:70:15: error:
>>>>> comparison of unsigned enum expression >= 0 is always true
>>>>> [-Werror,-Wtautological-compare]
>>>>>     if (enval >= 0 && enval < IDE_DMA__COUNT) {
>>>>>         ~~~~~ ^  ~
>>>>> 1 error generated
>>
>>
>>> I think you could argue that it would at least be helpful
>>> if clang didn't warn about comparisons that only happen
>>> to be useless for this particular platform/impdef choice
>>> but are useful for the same code compiled with a different
>>> compiler.
>>
>> A bit of googling and some experimentation reveals that
>> clang deliberately suppresses this warning in the special
>> case of comparing against an enum value which happens to
>> be zero (but not for literal constant zero!). So this will
>> be fine:
>>    if (enval >= IDE_DMA_READ && enval < IDE_DMA__COUNT)
>>
>> (or more sensibly you'd want to define an enum constant
>> for IDE_DMA__FIRST or something rather than relying on
>> READ being 0.)
>>
>> (found here:
>> http://clang-developers.42468.n3.nabble.com/Possibly-invalid-enum-tautology-warning-td3233140.html
>> )
> 
> Doing a git pull and even with the applied version of this patch I get a
> build failure on my local gcc-4.7:
> 
> cc -I/home/build/src/qemu/git/qemu/hw/ide -Ihw/ide
> -I/home/build/src/qemu/git/qemu/tcg
> -I/home/build/src/qemu/git/qemu/tcg/i386
> -I/home/build/src/qemu/git/qemu/linux-headers
> -I/home/build/src/qemu/git/qemu/linux-headers -I.
> -I/home/build/src/qemu/git/qemu
> -I/home/build/src/qemu/git/qemu/accel/tcg
> -I/home/build/src/qemu/git/qemu/include -I/usr/include/pixman-1
> -I/home/build/src/qemu/git/qemu/dtc/libfdt -Werror -pthread
> -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
> -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
> -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs
> -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
> -Wold-style-declaration -Wold-style-definition -Wtype-limits
> -fstack-protector-all -I/usr/include/p11-kit-1
> -I/usr/include/libpng12   -I/home/build/src/qemu/git/qemu/tests -MMD -MP
> -MT hw/ide/core.o -MF hw/ide/core.d -O2 -U_FORTIFY_SOURCE
> -D_FORTIFY_SOURCE=2 -g   -c -o hw/ide/core.o hw/ide/core.c
> hw/ide/core.c: In function ‘IDE_DMA_CMD_str’:
> hw/ide/core.c:71:5: error: comparison of unsigned expression >= 0 is
> always true [-Werror=type-limits]
> cc1: all warnings being treated as errors
> make: *** [hw/ide/core.o] Error 1
> 
> Are there any other workarounds for this at all?
> 
> 
> ATB,
> 
> Mark.
> 

Guh. From which distro does your GCC 4.7 hail?

Regardless, I suppose I will revert to Eric's workaround, though I like
the way it reads an awful lot less.

--js

  reply	other threads:[~2017-09-20 17:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16  1:03 [Qemu-devel] [PULL 00/11] Ide patches John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 01/11] ide: ahci: unparent children buses before freeing their memory John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 02/11] hw/ide/microdrive: Mark the dscm1xxxx device with user_creatable = false John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 03/11] IDE: replace DEBUG_IDE with tracing system John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 04/11] IDE: Add register hints to tracing John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 05/11] IDE: add tracing for data ports John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 06/11] ATAPI: Replace DEBUG_IDE_ATAPI with tracing events John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 07/11] IDE: replace DEBUG_AIO with trace events John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 08/11] AHCI: Replace DPRINTF with trace-events John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 09/11] AHCI: Rework IRQ constants John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 10/11] AHCI: pretty-print FIS to buffer instead of stderr John Snow
2017-09-16  1:03 ` [Qemu-devel] [PULL 11/11] AHCI: remove DPRINTF macro John Snow
2017-09-16  1:29 ` [Qemu-devel] [PULL 00/11] Ide patches no-reply
2017-09-16 14:34 ` Peter Maydell
2017-09-18 13:51   ` Eric Blake
2017-09-18 17:55   ` John Snow
2017-09-18 18:00     ` Peter Maydell
2017-09-18 18:14       ` Peter Maydell
2017-09-20 17:02         ` Mark Cave-Ayland
2017-09-20 17:55           ` John Snow [this message]
2017-09-20 19:01             ` Mark Cave-Ayland
  -- strict thread matches above, loose matches on Subject: below --
2016-02-10 19:37 John Snow
2016-02-10 19:37 ` John Snow
2016-02-11 15:09   ` Peter Maydell
2016-01-09  0:51 John Snow
2016-01-11 11:18 ` Peter Maydell
2016-01-11 17:18   ` John Snow
2016-01-11 17:36     ` Peter Maydell
2015-09-18 15:04 John Snow
2015-09-18 17:32 ` 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=93915fa3-cadb-7639-79bf-e23c39129352@redhat.com \
    --to=jsnow@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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).