4.6.4.4 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 application from completing.

The -Werror form of this option promotes any compiler warning message issued into an error. This option might be useful in applications where warnings are not permitted for functional safety reasons.

The -Werror=num form of this option promotes only the warning identified by num to an error. Numbered messages are produced by most applications within MPLAB XC8. See 10 Error and Warning Messages for a list of compiler messages and their corresponding number. If the message indicated by num is not a warning, then this option has no effect. Only one message number may be specified with this option; however, you may use this option as many times as required.

The -Werror=string form of this option, where string is any string that is not a number, is passed on to the compiler applications that might process it. In the case of the compiler's Clang front end, which does not generate numbered messages, the option is used to promote warnings to errors based on the warning type. 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=num and -Wno-error=string forms of this option ensure that the warnings identified are never promoted to an error, even if the -Werror form of this option is in effect.