Skip to content

Commit bf022d3

Browse files
committed
Rationalize order of input files for gen_node_support.pl.
Per a question from Andres Freund. While here, also make the list of nodetag-only files easier to compare to the full list of input files. Discussion: https://postgr.es/m/20220710214622.haiektrjzisob6rl@awork3.anarazel.de
1 parent b2d5b4c commit bf022d3

File tree

3 files changed

+50
-32
lines changed

3 files changed

+50
-32
lines changed

src/backend/nodes/Makefile

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,31 @@ OBJS = \
3333

3434
include $(top_srcdir)/src/backend/common.mk
3535

36+
# The principal node-defining headers are listed in their inclusion order,
37+
# to ensure cross-file subtyping works correctly. The rest can just be
38+
# listed alphabetically.
39+
# Caution: re-ordering this list risks ABI breakage!
3640
node_headers = \
3741
nodes/nodes.h \
38-
nodes/execnodes.h \
39-
nodes/plannodes.h \
4042
nodes/primnodes.h \
41-
nodes/pathnodes.h \
42-
nodes/extensible.h \
4343
nodes/parsenodes.h \
44-
nodes/replnodes.h \
45-
nodes/value.h \
46-
commands/trigger.h \
47-
commands/event_trigger.h \
48-
foreign/fdwapi.h \
44+
nodes/pathnodes.h \
45+
nodes/plannodes.h \
46+
nodes/execnodes.h \
4947
access/amapi.h \
48+
access/sdir.h \
5049
access/tableam.h \
5150
access/tsmapi.h \
52-
utils/rel.h \
53-
nodes/supportnodes.h \
51+
commands/event_trigger.h \
52+
commands/trigger.h \
5453
executor/tuptable.h \
54+
foreign/fdwapi.h \
55+
nodes/extensible.h \
5556
nodes/lockoptions.h \
56-
access/sdir.h
57+
nodes/replnodes.h \
58+
nodes/supportnodes.h \
59+
nodes/value.h \
60+
utils/rel.h
5761

5862
# see also catalog/Makefile for an explanation of these make rules
5963

src/backend/nodes/gen_node_support.pl

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ sub elem
9595
# currently not required.
9696
push @scalar_types, qw(QualCost);
9797

98+
# Nodes from these input files don't need support functions, just node tags.
99+
my @nodetag_only_files = qw(
100+
nodes/execnodes.h
101+
access/amapi.h
102+
access/sdir.h
103+
access/tableam.h
104+
access/tsmapi.h
105+
commands/event_trigger.h
106+
commands/trigger.h
107+
executor/tuptable.h
108+
foreign/fdwapi.h
109+
nodes/lockoptions.h
110+
nodes/replnodes.h
111+
nodes/supportnodes.h
112+
);
113+
98114
# XXX various things we are not publishing right now to stay level
99115
# with the manual system
100116
push @no_copy, qw(CallContext InlineCodeBlock);
@@ -133,6 +149,9 @@ sub elem
133149

134150
open my $ifh, '<', $infile or die "could not open \"$infile\": $!";
135151

152+
# now shorten filename for use below
153+
$infile =~ s!.*src/include/!!;
154+
136155
my $raw_file_content = do { local $/; <$ifh> };
137156

138157
# strip C comments, preserving newlines so we can count lines correctly
@@ -295,12 +314,8 @@ sub elem
295314
$node_type_info{$in_struct}->{field_types} = \%ft;
296315
$node_type_info{$in_struct}->{field_attrs} = \%fa;
297316

298-
# Nodes from these files don't need support functions,
299-
# just node tags.
300-
if (elem basename($infile),
301-
qw(execnodes.h trigger.h event_trigger.h amapi.h tableam.h
302-
tsmapi.h fdwapi.h tuptable.h replnodes.h supportnodes.h)
303-
)
317+
# Exclude nodes in nodetag_only_files from support.
318+
if (elem $infile, @nodetag_only_files)
304319
{
305320
push @no_copy, $in_struct;
306321
push @no_equal, $in_struct;

src/tools/msvc/Solution.pm

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -843,29 +843,28 @@ EOF
843843
'src/backend/nodes/node-support-stamp',
844844
'src/backend/nodes/gen_node_support.pl'))
845845
{
846-
# XXX duplicates src/backend/nodes/Makefile
847-
846+
# XXX duplicates node_headers list in src/backend/nodes/Makefile
848847
my @node_headers = qw(
849848
nodes/nodes.h
850-
nodes/execnodes.h
851-
nodes/plannodes.h
852849
nodes/primnodes.h
853-
nodes/pathnodes.h
854-
nodes/extensible.h
855850
nodes/parsenodes.h
856-
nodes/replnodes.h
857-
nodes/value.h
858-
commands/trigger.h
859-
commands/event_trigger.h
860-
foreign/fdwapi.h
851+
nodes/pathnodes.h
852+
nodes/plannodes.h
853+
nodes/execnodes.h
861854
access/amapi.h
855+
access/sdir.h
862856
access/tableam.h
863857
access/tsmapi.h
864-
utils/rel.h
865-
nodes/supportnodes.h
858+
commands/event_trigger.h
859+
commands/trigger.h
866860
executor/tuptable.h
861+
foreign/fdwapi.h
862+
nodes/extensible.h
867863
nodes/lockoptions.h
868-
access/sdir.h
864+
nodes/replnodes.h
865+
nodes/supportnodes.h
866+
nodes/value.h
867+
utils/rel.h
869868
);
870869

871870
chdir('src/backend/nodes');

0 commit comments

Comments
 (0)