Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Sep 2011 05:44:29 +0000
From:      Nali Toja <nalitoja@gmail.com>
To:        "Klaus T. Aehlig" <aehlig@linta.de>
Cc:        ports@freebsd.org, ehaupt@FreeBSD.org
Subject:   Re: clang and configure checking for equivalent simple type
Message-ID:  <86y5x7hphe.fsf@gmail.com>
In-Reply-To: <20110929045818.GA3463@curry.linta.de> (Klaus T. Aehlig's message of "Thu, 29 Sep 2011 05:58:18 %2B0100")
References:  <20110929045818.GA3463@curry.linta.de>

next in thread | previous in thread | raw e-mail | index | archive | help
"Klaus T. Aehlig" <aehlig@linta.de> writes:

[...]
> #include <sys/types.h>
> #include <unistd.h>
> int
> main ()
> {
> off_t u; long v; &u==&v;
>   ;
>   return 0;
> }
>
> and check for compile errors. However, the above program is rejected
> by clang, as the value &u==&v is unused, which, of course, has nothing
> to do with the intended check whether off_t * and long * are compatible
> pointer.
>
> Adding
>
> CFLAGS+= -Wno-unused 
>
> solves this problem.

Alternatively, you can turn off only a specific -Werror, e.g.

  CFLAGS += -Wno-error=unused

it's ignored by gcc in base while gcc46 wants -Wno-error=unused-value

  $ gcc -Wunused -Werror -Wno-error=unused test.c
  cc1: warnings being treated as errors
  test.c: In function 'main':
  test.c:6: warning: statement with no effect
  Exit 1

  $ gcc46 -Wunused -Werror -Wno-error=unused-value test.c
  test.c: In function 'main':
  test.c:6:18: warning: statement with no effect [-Wunused-value]

  $ clang -Wunused -Werror -Wno-error=unused test.c
  test.c:6:20: warning: expression result unused [-Wunused-value]
  off_t u; long v; &u==&v;
                   ~~^ ~~
  1 warning generated.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86y5x7hphe.fsf>