[Mesa-dev] [PATCH 1/3] glsl: use the prefixed name of the lexer generated functions

Timothy Arceri timothy.arceri at collabora.com
Thu Nov 3 21:56:33 UTC 2016


On Thu, 2016-10-27 at 12:41 +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Flex version 2.6.2 does not expand (define) the yy version of some
> function, thus we fail to compile.

functions

> 
> Strictly speaking this might be a flex bug, although expanding the
> few
> instances is perfectly trivial and works with 2.6.2 and earlier
> versions
> of flex.

This seems a bit fragile to me. As far as I can tell (although it might
be unlikely) there is no guarantee that the expanded functions won't be
be changed on the flex end and require renaming again in future.

It would be nice if we could discover the real problem rather than
papering over it. If we must do a hack it would be good to note that it
is was because of a flex bug (code comment), otherwise if it's our bug
IMO we should try fix it properly.


> 
> Cc: "12.0 13.0" <mesa-stable at lists.freedesktop.org>
> Cc: Mike Lothian <mike at fireburn.co.uk>
> Repored-by: Mike Lothian <mike at fireburn.co.uk>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> Do we have any flex/bison wizards around ? I'm wondering if one
> cannot
> skim through the files and nuke some of the {mis,ab}uses that are
> bound
> to be lurking ;-)
> ---
>  src/compiler/glsl/glsl_lexer.ll | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/compiler/glsl/glsl_lexer.ll
> b/src/compiler/glsl/glsl_lexer.ll
> index d5e5d4c..e5492bf 100644
> --- a/src/compiler/glsl/glsl_lexer.ll
> +++ b/src/compiler/glsl/glsl_lexer.ll
> @@ -627,12 +627,12 @@ classify_identifier(struct
> _mesa_glsl_parse_state *state, const char *name)
>  void
>  _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const
> char *string)
>  {
> -   yylex_init_extra(state, & state->scanner);
> -   yy_scan_string(string, state->scanner);
> +   _mesa_glsl_lexer_lex_init_extra(state, & state->scanner);
> +   _mesa_glsl_lexer__scan_string(string, state->scanner);
>  }
>  
>  void
>  _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state)
>  {
> -   yylex_destroy(state->scanner);
> +   _mesa_glsl_lexer_lex_destroy(state->scanner);
>  }


More information about the mesa-dev mailing list