[Top][All Lists]

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

Re: [Tinycc-devel] tiny bit of lint

From: Larry Doolittle
Subject: Re: [Tinycc-devel] tiny bit of lint
Date: Tue, 9 May 2017 12:06:45 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

grischka -

On Tue, May 09, 2017 at 07:33:28PM +0200, grischka wrote:
> Yes, the configure warning magic doesn't work with clang.  And
> hence my question was:
>       Can you fix this?
> Means: recognize if $CC is clang and implement some method to
> disable its warnings in configure.  Can you do this?
> That could be useful in future for similar problems.

Proof of concept, where dummy.c is something simple and correct like
int dummy(void) { return 0; }

CFLAGS="-Wall -g -O2"

W_OPTIONS="extra declaration-after-statement undef strict-prototypes 
write-strings lskdjfsldfkj bogus no-pointer-sign no-sign-compare 
no-unused-parameter no-string-plus-int"
$cc -c `for i in $W_OPTIONS; do echo -W$i; done` dummy.c > cc_msg.txt 2>&1
for i in $W_OPTIONS; do
  O_INVALID=`grep -- -W$i cc_msg.txt)`
  if test -z "$O_INVALID"; then CFLAGS="$CFLAGS -W$i"; fi

echo $CFLAGS

tcc has the interesting property that it accepts and ignores any -W flags
not on its (short) list, so even -Wlskdjfsldfkj -Wbogus are accepted by
the above process.  gcc and clang reject them.

Tested, works with bash and dash.

   - Larry

reply via email to

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