what is the gcc frontend #line pragma

Ian Lance Taylor iant@google.com
Tue Aug 1 14:00:00 GMT 2006


"miwei" <miwei@ict.ac.cn> writes:

> I fine there are many  #line xxx “c-parse.y”  statements in c-parse.c file. 
> What is the use of the #line pragma?  When I gdb the yyparse function,
> I find it is not line-by-line consistent with the c-parse.c file. How to
> make 
> the gdb process easier?   Thanks

#line is a standard C preprocessing directive.  From ISO C 99 6.10.4:

    A preprocessing directive of the form
        # line digit-sequence new-line
    causes the implementation to behave as if the following sequence of
    source lines begins with a source line that has a line number as
    specified by the digit sequence (interpreted as a decimal
    integer). The digit sequence shall not specify zero, nor a number
    greater than 2147483647.

    A preprocessing directive of the form
        # line digit-sequence "s-char-sequenceopt" new-line
    sets the presumed line number similarly and changes the presumed name
    of the source file to be the contents of the character string literal.

This will affect the debugging information, which is read by gdb.

Ian



More information about the Gcc-help mailing list