Along with GCC 4.2 came a feature that I didn’t know about until Tommie at work revealed it for me yesterday (below snippet taken directly from GCC’s online documentation on warning options):

-Werror=

Make the specified warning into an errors. The specifier for a warning is appended, for example -Werror=switch turns the warnings controlled by -Wswitch into errors. This switch takes a negative form, to be used to negate -Werror for specific warnings, for example -Wno-error=switch makes -Wswitch warnings not be errors, even when -Werror is in effect. You can use the -fdiagnostics-show-option option to have each controllable warning amended with the option which controls it, to determine what to use with this option.

Fantastic! I’ve been waiting for something like this for ages (since some warnings are quite evil, telling you that a certain function call will abort at runtime). Now you can tell the compiler to simply stop compiling if it encounters a “problematic” warning.