Commit 619d22dd authored by Marko Mäkelä's avatar Marko Mäkelä

Rebuild the InnoDB lexical analyzers with flex 2.6.4

InnoDB includes 3 parsers, which use 3 lexical analyzers that
are generated with flex. Flex versions before 2.6 emitted
the keyword "register", which is deprecated in C++17.

The lexical analyzers were regenerated as follows:

for s in storage/innobase storage/xtradb
do
	(cd "$s"/pars; ./make_flex.sh)
	touch "$s"/fts/*.l
	make -C "$s"/fts -f Makefile.query
done
parent 23eeecd6
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -109,11 +110,11 @@ pars_sql( ...@@ -109,11 +110,11 @@ pars_sql(
Retrieves characters to the lexical analyzer. Retrieves characters to the lexical analyzer.
@return number of characters copied or 0 on EOF */ @return number of characters copied or 0 on EOF */
UNIV_INTERN UNIV_INTERN
int size_t
pars_get_lex_chars( pars_get_lex_chars(
/*===============*/ /*===============*/
char* buf, /*!< in/out: buffer where to copy */ char* buf, /*!< in/out: buffer where to copy */
int max_size); /*!< in: maximum number of characters which fit size_t max_size); /*!< in: maximum number of characters which fit
in the buffer */ in the buffer */
/*************************************************************//** /*************************************************************//**
Called by yyparse on error. */ Called by yyparse on error. */
......
This diff is collapsed.
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. # Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) 2017, MariaDB Corporation.
# #
# This program is free software; you can redistribute it and/or modify it under # 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 the Free Software # the terms of the GNU General Public License as published by the Free Software
...@@ -31,6 +32,7 @@ echo '#include "univ.i"' > $OUTFILE ...@@ -31,6 +32,7 @@ echo '#include "univ.i"' > $OUTFILE
# a warning on Win64. Add the cast. Also define some symbols as static. # a warning on Win64. Add the cast. Also define some symbols as static.
sed -e ' sed -e '
s/'"$TMPFILE"'/'"$OUTFILE"'/; s/'"$TMPFILE"'/'"$OUTFILE"'/;
s/^void yyset_extra *(YY_EXTRA_TYPE *user_defined *);//
s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/; s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/;
s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/; s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/;
s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/; s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/;
...@@ -38,11 +40,12 @@ s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/; ...@@ -38,11 +40,12 @@ s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/; s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/;
s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/; s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/;
s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; s/extern int yy\(leng\|_flex_debug\|lineno\);//;
s/\(int yy\(leng\|lineno\|_flex_debug\)\)/static \1/;
s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/; s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/;
s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/; s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/;
s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; s/^extern \(\(FILE\|char\) *\* *yy\).*//;
s/^\(FILE\|char\) *\* *yy/static &/;
' < $TMPFILE >> $OUTFILE ' < $TMPFILE >> $OUTFILE
rm $TMPFILE rm $TMPFILE
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -64,9 +65,8 @@ Created 12/14/1997 Heikki Tuuri ...@@ -64,9 +65,8 @@ Created 12/14/1997 Heikki Tuuri
#define realloc(P, A) ut_realloc(P, A) #define realloc(P, A) ut_realloc(P, A)
#define exit(A) ut_error #define exit(A) ut_error
/* Note: We cast &result to int* from yysize_t* */
#define YY_INPUT(buf, result, max_size) \ #define YY_INPUT(buf, result, max_size) \
pars_get_lex_chars(buf, (int*) &result, max_size) result = pars_get_lex_chars(buf, max_size)
/* String buffer for removing quotes */ /* String buffer for removing quotes */
static ulint stringbuf_len_alloc = 0; /* Allocated length */ static ulint stringbuf_len_alloc = 0; /* Allocated length */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -2153,16 +2154,14 @@ pars_stored_procedure_call( ...@@ -2153,16 +2154,14 @@ pars_stored_procedure_call(
/*************************************************************//** /*************************************************************//**
Retrieves characters to the lexical analyzer. */ Retrieves characters to the lexical analyzer. */
UNIV_INTERN UNIV_INTERN
int size_t
pars_get_lex_chars( pars_get_lex_chars(
/*===============*/ /*===============*/
char* buf, /*!< in/out: buffer where to copy */ char* buf, /*!< in/out: buffer where to copy */
int max_size) /*!< in: maximum number of characters which fit size_t max_size) /*!< in: maximum number of characters which fit
in the buffer */ in the buffer */
{ {
int len; size_t len = size_t(
len = static_cast<int>(
pars_sym_tab_global->string_len pars_sym_tab_global->string_len
- pars_sym_tab_global->next_char_pos); - pars_sym_tab_global->next_char_pos);
if (len == 0) { if (len == 0) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -109,11 +110,11 @@ pars_sql( ...@@ -109,11 +110,11 @@ pars_sql(
Retrieves characters to the lexical analyzer. Retrieves characters to the lexical analyzer.
@return number of characters copied or 0 on EOF */ @return number of characters copied or 0 on EOF */
UNIV_INTERN UNIV_INTERN
int size_t
pars_get_lex_chars( pars_get_lex_chars(
/*===============*/ /*===============*/
char* buf, /*!< in/out: buffer where to copy */ char* buf, /*!< in/out: buffer where to copy */
int max_size); /*!< in: maximum number of characters which fit size_t max_size); /*!< in: maximum number of characters which fit
in the buffer */ in the buffer */
/*************************************************************//** /*************************************************************//**
Called by yyparse on error. */ Called by yyparse on error. */
......
This diff is collapsed.
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. # Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) 2017, MariaDB Corporation.
# #
# This program is free software; you can redistribute it and/or modify it under # 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 the Free Software # the terms of the GNU General Public License as published by the Free Software
...@@ -31,6 +32,7 @@ echo '#include "univ.i"' > $OUTFILE ...@@ -31,6 +32,7 @@ echo '#include "univ.i"' > $OUTFILE
# a warning on Win64. Add the cast. Also define some symbols as static. # a warning on Win64. Add the cast. Also define some symbols as static.
sed -e ' sed -e '
s/'"$TMPFILE"'/'"$OUTFILE"'/; s/'"$TMPFILE"'/'"$OUTFILE"'/;
s/^void yyset_extra *(YY_EXTRA_TYPE *user_defined *);//
s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/; s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/;
s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/; s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/;
s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/; s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/;
...@@ -38,11 +40,12 @@ s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/; ...@@ -38,11 +40,12 @@ s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/; s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/;
s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/; s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/;
s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; s/extern int yy\(leng\|_flex_debug\|lineno\);//;
s/\(int yy\(leng\|lineno\|_flex_debug\)\)/static \1/;
s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/; s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/;
s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/;
s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/; s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/;
s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; s/^extern \(\(FILE\|char\) *\* *yy\).*//;
s/^\(FILE\|char\) *\* *yy/static &/;
' < $TMPFILE >> $OUTFILE ' < $TMPFILE >> $OUTFILE
rm $TMPFILE rm $TMPFILE
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -64,9 +65,8 @@ Created 12/14/1997 Heikki Tuuri ...@@ -64,9 +65,8 @@ Created 12/14/1997 Heikki Tuuri
#define realloc(P, A) ut_realloc(P, A) #define realloc(P, A) ut_realloc(P, A)
#define exit(A) ut_error #define exit(A) ut_error
/* Note: We cast &result to int* from yysize_t* */
#define YY_INPUT(buf, result, max_size) \ #define YY_INPUT(buf, result, max_size) \
pars_get_lex_chars(buf, (int*) &result, max_size) result = pars_get_lex_chars(buf, max_size)
/* String buffer for removing quotes */ /* String buffer for removing quotes */
static ulint stringbuf_len_alloc = 0; /* Allocated length */ static ulint stringbuf_len_alloc = 0; /* Allocated length */
...@@ -697,10 +697,8 @@ void ...@@ -697,10 +697,8 @@ void
pars_lexer_close(void) pars_lexer_close(void)
/*==================*/ /*==================*/
{ {
if (yy_buffer_stack) yylex_destroy();
yylex_destroy(); free(stringbuf);
if (stringbuf)
free(stringbuf);
stringbuf = NULL; stringbuf = NULL;
stringbuf_len_alloc = stringbuf_len = 0; stringbuf_len_alloc = stringbuf_len = 0;
} }
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -2153,16 +2154,14 @@ pars_stored_procedure_call( ...@@ -2153,16 +2154,14 @@ pars_stored_procedure_call(
/*************************************************************//** /*************************************************************//**
Retrieves characters to the lexical analyzer. */ Retrieves characters to the lexical analyzer. */
UNIV_INTERN UNIV_INTERN
int size_t
pars_get_lex_chars( pars_get_lex_chars(
/*===============*/ /*===============*/
char* buf, /*!< in/out: buffer where to copy */ char* buf, /*!< in/out: buffer where to copy */
int max_size) /*!< in: maximum number of characters which fit size_t max_size) /*!< in: maximum number of characters which fit
in the buffer */ in the buffer */
{ {
int len; size_t len = size_t(
len = static_cast<int>(
pars_sym_tab_global->string_len pars_sym_tab_global->string_len
- pars_sym_tab_global->next_char_pos); - pars_sym_tab_global->next_char_pos);
if (len == 0) { if (len == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment