summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2014-06-23 19:59:15 +0400
committerGleb Shchepa <gleb.shchepa@oracle.com>2014-06-23 19:59:15 +0400
commit7141ae856164c19b6c6faefb4ea7e21a98b0c92a (patch)
tree588f77c9e40c5133d2b6c67d7c19be761b99c760 /sql
parent2e26e9057cb39e85699d41642802faa4e6995471 (diff)
downloadmariadb-git-7141ae856164c19b6c6faefb4ea7e21a98b0c92a.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_lex.cc19
-rw-r--r--sql/sql_lex.h5
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_yacc.yy18
4 files changed, 20 insertions, 26 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 9113f31c76c..17446778034 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -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
it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
#include "sp.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
@@ -864,16 +864,17 @@ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
/*
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_OPERATOR_OR_IDENT Last state was an ident, text or 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;
- YYSTYPE *yylval=(YYSTYPE*) arg;
int token;
if (lip->lookahead_token >= 0)
@@ -889,7 +890,7 @@ int MYSQLlex(void *arg, void *yythd)
return token;
}
- token= lex_one_token(arg, yythd);
+ token= lex_one_token(yylval, thd);
switch(token) {
case WITH:
@@ -900,7 +901,7 @@ int MYSQLlex(void *arg, void *yythd)
to transform the grammar into a LALR(1) grammar,
which sql_yacc.yy can process.
*/
- token= lex_one_token(arg, yythd);
+ token= lex_one_token(yylval, thd);
switch(token) {
case CUBE_SYM:
return WITH_CUBE_SYM;
@@ -923,17 +924,15 @@ int MYSQLlex(void *arg, void *yythd)
return token;
}
-int lex_one_token(void *arg, void *yythd)
+static int lex_one_token(YYSTYPE *yylval, THD *thd)
{
reg1 uchar c= 0;
bool comment_closed;
int tokval, result_state;
uint length;
enum my_lex_states state;
- THD *thd= (THD *)yythd;
Lex_input_stream *lip= & thd->m_parser_state->m_lip;
LEX *lex= thd->lex;
- YYSTYPE *yylval=(YYSTYPE*) arg;
CHARSET_INFO *cs= thd->charset();
uchar *state_map= cs->state_map;
uchar *ident_map= cs->ident_map;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 40fea173a7a..c5886b3c142 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,5 +1,4 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. reserved.
- 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
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_start(THD *thd);
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);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fe9f564672a..ea63d23d182 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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
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
/**
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 3af964db731..bd5d4dc5604 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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.
-** Use the YYTHD macro for this.
+/*
+Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
*/
-#define YYPARSE_PARAM yythd
-#define YYLEX_PARAM yythd
-#define YYTHD ((THD *)yythd)
#define YYLIP (& YYTHD->m_parser_state->m_lip)
#define YYPS (& YYTHD->m_parser_state->m_yacc)
@@ -76,7 +72,7 @@ int yylex(void *yylval, void *yythd);
ulong val= *(F); \
if (my_yyoverflow((B), (D), &val)) \
{ \
- yyerror((char*) (A)); \
+ yyerror(YYTHD, (char*) (A)); \
return 2; \
} \
else \
@@ -174,10 +170,8 @@ void my_parse_error(const char *s)
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
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);
%}
-%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.
We should not introduce new conflicts any more.