[Mesa-dev] [PATCH 1/7] glcpp: Add support for __LINE__ and __FILE__ macros

Carl Worth cworth at cworth.org
Thu Nov 29 10:38:30 PST 2012


Matt Turner <mattst88 at gmail.com> writes:
> #line __LINE__
> __LINE__
> #line __LINE__
> __LINE__
>
> when run through glcpp emits this:
>
> #line 1
> 1
> #line 2
> 2

That looks absolutely correct to me, (if very strange to ever do "#line
__LINE__"). For example, this matches the behavior of "gcc -E -" on the
same example.

For "normal" uses of #line, this is what you want. The #line directive
specifies what line number the compiler should use for the subsequent
line of code, (which is useful for getting error messages that point to
the original source when the compiler is actually chewing on some
generated code derived from that source).

-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121129/1a346816/attachment.pgp>


More information about the mesa-dev mailing list