Re: c preprocessor output: first four lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux