|
From: | grischka |
Subject: | Re: [Tinycc-devel] tiny bit of lint |
Date: | Tue, 09 May 2017 22:58:57 +0200 |
User-agent: | Thunderbird 2.0.0.23 (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" cc=clang 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 done echo $CFLAGS
What about W_OPTIONS="\ -Wdeclaration-after-statement\ -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result\ -fno-strict-aliasing\ " if echo "$cc" | grep -q "clang"; then W_OPTIONS="$W_OPTIONS -Wno-string-plus-int" fi $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" done 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
[Prev in Thread] | Current Thread | [Next in Thread] |