Re: Can I build gcc so -Wall option is always on ?

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

 



Ralf Wildenhues wrote:
Hello David,

* Dr. David Kirkby wrote on Thu, Dec 24, 2009 at 05:38:23PM CET:
I'm helping on the Sage maths project

http://www.sagemath.org/

where there are a large number of packages built, most of which ignore CFLAGS. (Quite a few ignore CC and CXX too!) I'd like to display all the warnings, but its hard when people overwrite CFLAGS.

Is there a way I can build gcc such that effectively "-Wall" is enabled all the time?

I hate to be stating the obvious, but why not use a wrapper script?

mv gcc gcc.real
cat >gcc <<\EOF
#! /bin/sh
exec gcc.real -Wall "$@"
EOF

or just put one early in your $PATH.  Depending on your needs, it might
have to be a bit more complex (put -Wall at the end if you care about
overriding -Wno-all and some other flags, for example; or only add -Wall
if -c is also seen, or similarly).

Cheers,
Ralf

I've tried this, and it works in 90% of cases, but not all. 'sqlite' is once such package which always gives errors if I try to build like this. The errors are like "no newline" or something like that. So I stuck a new line in, but it still does not work.

Here's one such error, where

make[2]: Entering directory `/export/home/drkirkby/sage-4.3.1.alpha1/spkg/build/sqlite-3.6.19.p0/src' if /bin/sh ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.6.19\" -DPACKAGE_STRING=\"sqlite\ 3.6.19\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\"; -DPACKAGE=\"sqlite\" -DVERSION=\"3.6.19\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_READLINE=1 -I. -I. -I /export/home/drkirkby/sage-4.3.1.alpha1/local/include -DSQLITE_THREADSAFE=1 -Wall -g -m64 -m64 -g -O2 -MT sqlite3.lo -MD -MP -MF ".deps/sqlite3.Tpo" -c -o sqlite3.lo sqlite3.c; \ then mv -f ".deps/sqlite3.Tpo" ".deps/sqlite3.Plo"; else rm -f ".deps/sqlite3.Tpo"; exit 1; fi
mkdir .libs
gcc "-DPACKAGE_NAME=\"sqlite\"" "-DPACKAGE_TARNAME=\"sqlite\"" "-DPACKAGE_VERSION=\"3.6.19\"" "-DPACKAGE_STRING=\"sqlite 3.6.19\"" "-DPACKAGE_BUGREPORT=\"http://www.sqlite.org\""; "-DPACKAGE=\"sqlite\"" "-DVERSION=\"3.6.19\"" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_READLINE=1 -I. -I. -I /export/home/drkirkby/sage-4.3.1.alpha1/local/include -DSQLITE_THREADSAFE=1 -Wall -g -m64 -m64 -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c -fPIC -DPIC -o .libs/sqlite3.o
gcc: 3.6.19": No such file or directory
make[2]: *** [sqlite3.lo] Error 1
make[2]: Leaving directory `/export/home/drkirkby/sage-4.3.1.alpha1/spkg/build/sqlite-3.6.19.p0/src'
Error making sqlite

(The two -m64's are a result of it being added elsewhere too, but generally I've not found a wrapper suitable.)

Dave


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux