When the compiler encounters a programming error while compiling a C or C++ source program, it issues a diagnostic message to the standard error device and if the appropriate options have been selected, to the listing file.
This section also outlines some of the basic reporting mechanisms the compiler uses to describe compilation errors.
The compiler issues messages specific to the C or C++ language.
If you specify the compiler option -qsrcmsg and
the error is applicable to a particular line of code, the reconstructed source
line or partial source line is included with the error message in the stderr file. A reconstructed source line is a preprocessed source line
that has all the macros expanded.
If you specify the -qsource compiler option, the compiler will place messages in the source listing. For example, if you compile your file using the command line invocation xlc -qsource filename.c, then you will find a file called filename.lst in your current directory.
You can control the diagnostic messages issued, according to their severity, using either the -qflag option or the -w option. To get additional informational messages about potential problems in your program, use the -qinfo option.
Diagnostic messages have the following format when the -qnosrcmsg option is active (which is the default):
"file", line line_number.column_number: 15dd-nnn (severity) text.
where:
file | is the name of the C or C++ source file with the error |
line_number | is the line number of the error |
column_number | is the column number for the error |
15 | is the compiler product identifier |
dd | is a two-digit code indicating the XL C/C++ component that issued
the message. dd can have the following
values:
|
nnn | is the message number |
severity | is a letter representing the severity of the error |
text | is a message describing the error |
Diagnostic messages have the following format when the -qsrcmsg option is specified:
x - 15dd-nnn(severity) text.
where x is a letter referring to a finger in the finger line.
XL C/C++ uses a five-level classification scheme for diagnostic messages. Each level of severity is associated with a compiler response. Not every error halts compilation. The following table provides a key to the abbreviations for the severity levels and the associated compiler response.
Letter | Severity | Compiler response |
---|---|---|
I | Informational | Compilation continues. The message reports conditions found during compilation. |
W | Warning | Compilation continues. The message reports valid but possibly unintended conditions. |
E | Error |
![]() |
S | Severe error | Compilation continues, but object code is not generated. Error conditions exist that the compiler cannot correct. |
U | Unrecoverable error | The compiler halts. An internal compiler error has occurred.
|
Related information