[Mesa-dev] Support for string filenames in #line [version 2]

Carl Worth cworth at cworth.org
Sat Dec 8 13:43:35 PST 2012


I sent an earlier proof-of-concept patch for adding support to #line for a
filename as a string, (rather than just a numeric source number).

Here in version 2, is a much more complete series, with the following changes:

1. The first patch in the series updates the previously-sent patch to
   correctly strip quotation marks from the string-literal when reading the
   filename. So the filename will appear without quotation marks in error
   messages. (The quotation marks are still added as required when re-emitting
   #lien directives for the downstream GLSL compiler to consume.)

2. A glcpp test is added for the above functionality, (filename appearing in
   an error message).

3. The glsl compiler is also updated to support #line with a string filename

4. New "make check" tests are added to test this, (as well as other tests for
   handling of #line by the glsl compiler).

5. The new tests uncovered two other bugs in the handling of #line: An
   off-by-one error in line numbers, and source numbers always being reset to
   0. Both of these bugs are fixed in this series, (and tested by "make
   check").

6. Some minor cleanups to the glsl lexer, (mostly reduction of duplicated
   code).

7. Instructing bison to expect exactly one shift/reduce conflict in its
   grammar, (the unavoidable conflict due to the dangling-else case), and to
   generate an error if any other conflicts are added to the grammar.

NOTE: The commit message for patch 1 describes special behavior for GLES. The
code for this behavior is present in the patch, but is currently disabled with
an #if 0. This code should be re-enabled when the gles3 branch lands, (whether
before or after this series).

-Carl



More information about the mesa-dev mailing list