The new -Werror= option for GCC 4.3 is very useful to make GCC error out for specific warnings, but it currently lacks a way to make that warning an error (which is very useful to avoid skipping parameters in fprintf()-like functions.
Even -fdiagnostics-show-option suggested by the manual doesn't show an option name near those warnings, which seems to be available only with -Wall.
That is because this is a pedantic warning which is enabled by default.
Which gives it even more usefulness to be optionally treated as an error, since it really helps to avoid shooting oneself in the foot...
I guess it would be bad to have a way to -Wno- it, but it would be nice to at least being able to -Werror= it...
The same happens for "assignment makes integer from pointer without a cast" . It really is not nice that these warnings cannot be made errors explicitly, they are _quite_ important.
I had some issues caused by implicit pointer casting as well. Would be really nice to be able to separately turn specific classes of pedantic warnings into errors without having to turn every warning.
We could add an OPT_Wdefault that replaces 0 in pedwarn(loc, 0, "message"), then -Werror=default would turn all default warnings into errors. And -Wno-default will turn off default warnings that cannot be currently controlled.
Diego, would that satisfy you?
If we want further fine control, we would need to add further -Wxxx options for specific default warnings.
To be honest there are quite a few default warnings that I wouldn't want to turn into errors, but it would still be better than having _no_ way to get this into an error.
There is a difference between warnings about things that might
be wrong in your code and warnings about things that are definitely wrong.
This is one of the latter, and it is a shame that it's not already an error
by default. I understand the historical rationale but it is still unfortunate.
integer/pointer without a cast is another one. If I could make these
errors I most certainly would. As it is I run gcc in a wrapper script
and exit 1 if gcc emits that particular warning.
Pedantic warnings may be controlled by individual warning flags. So to fix this you only need to:
* add a new -Wfoo option to c.opt that is enabled by default.
* use the option in the appropriate warning calls in c-typeck.c
* create some testcases to show that it works.
* get the patch reviewed and committed.
Patches welcome: http://gcc.gnu.org/contribute.html
It is possible to disable warnings about conversions between pointers that have incompatible types via a new warning option -Wno-incompatible-pointer-types; warnings about implicit incompatible integer to pointer and pointer to integer conversions via a new warning option -Wno-int-conversion; and warnings about qualifiers on pointers being discarded via a new warning option -Wno-discarded-qualifiers.