qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] configure: fix double check tests with Clang


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] configure: fix double check tests with Clang
Date: Thu, 9 Aug 2012 21:43:26 +0100

On 9 August 2012 21:31, Blue Swirl <address@hidden> wrote:
> Configuring with Clang compiler with -Werror would not work after
> improved checks:
> /tmp/qemu-conf--25992-.c:4:32: error: self-comparison always evaluates
> to true [-Werror,-Wtautological-compare]
> int main(void) { return preadv == preadv; }
> /tmp/qemu-conf--25992-.c:13:26: error: self-comparison always
> evaluates to true [-Werror,-Wtautological-compare]
>     return epoll_create1 == epoll_create1;
> /tmp/qemu-conf--25992-.c:3:13: error: explicitly assigning a variable
> of type 'char **' to itself [-Werror,-Wself-assign]
>     environ = environ;
>
> Avoid the errors by adjusting the tests.
>
> Signed-off-by: Blue Swirl <address@hidden>
> ---
>  configure |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index d8ec050..c2955f8 100755
> --- a/configure
> +++ b/configure
> @@ -2255,7 +2255,7 @@ cat > $TMPC <<EOF
>  #include <sys/types.h>
>  #include <sys/uio.h>
>  #include <unistd.h>
> -int main(void) { return preadv == preadv; }
> +int main(void) { return preadv(0, (void *)0, 0, 0); }

This shouldn't need the cast, should it?

>  EOF
>  preadv=no
>  if compile_prog "" "" ; then
> @@ -2551,7 +2551,7 @@ int main(void)
>       * warning but not an error, and will proceed to fail the
>       * qemu compile where we compile with -Werror.)
>       */
> -    return epoll_create1 == epoll_create1;
> +    return (int)(uintptr_t)&epoll_create1;
>  }
>  EOF
>  if compile_prog "" "" ; then
> @@ -2944,7 +2944,7 @@ has_environ=no
>  cat > $TMPC << EOF
>  #include <unistd.h>
>  int main(void) {
> -    environ = environ;
> +    environ = (void *)0;

...and nor should this.

>      return 0;
>  }
>  EOF
> --
> 1.7.2.5
>


-- PMM



reply via email to

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