mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
bootstrap: pure parser and reentrant scanner
Use the flex %option reentrant and the bison option %pure-parser to make the generated scanner and parser pure, reentrant, and thread-safe. Make the generated scanner use palloc() etc. instead of malloc() etc. For the bootstrap scanner and parser, reentrancy and memory management aren't that important, but we make this change here anyway so that all the scanners and parsers in the backend use a similar set of options and APIs. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Andreas Karlsson <andreas@proxel.se> Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
This commit is contained in:
@@ -34,10 +34,6 @@
|
||||
|
||||
#include "bootparse.h"
|
||||
|
||||
/* silence -Wmissing-variable-declarations */
|
||||
extern int boot_yychar;
|
||||
extern int boot_yynerrs;
|
||||
|
||||
|
||||
/*
|
||||
* Bison doesn't allocate anything that needs to live across parser calls,
|
||||
@@ -81,6 +77,9 @@ static int num_columns_read = 0;
|
||||
|
||||
%}
|
||||
|
||||
%parse-param {yyscan_t yyscanner}
|
||||
%lex-param {yyscan_t yyscanner}
|
||||
%pure-parser
|
||||
%expect 0
|
||||
%name-prefix="boot_yy"
|
||||
|
||||
@@ -141,6 +140,8 @@ Boot_OpenStmt:
|
||||
do_start();
|
||||
boot_openrel($2);
|
||||
do_end();
|
||||
|
||||
(void) yynerrs; /* suppress compiler warning */
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user