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

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

 



Hey David,

On Thu, 24 Dec 2009, Dr. David Kirkby wrote:
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? If not, could anyone point me to where in the source code I might be able to hack it, to build a version which displays all the warnings?

I doubt that you can configure gcc to enable all warnings by default, but I'm not 100% sure, but you could possibly use one of the following possiblities to hack it into gcc:

1) For C/C++ code, the function 'c_common_handle_option' sets all the single warnings covered/enabled by -Wall. For gcc-4.4.1, it's c-opts.c:378. So, to always enable -Wall, you could call c_common_handle_option (via the language hooks) in decode_options after parsing of the command-line parameters is finished. I didn't test it, but you should get the effect of -Wall by calling c_common_handle_option(OPT_Wall, NULL, true);

2) As an alternative, you could change the gcc driver to always pass -Wall to the compiler (cc1,cc1plus). For this, please check,

gcc.c:827 --> cc1_options

If I see it correctly, this should then work for C/C++ compilations.

I hope that is what you're searching for ...

Happy X-Mas,

- Andi -




[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