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: Code Generator: usage of the #line directive



#line is indeed use to report the source of the code that come after the directive. I am just not sure on how to get back to the initial value of __LINE__, __FILE__ after the chunk of generated code has been included.


OK I misunderstood. You want to use #line to change the current line number, and then set it back to what is should be after you are finished?

I dont know anything special you can do with #line but maybe you could someone get the value of __LINE__ and then set it back? #line __LINE__ ? I know that #line can work with macros after it. Would something like

#define CUR_POS __LINE__
#line 500
... you generated code here ...
#line CUR_POS

havent tried this, just an idea.

_________________________________________________________________
The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE



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