cmListFileLexer: Update to flex 2.6

Revise the documented modifications we need to make to the
flex-generated source file according to the needs of the new version.
Update our own implementation to avoid warnings with flex types.
This commit is contained in:
Brad King 2016-05-17 10:31:41 -04:00
parent 7d2a0aa76c
commit e4a92dab3f
3 changed files with 858 additions and 786 deletions

View File

@ -1,2 +1,5 @@
# Preserve upstream indentation style. # Preserve upstream indentation style.
cm_sha2.* whitespace=indent-with-non-tab cm_sha2.* whitespace=indent-with-non-tab
# Preserve indentation style in generated code.
cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab

File diff suppressed because it is too large Load Diff

View File

@ -14,19 +14,16 @@
This file must be translated to C and modified to build everywhere. This file must be translated to C and modified to build everywhere.
Run flex like this: Run flex >= 2.6 like this:
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
Modify cmListFileLexer.c: Modify cmListFileLexer.c:
- remove TABs - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
- remove use of the 'register' storage class specifier - remove blank lines at end of file
- remove the yyunput function
- add a statement "(void)yyscanner;" to the top of these methods:
yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy - remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements - remove all YY_BREAK lines occurring right after return statements
- remove the isatty forward declaration - remove unnecessary cast to (int) in yy_get_next_buffer
*/ */
@ -45,7 +42,7 @@ Modify cmListFileLexer.c:
struct cmListFileLexer_s struct cmListFileLexer_s
{ {
cmListFileLexer_Token token; cmListFileLexer_Token token;
int bracket; yy_size_t bracket;
int comment; int comment;
int line; int line;
int column; int column;
@ -112,7 +109,7 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
lexer->token.type = cmListFileLexer_Token_ArgumentBracket; lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
} }
cmListFileLexerSetToken(lexer, "", 0); cmListFileLexerSetToken(lexer, "", 0);
lexer->bracket = (int)(strchr(bracket+1, '[') - bracket); lexer->bracket = strchr(bracket+1, '[') - bracket;
if(yytext[yyleng-1] == '\n') if(yytext[yyleng-1] == '\n')
{ {
++lexer->line; ++lexer->line;