6.7.5.6 Werror Option

The -Werror option can be used to promote compiler warnings into errors. As with any other error, these promoted messages will prevent the project from building.

The -Werror form of this option promotes all issued compiler warning messages into errors. This option might be useful when debugging projects or for applications where warnings are not permitted for functional safety reasons. Note, however, that the use of this option will essentially tie a project's source code to a particular compiler version and is not recommended for production builds. If you build a project using this option with a newer compiler version, new diagnostic messages might appear due to improvements or different handling of questionable code. Any new warnings will stop the project from building.

The -Werror=string form of this option promotes warnings identified by the string argument into errors. For example, -Werror=return-type will promote the warning control reaches end of non-void function [-Wreturn-type] to an error. Only one string may be specified with this option; however, you may use this option as many times as required.

The -Wno-error=string form of this option ensures that the warnings identified are never promoted to an error, even if the -Werror form of this option is in effect.