Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
C Language Features
 2012 Microchip Technology Inc.
DS52053B-page 221
5.14.4.11.2 The Warning Error/warning Pragma
It is also possible to change the type of some messages.
This is only possible by the use of the warning pragma and only affects messages 
generated by the parser or code generator. The position of the pragma is only signifi-
cant for the parser; i.e., a parser message number may have its type changed for one 
section of the code to target specific instances of the message. Specific instances of a 
message produced by the code generator cannot be individually controlled and the 
pragma will remain in force during compilation of the entire module.
The following example shows the warning produced in the previous example being 
converted to an error for the instance in the function main().
void main(void) {
    unsigned char c;
#pragma warning error 359
    readp(&i);
}
Compilation of this code would result in an error, not the usual warning. The error will 
force compilation to cease after the current module has concluded, or immediately if 
the maximum error count has been reached.