| |||
| Home > Compiler Command-line Options > Command-line options > --list | |||
This option instructs the compiler to generate raw listing
information for a source file. The name of the raw listing file
defaults to the name of the input file with the filename extension .lst.
If you specify multiple source files on the command line,
the compiler generates listings for all of the source files, writing
each to a separate listing file whose name is generated from the corresponding
source file name. However, when --multifile is
used, a concatenated listing is written to a single listing file,
whose name is generated from the first source file name.
Typically, raw listing information is used to generate a formatted listing. The raw listing file contains raw source lines, information on transitions into and out of include files, and diagnostics generated by the compiler. Each line of the listing file begins with any of the following key characters that identifies the type of line:
NA normal line of source. The rest of the line is the text of the line of source.
XThe
expanded form of a normal line of source. The rest of the line is
the text of the line. This line appears following the N line,
and only if the line contains nontrivial modifications. Comments
are considered trivial modifications, and macro expansions, line
splices, and trigraphs are considered nontrivial modifications.
Comments are replaced by a single space in the expanded-form line.
SA
line of source skipped by an #if or similar.
The rest of the line is text.
The #else, #elseif,
or #endif that ends a skip is marked with an N.
LIndicates
a change in source position. That is, the line has a format similar
to the # line-identifying directive output by
the preprocessor:
Lline-number"filename"key
where can
be:key
1For entry into an include file.
2For exit from an include file.
Otherwise, is
omitted. The first line in the raw listing file is always an keyL line identifying
the primary input file. L lines are also output
for #line directives where is
omitted. keyL lines indicate the source position
of the following source line in the raw listing file.
R/W/EIndicates a diagnostic, where:
RIndicates a remark.
WIndicates a warning.
EIndicates an error.
The line has the form:
type"filename"line-numbercolumn-numbermessage-text
where can
be typeR, W,or E.
Errors at the end of file indicate the last line of the primary source file and a column number of zero.
Command-line errors are errors with a filename of "<command
line>". No line or column number is displayed as part
of the error message.
Internal errors are errors with position information as usual,
and message-text beginning with (Internal fault).
When a diagnostic message displays a list, for example, all the contending routines when there is ambiguity on an overloaded call, the initial diagnostic line is followed by one or more lines with the same overall format. However, the code letter is the lowercase version of the code letter in the initial line. The source position in these lines is the same as that in the corresponding initial line.
/* main.c */
#include <stdbool.h>
int main(void)
{
return(true);
}
Compiling this code with the option --list produces
the raw listing file:
L 1 "main.c"
N#include <stdbool.h>
L 1 "...\include\...\stdbool.h" 1
N/* stdbool.h */
N
...
N #ifndef __cplusplus /* In C++, 'bool', 'true' and 'false' and keywords */
N #define bool _Bool
N #define true 1
N #define false 0
N #endif
...
L 2 "main.c" 2
N
Nint main(void)
N{
N return(true);
X return(1);
N}