diff options
| author | Peter Eisentraut | 2024-12-19 14:37:44 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2024-12-19 14:37:44 +0000 |
| commit | 3e4bacb171001644583ac14e29ae1b09ce818c92 (patch) | |
| tree | 372f7cf3b7e6cbd849da2a0ef17e566c6f2fbbcd /src/include | |
| parent | 399d0f1e11b5438c6dc82e55a22a0f402855b2ac (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/bootstrap/bootstrap.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index 73b78b31335..33035d4ed82 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -55,9 +55,15 @@ extern void boot_get_type_io_data(Oid typid, Oid *typinput, Oid *typoutput); -extern int boot_yyparse(void); +union YYSTYPE; +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void *yyscan_t; +#endif -extern int boot_yylex(void); -extern void boot_yyerror(const char *message) pg_attribute_noreturn(); +extern int boot_yyparse(yyscan_t yyscanner); +extern int boot_yylex_init(yyscan_t *yyscannerp); +extern int boot_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner); +extern void boot_yyerror(yyscan_t yyscanner, const char *message) pg_attribute_noreturn(); #endif /* BOOTSTRAP_H */ |
