qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)
Date: Sat, 17 Dec 2011 13:11:21 +0100	[thread overview]
Message-ID: <4EEC86E9.7080404@weilnetz.de> (raw)
In-Reply-To: <CAFEAcA8MY3zc7xLD_PosE_fHnOL+jn54wX7TAS8MxE=4vVa+Bw@mail.gmail.com>

Am 17.12.2011 12:29, schrieb Peter Maydell:
> On 17 December 2011 08:27, Stefan Weil <sw@weilnetz.de> wrote:
>> warning: return makes integer from pointer without a cast
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>  configure |    6 +++++-
>>  1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 93c6cbe..8dee237 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
>>  #ifdef __OpenBSD__
>>  #define resize_term resizeterm
>>  #endif
>> -int main(void) { resize_term(0, 0); return curses_version(); }
>> +int main(void) {
>> +  const char *s = curses_version();
>> +  resize_term(0, 0);
>> +  return s != (const char *)0;
>
> You don't need this cast, I think.

Indeed, a quick test with gcc-4.4.5 shows no new warning when
I remove the type cast. Are you sure that this works with all
supported versions of gcc and any set of warning options?

Normally NULL is used for this kind of code, but it needs
stddef.h. Typically NULL is defined to be ((void *)0 for C
(that's the reason why I used a type cast, too). Only for
C++ it is defined without a type cast.

The type cast won't harm and is not in "normal" code,
so it can be committed as it is. I also don't mind if it is
removed by whoever commits it. If it is preferred that
I send an updated patch, I'd use NULL with stddef.h
(just to be safe).

Regards,
Stefan Weil

  reply	other threads:[~2011-12-17 12:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17  8:27 [Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 01/11] configure: Fix compiler warnings in config.log (always return a value from main) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 02/11] configure: Fix compiler warnings in config.log (old-style function definition) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer) Stefan Weil
2011-12-17 11:29   ` Peter Maydell
2011-12-17 12:11     ` Stefan Weil [this message]
2011-12-17 14:09       ` Peter Maydell
2011-12-17 14:18         ` Eric Blake
2011-12-17 16:46   ` [Qemu-devel] [PATCH v2 " Stefan Weil
2011-12-17 16:57     ` Peter Maydell
2011-12-17  8:27 ` [Qemu-devel] [PATCH 04/11] configure: Fix compiler warnings in config.log (null arguments) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 05/11] configure: Fix compiler warning in config.log (unused variable) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 06/11] configure: Fix compiler warning in config.log (macro redefined) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 07/11] configure: Fix compiler warnings in config.log (uninitialized variable) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 08/11] configure: Fix compiler warning in config.log (undefined NULL) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 09/11] configure: Fix compiler warning in config.log (value was never used) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 10/11] configure: Fix compiler warnings in config.log (statement without effect) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 11/11] configure: Improve Xen autodetection for hosts without Xen Stefan Weil
2012-01-04 17:00   ` Stefano Stabellini
2011-12-17 11:43 ` [Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log 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=4EEC86E9.7080404@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).