[Mesa-dev] [PATCH 1/4] glsl/glcpp: Alphabetize lists of start conditions

Kristian Høgsberg krh at bitplanet.net
Wed Jul 2 20:58:30 PDT 2014


On Tue, Jul 1, 2014 at 5:31 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Tuesday, July 01, 2014 03:25:49 PM Carl Worth wrote:
>> There is no behavioral change here. It's just easier to verify that lists
>> of start conditions include all expected conditions when they appear in a
>> consistent order.
>>
>> The <INITIAL> state is special, so it appears first in all lists. All others
>> appear in alphabetical order.
>> ---
>>  src/glsl/glcpp/glcpp-lex.l | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
>> index 539b46c..e82b85d 100644
>> --- a/src/glsl/glcpp/glcpp-lex.l
>> +++ b/src/glsl/glcpp/glcpp-lex.l
>> @@ -165,7 +165,7 @@ glcpp_lex_update_state_per_token (glcpp_parser_t
> *parser, int token)
>>        * update the "Internal compiler error" catch-all rule near the end of
>>        * this file. */
>>
>> -%x DONE COMMENT HASH UNREACHABLE DEFINE NEWLINE_CATCHUP
>> +%x COMMENT DEFINE DONE HASH NEWLINE_CATCHUP UNREACHABLE
>>
>>  SPACE                [[:space:]]
>>  NONSPACE     [^[:space:]]
>> @@ -253,7 +253,7 @@ HEXADECIMAL_INTEGER       0[xX][0-9a-fA-F]+[uU]?
>>  }
>>
>>       /* Multi-line comments */
>> -<DEFINE,HASH,INITIAL>"/*"   { yy_push_state(COMMENT, yyscanner); }
>> +<INITIAL,DEFINE,HASH>"/*"   { yy_push_state(COMMENT, yyscanner); }
>>  <COMMENT>[^*\r\n]*
>>  <COMMENT>[^*\r\n]*[\r\n]    { yylineno++; yycolumn = 0; parser-
>>commented_newlines++; }
>>  <COMMENT>"*"+[^*/\r\n]*
>> @@ -542,7 +542,7 @@ HEXADECIMAL_INTEGER       0[xX][0-9a-fA-F]+[uU]?
>>        * rule, then we have made a mistake above and need to fix one or more
>>        * of the preceding patterns to match that input. */
>>
>> -<INITIAL,DONE,COMMENT,DEFINE,HASH,NEWLINE_CATCHUP>. {
>> +<INITIAL,COMMENT,DEFINE,DONE,HASH,NEWLINE_CATCHUP>. {
>>       glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected
> character: %s", yytext);
>>  }
>>
>>
>
> This four part series is:
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
>
> krh - nice find on the %option warn nodefault!  That's really useful.

It seemed like the kind of thing that should be possible to check at
compile time and indeed it was.

For the series:

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> Carl - thanks for doing this!
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list