Understanding compiler warning options
Martin Sebor
msebor@gmail.com
Mon Oct 5 17:26:00 GMT 2015
> "The next to last line you quoted ('The combined effect of positive and
> negative forms is that more specific options have priority over less
> specific ones') implies to me that the '-w' option, since '-w' is a less
> specific way to turn off all warnings, can be overriden by more specific
> warning messages which turn back on a particular warning. But one of the
> original responses I received on this thread is that '-w' permanently
> sets all warnings off no matter what specific warning is set on. So I
> don't think that next to last line quote is always true, although I
> would have hoped as a general rule that it was."
This is why I suggested that experimenting with the options will
lead to a better understanding of their effects than reading the
manual alone. (Though to be honest, I had overlooked the "more
specific" bit Manuel pointed out.)
That said, the -w behavior doesn't seem very useful to me. There
are common use cases for disabling all warnings already enabled
on the command line while enabling others (e.g., some makefiles
provide a customization variable for options to be added to the
compiler command line). In my experience, this use case is more
common than disabling all warnings, regardless what options are
where. IMO, it's worth opening a defect and requesting a change
here.
Martin
More information about the Gcc-help
mailing list