pgsql: Tighten up parsing logic in gen_node_support.pl. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Tighten up parsing logic in gen_node_support.pl.
Date
Msg-id E1oByW8-0008h4-Pv@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Tighten up parsing logic in gen_node_support.pl.

Teach this script to handle function pointer fields honestly.
Previously they were just silently ignored, but that's not likely to
be a behavior we can accept indefinitely.  This mostly entails fixing
it so that a field declaration spanning multiple lines can be parsed,
because we have a bunch of such fields that're laid out that way.
But that's a good improvement in its own right.

With that change and a minor regex adjustment, the only struct it
fails to parse in the node-defining headers is A_Const, because
of the embedded union.  The path of least resistance is to move
that union declaration outside the struct.

Having done those things, we can make it error out if it finds
any within-struct syntax it doesn't understand, which seems like
a pretty important property for robustness.

This commit doesn't change the output files at all; it's just in
the way of future-proofing.

Discussion: https://postgr.es/m/2593369.1657759779@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7c0eb3c622eb0882f460805109f244679b340964

Modified Files
--------------
src/backend/nodes/gen_node_support.pl | 77 +++++++++++++++++++++++++++++++++--
src/include/nodes/parsenodes.h        | 28 ++++++-------
src/include/nodes/pathnodes.h         |  5 ++-
3 files changed, 90 insertions(+), 20 deletions(-)


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: pgsql: Avoid shadowing a variable in sync.c.
Next
From: Thomas Munro
Date:
Subject: pgsql: Don't clobber postmaster sigmask in dsm_impl_resize.