Microchip Technology SW006021-1N Manual Do Utilizador
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 86
2012 Microchip Technology Inc.
4.6
COMPILER MESSAGES
All compiler applications, including the command-line driver, xc8, use textual mes-
sages to report feedback during the compilation process. A centralized messaging sys-
tem is used to produce the messages, which allows consistency during all stages of the
compilation process. The messaging system is described in this section and a com-
plete list of all warning and error messages can be found in Appendix B. “Error and
Warning Messages”.
sages to report feedback during the compilation process. A centralized messaging sys-
tem is used to produce the messages, which allows consistency during all stages of the
compilation process. The messaging system is described in this section and a com-
plete list of all warning and error messages can be found in Appendix B. “Error and
Warning Messages”.
4.6.1
Messaging Overview
A message is referenced by a unique number which is passed to the messaging sys-
tem by the compiler application that needs to convey the information. The message
string corresponding to this number is obtained from Message Description Files (MDF),
which are stored in the dat directory in the compiler’s installation directory.
tem by the compiler application that needs to convey the information. The message
string corresponding to this number is obtained from Message Description Files (MDF),
which are stored in the dat directory in the compiler’s installation directory.
When a message is requested by a compiler application, its number is looked up in the
MDF that corresponds to the currently selected language. The language of messages
can be altered as discussed in Section 4.6.2 “Message Language”.
MDF that corresponds to the currently selected language. The language of messages
can be altered as discussed in Section 4.6.2 “Message Language”.
Once found, the alert system can read the message type and the string to be displayed
from the MDF. There are several different message types which are described in
Section 4.6.3 “Message Type” and the type can be overridden by the user, as
described in the same section.
from the MDF. There are several different message types which are described in
Section 4.6.3 “Message Type” and the type can be overridden by the user, as
described in the same section.
The user is also able to set a threshold for warning message importance, so that only
those which the user considers significant will be displayed. In addition, messages with
a particular number can be disabled. A pragma can also be used to disable a particular
message number within specific lines of code. These methods are explained in
Section 4.6.5.1 “Disabling Messages”.
those which the user considers significant will be displayed. In addition, messages with
a particular number can be disabled. A pragma can also be used to disable a particular
message number within specific lines of code. These methods are explained in
Section 4.6.5.1 “Disabling Messages”.
Provided the message is enabled and it is not a warning message whose level is below
the current warning threshold, the message string will be displayed.
the current warning threshold, the message string will be displayed.
In addition to the actual message string, there are several other pieces of information
that may be displayed, such as the message number, the name of the file for which the
message is applicable, the file’s line number and the application that issued the
message, etc.
that may be displayed, such as the message number, the name of the file for which the
message is applicable, the file’s line number and the application that issued the
message, etc.
If a message is an error, a counter is incremented. After a certain number of errors has
been reached, compilation of the current module will cease. The default number of
errors that will cause this termination can be adjusted by using the --ERRORS option,
see Section 4.8.29 “--ERRORS: Maximum Number of Errors”. This counter is reset
for each internal compiler application, thus specifying a maximum of five errors will
allow up to five errors from the parser, five from the code generator, five from the linker,
five from the driver, etc.
been reached, compilation of the current module will cease. The default number of
errors that will cause this termination can be adjusted by using the --ERRORS option,
see Section 4.8.29 “--ERRORS: Maximum Number of Errors”. This counter is reset
for each internal compiler application, thus specifying a maximum of five errors will
allow up to five errors from the parser, five from the code generator, five from the linker,
five from the driver, etc.
Although the information in the MDF can be modified with any text editor, this is not rec-
ommended. Message behavior should only be altered using the options and pragmas
described in the following sections.
ommended. Message behavior should only be altered using the options and pragmas
described in the following sections.