.i
files are where gcc -save-temps
outputs preprocessed C. This is C, not assembly language. You'll find asm in the .s
file.
Those are line numbers to match up preprocessed C with the original source. I don't know exactly what the number at the start vs. the one or two numbers after the filename mean. If you need to know the details, you might need to look at GCC internals, or maybe it's documented somewhere.
With nested includes it can get fairly complex, but compilers can use this to print better warning messages (like where the original definition was of a conflicting prototype or something).
GCC has the C preprocessor built-in to the compiler pass so I'm not sure it actually needs to (or can) read these "comment" metadata lines in the .i
; in normal operation the main C->asm compiler pass knows file/line-number of everything it read without having to serialize it into this text format and back.
GCC does have options to read preprocessed-C as input, specifically -fpreprocessed
which is on by default if you were to run gcc -c foo.i
.
Indicate to the preprocessor that the input file has already been preprocessed. This suppresses things like macro expansion, trigraph conversion, escaped newline splicing, and processing of most directives. The preprocessor still recognizes and removes comments, so that you can pass a file preprocessed with -C to the compiler without problems. In this mode the integrated preprocessor is little more than a tokenizer for the front ends.
-fpreprocessed
is implicit if the input file has one of the extensions .i
, .ii
or .mi
. These are the extensions that GCC uses for preprocessed files created by -save-temps
.
So this is what lets GCC still remove those lines starting with #
that are like preprocessor directives. (Like #define
or #include
).