Rationalize order of input files for gen_node_support.pl.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 11 Jul 2022 17:38:40 +0000 (13:38 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 11 Jul 2022 17:38:47 +0000 (13:38 -0400)
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

src/backend/nodes/Makefile
src/backend/nodes/gen_node_support.pl
src/tools/msvc/Solution.pm

index 79ce0a532fee7df15d698f9f2d313d93eb038947..7450e191ee205fefc909c109eece16589606edb2 100644 (file)
@@ -33,27 +33,31 @@ OBJS = \
 
 include $(top_srcdir)/src/backend/common.mk
 
+# The principal node-defining headers are listed in their inclusion order,
+# to ensure cross-file subtyping works correctly.  The rest can just be
+# listed alphabetically.
+# Caution: re-ordering this list risks ABI breakage!
 node_headers = \
    nodes/nodes.h \
-   nodes/execnodes.h \
-   nodes/plannodes.h \
    nodes/primnodes.h \
-   nodes/pathnodes.h \
-   nodes/extensible.h \
    nodes/parsenodes.h \
-   nodes/replnodes.h \
-   nodes/value.h \
-   commands/trigger.h \
-   commands/event_trigger.h \
-   foreign/fdwapi.h \
+   nodes/pathnodes.h \
+   nodes/plannodes.h \
+   nodes/execnodes.h \
    access/amapi.h \
+   access/sdir.h \
    access/tableam.h \
    access/tsmapi.h \
-   utils/rel.h \
-   nodes/supportnodes.h \
+   commands/event_trigger.h \
+   commands/trigger.h \
    executor/tuptable.h \
+   foreign/fdwapi.h \
+   nodes/extensible.h \
    nodes/lockoptions.h \
-   access/sdir.h
+   nodes/replnodes.h \
+   nodes/supportnodes.h \
+   nodes/value.h \
+   utils/rel.h
 
 # see also catalog/Makefile for an explanation of these make rules
 
index 4a7902e6bfb7b5d6f59cad76e11f725d78d06870..2c06609726f6ac0248d4ab2919e8b7c4dcc742f9 100644 (file)
@@ -95,6 +95,22 @@ push @scalar_types, qw(EquivalenceClass* EquivalenceMember*);
 # currently not required.
 push @scalar_types, qw(QualCost);
 
+# Nodes from these input files don't need support functions, just node tags.
+my @nodetag_only_files = qw(
+  nodes/execnodes.h
+  access/amapi.h
+  access/sdir.h
+  access/tableam.h
+  access/tsmapi.h
+  commands/event_trigger.h
+  commands/trigger.h
+  executor/tuptable.h
+  foreign/fdwapi.h
+  nodes/lockoptions.h
+  nodes/replnodes.h
+  nodes/supportnodes.h
+);
+
 # XXX various things we are not publishing right now to stay level
 # with the manual system
 push @no_copy,  qw(CallContext InlineCodeBlock);
@@ -133,6 +149,9 @@ foreach my $infile (@ARGV)
 
    open my $ifh, '<', $infile or die "could not open \"$infile\": $!";
 
+   # now shorten filename for use below
+   $infile =~ s!.*src/include/!!;
+
    my $raw_file_content = do { local $/; <$ifh> };
 
    # strip C comments, preserving newlines so we can count lines correctly
@@ -295,12 +314,8 @@ foreach my $infile (@ARGV)
                    $node_type_info{$in_struct}->{field_types} = \%ft;
                    $node_type_info{$in_struct}->{field_attrs} = \%fa;
 
-                   # Nodes from these files don't need support functions,
-                   # just node tags.
-                   if (elem basename($infile),
-                       qw(execnodes.h trigger.h event_trigger.h amapi.h tableam.h
-                       tsmapi.h fdwapi.h tuptable.h replnodes.h supportnodes.h)
-                     )
+                   # Exclude nodes in nodetag_only_files from support.
+                   if (elem $infile, @nodetag_only_files)
                    {
                        push @no_copy,       $in_struct;
                        push @no_equal,      $in_struct;
index b8b1728df7ff329d3e9873797b7c58e0fbbdde1b..a9dd604534485326144d09844fd67dd3d9e5e64e 100644 (file)
@@ -843,29 +843,28 @@ EOF
            'src/backend/nodes/node-support-stamp',
            'src/backend/nodes/gen_node_support.pl'))
    {
-       # XXX duplicates src/backend/nodes/Makefile
-
+       # XXX duplicates node_headers list in src/backend/nodes/Makefile
        my @node_headers = qw(
          nodes/nodes.h
-         nodes/execnodes.h
-         nodes/plannodes.h
          nodes/primnodes.h
-         nodes/pathnodes.h
-         nodes/extensible.h
          nodes/parsenodes.h
-         nodes/replnodes.h
-         nodes/value.h
-         commands/trigger.h
-         commands/event_trigger.h
-         foreign/fdwapi.h
+         nodes/pathnodes.h
+         nodes/plannodes.h
+         nodes/execnodes.h
          access/amapi.h
+         access/sdir.h
          access/tableam.h
          access/tsmapi.h
-         utils/rel.h
-         nodes/supportnodes.h
+         commands/event_trigger.h
+         commands/trigger.h
          executor/tuptable.h
+         foreign/fdwapi.h
+         nodes/extensible.h
          nodes/lockoptions.h
-         access/sdir.h
+         nodes/replnodes.h
+         nodes/supportnodes.h
+         nodes/value.h
+         utils/rel.h
        );
 
        chdir('src/backend/nodes');