qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH 03/11] configure: Fix compiler wa


From: Stefan Weil
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)
Date: Sat, 17 Dec 2011 13:11:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15

Am 17.12.2011 12:29, schrieb Peter Maydell:
On 17 December 2011 08:27, Stefan Weil <address@hidden> wrote:
warning: return makes integer from pointer without a cast

Signed-off-by: Stefan Weil <address@hidden>
---
 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 via email to

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