summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-11-21 12:29:07 +0400
committerAlexander Barkov <bar@mariadb.com>2019-11-21 12:40:46 +0400
commite76edf700ff787efffcf0b568e6f9fdc92b6d53f (patch)
tree40afc2bcf2b487634d3a84c3f06f40a6810f1605
parent747bed2e72d1736e57a9e34cb929b694a7467c36 (diff)
downloadmariadb-git-e76edf700ff787efffcf0b568e6f9fdc92b6d53f.tar.gz
MDEV-21110 Unify turn_parser_debug_on() in sql_yacc.yy and sql_yacc_ora.yy
The block defining turn_parser_debug_on() now looks similar in both sql_yacc.yy and sql_yacc_ora.yy.
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_priv.h3
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sql_yacc_ora.yy25
4 files changed, 32 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b787f99e94a..62cf4674241 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7904,7 +7904,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
{
int error __attribute__((unused));
DBUG_ENTER("mysql_parse");
- DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
+ DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on_MYSQLparse(););
+ DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on_ORAparse(););
/*
Warning.
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 7aca1d2b699..7be2692a33b 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -390,7 +390,8 @@ enum enum_yes_no_unknown
/* sql_yacc.cc */
#ifndef DBUG_OFF
-extern void turn_parser_debug_on();
+extern void turn_parser_debug_on_MYSQLparse();
+extern void turn_parser_debug_on_ORAparse();
#endif
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 02c7dcd5797..2657586cc42 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -153,7 +153,9 @@ static void yyerror(THD *thd, const char *s)
#ifndef DBUG_OFF
-void turn_parser_debug_on()
+#define __CONCAT_UNDERSCORED(x,y) x ## _ ## y
+#define _CONCAT_UNDERSCORED(x,y) __CONCAT_UNDERSCORED(x,y)
+void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
{
/*
MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index bb0baf98318..6c4ed3c2c51 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -152,6 +152,31 @@ static void yyerror(THD *thd, const char *s)
}
+#ifndef DBUG_OFF
+#define __CONCAT_UNDERSCORED(x,y) x ## _ ## y
+#define _CONCAT_UNDERSCORED(x,y) __CONCAT_UNDERSCORED(x,y)
+void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
+{
+ /*
+ MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
+ Turning this option on is **VERY** verbose, and should be
+ used when investigating a syntax error problem only.
+
+ The syntax to run with bison traces is as follows :
+ - Starting a server manually :
+ mysqld --debug-dbug="d,parser_debug" ...
+ - Running a test :
+ mysql-test-run.pl --mysqld="--debug-dbug=d,parser_debug" ...
+
+ The result will be in the process stderr (var/log/master.err)
+ */
+
+ extern int yydebug;
+ yydebug= 1;
+}
+#endif
+
+
#define bincmp_collation(X,Y) \
do \
{ \