Warnings in the C++ Front-End and GCC in General
Harvey J. Stein
hjstein@bfr.co.il
Thu Sep 10 07:57:00 GMT 1998
It seems to me like there're several issues getting muddled together
here.
Issue 1 - fine grained warning control.
Users would find it useful to be have finer grained control of
warning messages. There're some -Wxxx & -Wno-xxx pairs, but these
yield incomplete coverage & affect classes of messages. It would
be useful to have some command line mechanism that gets down to the
individual message level.
Issue 2 - warning control from inside source code.
Users would like to be able to turn on & off messages from within
the source code so that particular messages can be turned on/off
for particular sections of code. The command line options allow
this on a C file basis, but this is often too coarse grained -
e.g. - when the user knows a particular construct in a particular
section of code will cause a warning & doesn't want to fix it &
doesn't want warnings he cares about to be obscured by this
warning, or when there are problems from include files which for
some reason or other the user is unwilling to adjust.
The proposal for Issue 1 is numbering of all the warnings.
The proposal for Issue 2 is the use of some sort of warning control
pragma.
Patches for both of these are available for the C++ front end.
There are arguments for & against doing these things.
I have a 2nd proposal for Issue 2. Instead of some sort of warning
control pragma, how about some general mechanism for passing command
line options from within the code? This is more generally useful than
something restricted to warning control, separates more completely
Issue 1 from Issue 2, becomes more powerful as more command line
options are added, and keeps things more generally uniform. It's also
helpful for OSs with restricted command line lengths and has the
advantage of the existence of prior art - lots of compilers do
this sort of thing.
This also allows for doing things like turning off optimization or
tuning optimization parameters for a particular section of code for
which maybe gcc is broken, thus allowing people to get on with their
life instead of waiting for bug fixes.
Of course, I'm sure there are lots of command line options which
couldn't be easily localized for sections of code, so these would have
to be disabled from embedded setting.
--
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il
More information about the Gcc
mailing list