I noticed that BF animal icarus, which is running a bleeding-edge
version of flex (2.7.3, which was seemingly released last week),
is now issuing warnings about YY_READ_BUF_SIZE:
icarus | 2026-11-29 09:00:03 |
/scratch/bf/pgbf/buildroot/HEAD/pgsql/contrib/cube/cubescan.l:17: warning:
"YY_READ_BUF_SIZE" redefined
icarus | 2026-11-29 09:00:03 |
/scratch/bf/pgbf/buildroot/HEAD/pgsql/contrib/pg_plan_advice/pgpa_scanner.l:39:
warning: "YY_READ_BUF_SIZE" redefined
icarus | 2026-11-29 09:00:03 |
/scratch/bf/pgbf/buildroot/HEAD/pgsql/contrib/seg/segscan.l:17: warning:
"YY_READ_BUF_SIZE" redefined
Apparently flex has moved the declaration of that symbol from its
emitted .c file to its emitted .h file, so that trying to override
it where these files are trying to do that is too late.
I first thought we needed to relocate these #defines, but after
some git archaeology I find that they are decades obsolete and
we should just get rid of them. Specifically, I see that:
a84c95634 (2000-03-13) introduced an override of YY_READ_BUF_SIZE
into src/backend/parser/scan.l, in order to increase the chunk
size that flex was willing to transfer into its buffer at one time.
32c6c99e0 (2002-04-20) removed scan.l's redefinition of YY_INPUT()
in favor of calling yy_scan_buffer(). This meant that we no longer
ever reach the flex-generated code that consults YY_READ_BUF_SIZE.
But we didn't notice that our definition no longer did anything.
03e47392e and 043be9ad9 (2003-09-14) copied the state of scan.l's
input-buffering logic into contrib/cube and contrib/seg, thereby
both removing their use of YY_INPUT() and duplicating the now-useless
definition of YY_READ_BUF_SIZE.
737f1cd44 (2004-02-19) finally noticed that scan.l's definition
of YY_READ_BUF_SIZE was pointless and took it out, but still failed
to notice the equally-useless definitions in contrib/.
5883ff30b (2026-03-12) copied the input-buffering logic from one
of the other contrib modules into pg_plan_advice, along with
YY_READ_BUF_SIZE.
So that's a bit of a comedy of errors. But anyway, our definitions
of that symbol have been useless since 2003, and I propose to
silence these warnings by removing them.
regards, tom lane