1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-4902 - sql_yacc.yy incompatible with bison 3

- YYPARSE_PARAM and YYLEX_PARAM are removed in Bison 3.0. Deprecated
  since Bison 1.875 in favor of %lex-param, %parse-param.
- %parse-param adds an argument to yyerror() as well, updated
  MYSQLerror() accordingly.
- %parse-param allows to declare proper type for argument. That's
  what 99% of this patch is about.
This commit is contained in:
Sergey Vojtovich
2013-08-30 11:00:29 +04:00
parent 59af095da4
commit 6fc98018a4
4 changed files with 376 additions and 476 deletions

View File

@ -30,7 +30,7 @@
#include "sp.h" #include "sp.h"
#include "sql_select.h" #include "sql_select.h"
static int lex_one_token(void *arg, void *yythd); static int lex_one_token(void *arg, THD *thd);
/* /*
We are using pointer to this variable for distinguishing between assignment We are using pointer to this variable for distinguishing between assignment
@ -954,9 +954,8 @@ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
(which can't be followed by a signed number) (which can't be followed by a signed number)
*/ */
int MYSQLlex(void *arg, void *yythd) int MYSQLlex(void *arg, THD *thd)
{ {
THD *thd= (THD *)yythd;
Lex_input_stream *lip= & thd->m_parser_state->m_lip; Lex_input_stream *lip= & thd->m_parser_state->m_lip;
YYSTYPE *yylval=(YYSTYPE*) arg; YYSTYPE *yylval=(YYSTYPE*) arg;
int token; int token;
@ -974,7 +973,7 @@ int MYSQLlex(void *arg, void *yythd)
return token; return token;
} }
token= lex_one_token(arg, yythd); token= lex_one_token(arg, thd);
switch(token) { switch(token) {
case WITH: case WITH:
@ -985,7 +984,7 @@ int MYSQLlex(void *arg, void *yythd)
to transform the grammar into a LALR(1) grammar, to transform the grammar into a LALR(1) grammar,
which sql_yacc.yy can process. which sql_yacc.yy can process.
*/ */
token= lex_one_token(arg, yythd); token= lex_one_token(arg, thd);
switch(token) { switch(token) {
case CUBE_SYM: case CUBE_SYM:
return WITH_CUBE_SYM; return WITH_CUBE_SYM;
@ -1008,14 +1007,13 @@ int MYSQLlex(void *arg, void *yythd)
return token; return token;
} }
int lex_one_token(void *arg, void *yythd) int lex_one_token(void *arg, THD *thd)
{ {
reg1 uchar c; reg1 uchar c;
bool comment_closed; bool comment_closed;
int tokval, result_state; int tokval, result_state;
uint length; uint length;
enum my_lex_states state; enum my_lex_states state;
THD *thd= (THD *)yythd;
Lex_input_stream *lip= & thd->m_parser_state->m_lip; Lex_input_stream *lip= & thd->m_parser_state->m_lip;
LEX *lex= thd->lex; LEX *lex= thd->lex;
YYSTYPE *yylval=(YYSTYPE*) arg; YYSTYPE *yylval=(YYSTYPE*) arg;

View File

@ -2931,7 +2931,7 @@ extern void lex_start(THD *thd);
extern void lex_end(LEX *lex); extern void lex_end(LEX *lex);
void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex); void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex);
int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex); int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex);
extern int MYSQLlex(void *arg, void *yythd); extern int MYSQLlex(void *arg, THD *thd);
extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str); extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);

View File

@ -7602,7 +7602,7 @@ bool check_host_name(LEX_STRING *str)
} }
extern int MYSQLparse(void *thd); // from sql_yacc.cc extern int MYSQLparse(THD *thd); // from sql_yacc.cc
/** /**

File diff suppressed because it is too large Load Diff