On 07/31/2013 12:08 AM, Laurent Carlier wrote:
Le lundi 29 juillet 2013 16:07:35 Kenneth Graunke a écrit :
Bison 3.0 removes the YYLEX_PARAM macro.  In preparation for handling
this using %lex-param, the parser needs a wrapper function for the
actual Flex lex() function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Cc: mesa-sta...@lists.freedesktop.org
Cc: Sandeep <sandy.8...@gmail.com>
Cc: Bruno Jacquet <maxi...@free.fr>
Cc: Laurent Carlier <lordhea...@gmail.com>
Cc: Nikita Malyavin <nikitamalya...@gmail.com>
---
  src/glsl/glsl_lexer.ll        | 2 +-
  src/glsl/glsl_parser.yy       | 6 ++++++
  src/glsl/glsl_parser_extras.h | 4 ++--
  3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 9375230..e24df80 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -149,7 +149,7 @@ literal_integer(char *text, int len, struct
_mesa_glsl_parse_state *state, %option bison-bridge bison-locations
reentrant noyywrap
  %option nounput noyy_top_state
  %option never-interactive
-%option prefix="_mesa_glsl_"
+%option prefix="_mesa_glsl_lexer_"
  %option extra-type="struct _mesa_glsl_parse_state *"

  %x PP PRAGMA
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index bf31236..0b16d1d 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -39,6 +39,12 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state
*st, const char *msg) {
     _mesa_glsl_error(loc, st, "%s", msg);
  }
+
+static int
+_mesa_glsl_lex(YYSTYPE *val, YYLTYPE *loc, void *scanner)
+{
+   return _mesa_glsl_lexer_lex(val, loc, scanner);
+}
  %}

  %expect 0
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 7f478df..1e386dd 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -337,8 +337,8 @@ extern void _mesa_glsl_lexer_ctor(struct
_mesa_glsl_parse_state *state, extern void _mesa_glsl_lexer_dtor(struct
_mesa_glsl_parse_state *state);

  union YYSTYPE;
-extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
-                         void *scanner);
+extern int _mesa_glsl_lexer_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
+                                void *scanner);

  extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *);

Got the following error with bison3:
make[4]: Leaving directory `/build/mesa-git/src/mesa/src/glsl'
make[3]: Leaving directory `/build/mesa-git/src/mesa/src/glsl'
make[2]: Leaving directory `/build/mesa-git/src/mesa/src/glsl'
Making all in mesa
make[2]: Entering directory `/build/mesa-git/src/mesa/src/mesa'
   GEN      main/get_hash.h
updating main/git_sha1.h
make  all-recursive
make[3]: Entering directory `/build/mesa-git/src/mesa/src/mesa'
Making all in program
make[4]: Entering directory `/build/mesa-git/src/mesa/src/mesa/program'
   GEN      program_parse.tab.c
   GEN      program_parse.tab.h
   GEN      lex.yy.c
make  all-am
make[5]: Entering directory `/build/mesa-git/src/mesa/src/mesa/program'
   CC       libdricore_program_la-arbprogparse.lo
   CC       libdricore_program_la-prog_hash_table.lo
   CXX      libdricore_program_la-ir_to_mesa.lo
   CC       libdricore_program_la-program.lo
   CC       libdricore_program_la-program_parse_extra.lo
   CC       libdricore_program_la-prog_cache.lo
   CC       libdricore_program_la-prog_execute.lo
   CC       libdricore_program_la-prog_instruction.lo
   CC       libdricore_program_la-prog_noise.lo
   CC       libdricore_program_la-prog_optimize.lo
   CC       libdricore_program_la-prog_opt_constant_fold.lo
   CC       libdricore_program_la-prog_parameter.lo
   CC       libdricore_program_la-prog_parameter_layout.lo
   CC       libdricore_program_la-prog_print.lo
   CC       libdricore_program_la-prog_statevars.lo
   CC       libdricore_program_la-programopt.lo
   CC       libdricore_program_la-register_allocate.lo
   CXX      libdricore_program_la-sampler.lo
   CXX      libdricore_program_la-string_to_uint_map.lo
   CC       libdricore_program_la-symbol_table.lo
   CC       libdricore_program_la-lex.yy.lo
   CC       libdricore_program_la-program_parse.tab.lo
   CC       arbprogparse.lo
   CC       prog_hash_table.lo
program_parse.tab.c: In function '_mesa_program_parse':
program_parse.tab.c:1958:3: error: implicit declaration of function 'YYID' [-
Werror=implicit-function-declaration]
    YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);

Strange, I must've botched my testing...I definitely hit that too. I applied your patch to fix the problem. Thanks for the patch!

master should build with both 2.7 and 3.0 now.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to