All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [5275] Suppress gcc 4.x -Wpointer-sign (included in	-Wall) warnings
Date: Tue, 28 Oct 2008 22:55:56 +0100	[thread overview]
Message-ID: <49078A6C.90907@redhat.com> (raw)
In-Reply-To: <02F3A882-5122-4DA1-BEEC-37E92FA34ADE@web.de>

Andreas Färber wrote:
> 
> Am 28.10.2008 um 17:54 schrieb Ian Jackson:
> 
>> Blue Swirl writes ("[Qemu-devel] [5275] Suppress gcc 4.x
>> -Wpointer-sign (included in -Wall) warnings"):
>>> -        ret = sprintf(phys_ram_base + (16 << 20) - 256,
>>> +        ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),
>>
>> I realise I'm a bit late with this comment (my apologies), but:
>>
>> I think this shows that it would be better to suppress the warning
>> with the appropriate compiler option, than to try to update the code.

/me agrees.

>> And these kind of casts are dangerous because they can suppress
>> serious warnings about pointer/integer mismatch.

Exactly that's why.

> Not sure what type phys_ram_base had here, but char can be signed or
> unsigned depending on platform and this often leads to warnings on,
> e.g., OSX.

Pointer sign-ess for char is a PITA *because* just "char" can be signed
or unsigned depending on the platform.  IIRC that is the reason the
linux kernel has the warning turned off.

> Suppressing all signedness warnings could hide real mistakes,
> too...

That is true too.  Unfortunaly gcc has no -Wno-pointer-sign-char

cheers,
  Gerd

      reply	other threads:[~2008-10-28 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-20  8:07 [Qemu-devel] [5275] Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings Blue Swirl
2008-10-28 16:54 ` Ian Jackson
2008-10-28 17:38   ` Andreas Färber
2008-10-28 21:55     ` Gerd Hoffmann [this message]

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=49078A6C.90907@redhat.com \
    --to=kraxel@redhat.com \
    --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 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.