[Mesa-dev] [PATCH] glcpp: Pass through #line directives.

Carl Worth cworth at cworth.org
Sat Jun 9 22:10:00 CEST 2012


Kenneth Graunke <kenneth at whitecape.org> writes:
> One bad thing about this patch is that it breaks 091-hash-line.c in glcpp's
> unit test suite.  I'm not sure what to do about that.  I could update the
> output, but the new output doesn't make much sense anymore...it gives you
> lovely messages like:
>
>     0:4(1): preprocessor error: #error line 25 error

In other words, after the patch, the preprocessor error messages
(whether from the lexer or the parser) won't have correct line numbers
in them anymore, (in the face of any #line directives).

That seems unfortunate if it's easy to avoid. And I think it should
be. Instead of dropping the handling of #line from the lexer, we should
just move it to the parser.

Meanwhile, since the preprocessor has been interpreting (and consuming)
#line directives, does that mean that the main GLSL compiler hasn't been
seeing them and has been getting incorrect line numbers?

Your patch fixes that by passing them through.

What I'd like to see is the preprocessor interpreting the #line
directives (for its own notion of the line number) and then also
emitting a fully expanded #line macro for the main compiler to
interpret.

I'll plan to attempt that on Monday if I don't get to it today.

-Carl
-------------- 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/20120609/b6ce6683/attachment.pgp>


More information about the mesa-dev mailing list