This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c preprocessor output: first four lines


On Sun, 2011-10-02 at 21:05 +0200, Roman B. wrote:
> Hi,
> 
> $  cpp file.c
> 
> alway outputs
> 
> # 1 "file.c"
> # 1 "<built-in>"
> # 1 "<command-line>"
> # 1 "file.c"
> 
> Where as words are self-explanatory I cannot understand the meaning in
> the whole. I could not find any explanation in the documentation also.
> 
> So what do those 4 lines actually mean?

They specify source locations.

The first and last line says that what follows is line #1 of file.c
The other lines specify line numbers for "virtual" files. The reason you
see nothing in the is that you see the output of the preprocessor.
If you add -dD to the preprocessor command line it will retain all
#defines in the output.

Try it again with 'gcc -E -dD file.c | more' to see all the builtin
defines after the <built-in> header.

Try to add a -DSOME=VALUE to see something in the <command-line>
section.

I hope this makes it clearer.

The reason the #line-no parts are retained is that this is how a #line
directive looks after preprocessing and so that really is directives to
the compiler. All of this is described in the cpp manual, try info cpp.

/MF


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]