Label the contents of pg_*_d.h files a little better.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Mar 2025 19:09:46 +0000 (15:09 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Mar 2025 19:09:46 +0000 (15:09 -0400)
Make genbki.pl emit some boilerplate comments identifying the
sections of the pg_*_d.h files that it generates.  This is in
hopes of making them slightly more readable, in case people
look at those files and not the pg_*.h/pg_*.dat originals.

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

src/backend/catalog/genbki.pl

index 2501307c92e4c1d20334c11929029bda8ebe88ab..df3231fcd41c2e5a8cc2211a4c68267716264d16 100644 (file)
@@ -480,6 +480,8 @@ foreach my $catname (@catnames)
 
 EOM
 
+   printf $def "/* Macros related to the structure of $catname */\n\n";
+
    # Emit OID macros for catalog's OID and rowtype OID, if wanted
    printf $def "#define %s %s\n",
      $catalog->{relation_oid_macro}, $catalog->{relation_oid}
@@ -561,6 +563,7 @@ EOM
    print $def "\n#define Natts_$catname $attnum\n\n";
 
    # Emit client code copied from source header
+   printf $def "/* Definitions copied from ${catname}.h */\n\n";
    foreach my $line (@{ $catalog->{client_code} })
    {
        print $def $line;
@@ -573,6 +576,9 @@ EOM
        print $bki "open $catname\n";
    }
 
+   printf $def
+     "\n/* OID symbols for objects defined in ${catname}.dat */\n\n";
+
    # For pg_attribute.h, we generate data entries ourselves.
    if ($catname eq 'pg_attribute')
    {