Re: pure parsers and reentrant scanners

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Andreas Karlsson <andreas@proxel.se>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-18T09:42:37Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Return yyparse() result not via global variable

  2. Remove flex version checks

  3. Drop warning-free support for Flex 2.5.35

  4. plpgsql: pure parser and reentrant scanner

  5. flex code modernization: Replace YY_EXTRA_TYPE define with flex option

  6. guc: reentrant scanner

  7. jsonpath scanner: reentrant scanner

  8. syncrep parser: pure parser and reentrant scanner

  9. replication parser: pure parser and reentrant scanner

  10. bootstrap: pure parser and reentrant scanner

  11. Small whitespace improvement

  12. Prevent redeclaration of typedef yyscan_t

  13. seg: pure parser and reentrant scanner

  14. cube: pure parser and reentrant scanner

Attachments

I started committing the cube and seg pieces.  There were a couple of 
complaints from the buildfarm, like

ccache clang -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Werror=vla 
-Werror=unguarded-availability-new -Wendif-labels 
-Wmissing-format-attribute -Wcast-function-type -Wformat-security 
-Wmissing-variable-declarations -fno-strict-aliasing -fwrapv 
-Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -g 
-O2 -fno-common -fsanitize=alignment -fsanitize-trap=alignment 
-Wno-deprecated-declarations -Werror  -fvisibility=hidden -I. -I. 
-I../../src/include  -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk 
-DWRITE_READ_PARSE_PLAN_TREES -DSTRESS_SORT_INT_MIN 
-DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS 
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include 
-I/usr/local/include  -I/usr/local/ssl/include  -c -o segscan.o segscan.c
segscan.c:348:15: error: redefinition of typedef 'yyscan_t' is a C11 
feature [-Werror,-Wtypedef-redefinition]
typedef void* yyscan_t;
               ^
./segdata.h:19:15: note: previous definition is here
typedef void *yyscan_t;
               ^

I can fix that with the attached patch.

The symbol YY_TYPEDEF_YY_SCANNER_T isn't documented, but we already use 
it elsewhere in the code.

Note that in replication/syncrep.h and replication/walsender_private.h 
we have to have an #ifndef wrapper because there are files that end up 
including both headers.  Maybe we should put that #ifndef wrapper 
everywhere for consistency?

Any thoughts?

(Also, we should probably figure out a way to get these warnings before 
things hit the buildfarm.)