[Top][All Lists]

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

Re: [Tinycc-devel] tiny bit of lint

From: grischka
Subject: Re: [Tinycc-devel] tiny bit of lint
Date: Tue, 09 May 2017 22:58:57 +0200
User-agent: Thunderbird (Windows/20090812)

Larry Doolittle wrote:
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 
$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

What about

     -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result\
    if echo "$cc" | grep -q "clang"; then
     W_OPTIONS="$W_OPTIONS -Wno-string-plus-int"
    $cc -Wunsupported $W_OPTIONS -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1
    for i in $W_OPTIONS; do
         grep -q -- $i cc_msg.txt || CFLAGS="$CFLAGS $i"
    rm -f cc_msg.txt a.out

The -Wunsupported is to make it work with --cc=tcc.

Policy is basically:
- turn on -Wall plus what we really need
- turn off what gets in the way
- otherwise short command-lines and readable build logs

If it works you could push it and people can try it out.

-- gr

reply via email to

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