[EMAIL PROTECTED] (Per Abrahamsen)  wrote on 19.09.05 in <[EMAIL PROTECTED]>:

> Robert Dewar <[EMAIL PROTECTED]> writes:
>
> > Per Abrahamsen wrote:
> >
> >> The idea was that you would be sure to get all the (boolean) warnings
> >> that are relevant for your project, and can give an explicit reason
> >> for each warning you don't want.
> >> It would be particularly useful when upgrading GCC, in order to be
> >> sure you get the benefit of any new boolean warnings added.
> >
> > Of course any generally useful new boolean warnings would be
> > included in -Wall.
>
> Yeah, but I want the specifically useful warnings as well :-)
>
> From my Makefile:
>
>       WARNING = -W -Wall -Wno-sign-compare \
>                 -Wconversion -Woverloaded-virtual \
>                 -Wsign-promo -Wundef -Wpointer-arith -Wwrite-strings
> #  -Wold-style-cast: triggered by header files for 2.95/woody
> #  -Wmissing-noreturn: triggered by some virtual functions.
> #  -Wmissing-prototypes -Wstrict-prototypes: Not C++ flags.
>
> At some point I went through the manual and added all the warning
> flags I could find, then commented out those that did not apply to my
> coding style or environment.  Apparently there were six additional
> flags that either didn't trigger any warnings on my code, or where I
> found a rewrite made the code clearer.

That is a pretty common way of doing things. Incidentally, any time I've  
done this, I wanted labels on warnings as to what option was responsible  
(which we finally seem to be getting) instead of guessing ... and more  
than once I'd have loved to keep about half of a warning flag whose other  
half was just noise: many of gcc's warning flags are too coarse-grained.

Also, there should probably be more documentation to "so, how do I avoid  
this particular warning, then?" - there are a number of cases where it's  
highly nonobvious. When all you can do to silence a warning is switch it  
off, that detracts from the value of said warning.

For example, the longjump endangers variable warning (I forget the exact  
wording) - how do I tell it that I don't care about this variable when  
there's a longjump, and how do I convince the code generator to not  
endanger this other variable? Without knowing that, what do I get from the  
warning?

MfG Kai

Reply via email to