mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #18978946: BACKPORT TO 5.6: BUGFIX FOR 18017820 "BISON 3 BREAKS MYSQL BUILD"
Backport of the fix: : Bug 18017820: BISON 3 BREAKS MYSQL BUILD : ======================================== : : The source of the reported problem is a removal of a few deprecated : things from Bison 3.x: : * YYPARSE_PARAM macro (use the %parse-param bison directive instead), : * YYLEX_PARAM macro (use %lex-param instead), : : The fix removes obsolete macro calls and introduces use of : %parse-param and %lex-param directives.
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#include "sp.h"
|
#include "sp.h"
|
||||||
#include "sp_head.h"
|
#include "sp_head.h"
|
||||||
|
|
||||||
static int lex_one_token(void *arg, void *yythd);
|
static int lex_one_token(YYSTYPE *yylval, THD *thd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We are using pointer to this variable for distinguishing between assignment
|
We are using pointer to this variable for distinguishing between assignment
|
||||||
@ -864,16 +864,17 @@ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
|
|||||||
/*
|
/*
|
||||||
MYSQLlex remember the following states from the following MYSQLlex()
|
MYSQLlex remember the following states from the following MYSQLlex()
|
||||||
|
|
||||||
|
@param yylval [out] semantic value of the token being parsed (yylval)
|
||||||
|
@param thd THD
|
||||||
|
|
||||||
- MY_LEX_EOQ Found end of query
|
- MY_LEX_EOQ Found end of query
|
||||||
- MY_LEX_OPERATOR_OR_IDENT Last state was an ident, text or number
|
- MY_LEX_OPERATOR_OR_IDENT Last state was an ident, text or number
|
||||||
(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(YYSTYPE *yylval, 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;
|
|
||||||
int token;
|
int token;
|
||||||
|
|
||||||
if (lip->lookahead_token >= 0)
|
if (lip->lookahead_token >= 0)
|
||||||
@ -889,7 +890,7 @@ int MYSQLlex(void *arg, void *yythd)
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
token= lex_one_token(arg, yythd);
|
token= lex_one_token(yylval, thd);
|
||||||
|
|
||||||
switch(token) {
|
switch(token) {
|
||||||
case WITH:
|
case WITH:
|
||||||
@ -900,7 +901,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(yylval, thd);
|
||||||
switch(token) {
|
switch(token) {
|
||||||
case CUBE_SYM:
|
case CUBE_SYM:
|
||||||
return WITH_CUBE_SYM;
|
return WITH_CUBE_SYM;
|
||||||
@ -923,17 +924,15 @@ int MYSQLlex(void *arg, void *yythd)
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lex_one_token(void *arg, void *yythd)
|
static int lex_one_token(YYSTYPE *yylval, THD *thd)
|
||||||
{
|
{
|
||||||
reg1 uchar c= 0;
|
reg1 uchar c= 0;
|
||||||
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;
|
|
||||||
CHARSET_INFO *cs= thd->charset();
|
CHARSET_INFO *cs= thd->charset();
|
||||||
uchar *state_map= cs->state_map;
|
uchar *state_map= cs->state_map;
|
||||||
uchar *ident_map= cs->ident_map;
|
uchar *ident_map= cs->ident_map;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. reserved.
|
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
reserved.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -2794,7 +2793,7 @@ extern void lex_init(void);
|
|||||||
extern void lex_free(void);
|
extern void lex_free(void);
|
||||||
extern void lex_start(THD *thd);
|
extern void lex_start(THD *thd);
|
||||||
extern void lex_end(LEX *lex);
|
extern void lex_end(LEX *lex);
|
||||||
extern int MYSQLlex(void *arg, void *yythd);
|
extern int MYSQLlex(union YYSTYPE *yylval, class THD *thd);
|
||||||
|
|
||||||
extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
|
extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -7359,7 +7359,7 @@ bool check_host_name(LEX_STRING *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern int MYSQLparse(void *thd); // from sql_yacc.cc
|
extern int MYSQLparse(class THD *thd); // from sql_yacc.cc
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,13 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* thd is passed as an argument to yyparse(), and subsequently to yylex().
|
/*
|
||||||
** The type will be void*, so it must be cast to (THD*) when used.
|
Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
|
||||||
** Use the YYTHD macro for this.
|
|
||||||
*/
|
*/
|
||||||
#define YYPARSE_PARAM yythd
|
|
||||||
#define YYLEX_PARAM yythd
|
|
||||||
#define YYTHD ((THD *)yythd)
|
|
||||||
#define YYLIP (& YYTHD->m_parser_state->m_lip)
|
#define YYLIP (& YYTHD->m_parser_state->m_lip)
|
||||||
#define YYPS (& YYTHD->m_parser_state->m_yacc)
|
#define YYPS (& YYTHD->m_parser_state->m_yacc)
|
||||||
|
|
||||||
@ -76,7 +72,7 @@ int yylex(void *yylval, void *yythd);
|
|||||||
ulong val= *(F); \
|
ulong val= *(F); \
|
||||||
if (my_yyoverflow((B), (D), &val)) \
|
if (my_yyoverflow((B), (D), &val)) \
|
||||||
{ \
|
{ \
|
||||||
yyerror((char*) (A)); \
|
yyerror(YYTHD, (char*) (A)); \
|
||||||
return 2; \
|
return 2; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
@ -174,10 +170,8 @@ void my_parse_error(const char *s)
|
|||||||
to abort from the parser.
|
to abort from the parser.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void MYSQLerror(const char *s)
|
void MYSQLerror(THD *thd, const char *s)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Restore the original LEX if it was replaced when parsing
|
Restore the original LEX if it was replaced when parsing
|
||||||
a stored procedure. We must ensure that a parsing error
|
a stored procedure. We must ensure that a parsing error
|
||||||
@ -787,7 +781,9 @@ static bool add_create_index (LEX *lex, Key::Keytype type,
|
|||||||
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%pure_parser /* We have threads */
|
%parse-param { class THD *YYTHD }
|
||||||
|
%lex-param { class THD *YYTHD }
|
||||||
|
%pure-parser /* We have threads */
|
||||||
/*
|
/*
|
||||||
Currently there are 168 shift/reduce conflicts.
|
Currently there are 168 shift/reduce conflicts.
|
||||||
We should not introduce new conflicts any more.
|
We should not introduce new conflicts any more.
|
||||||
|
Reference in New Issue
Block a user