Improve formatting of create_help.pl and plperl_opmask.pl output.
authorTom Lane <[email protected]>
Thu, 17 Sep 2020 00:31:19 +0000 (20:31 -0400)
committerTom Lane <[email protected]>
Thu, 17 Sep 2020 00:31:37 +0000 (20:31 -0400)
Adjust the whitespace in the emitted files so that it matches
what pgindent would do.  This makes the generated files look
like they match project style, and avoids confusion if someone
does run pgindent on the generated files.

Also, add probes.h to pgindent's exclusion list, because it can
confuse pgindent, plus there's not much point in processing it.

Daniel Gustafsson, additional fixes by me

Discussion: https://postgr.es/m/79ed5348-be7a-b647-dd40-742207186a22@2ndquadrant.com

src/bin/psql/create_help.pl
src/pl/plperl/plperl_opmask.pl
src/tools/pgindent/README
src/tools/pgindent/exclude_file_patterns

index ee82e645832e07ac9a17ad4143e98508bd81942d..60e093bad4902d151e43a57ba6a6eab10fbe9449 100644 (file)
@@ -63,11 +63,12 @@ print $hfile_handle "/*
 
 struct _helpStruct
 {
-   const char     *cmd;        /* the command name */
-   const char     *help;       /* the help associated with it */
-   const char     *docbook_id; /* DocBook XML id (for generating URL) */
-   void (*syntaxfunc)(PQExpBuffer);    /* function that prints the syntax associated with it */
-   int             nl_count;   /* number of newlines in syntax (for pager) */
+   const char *cmd;            /* the command name */
+   const char *help;           /* the help associated with it */
+   const char *docbook_id;     /* DocBook XML id (for generating URL) */
+   void        (*syntaxfunc) (PQExpBuffer);    /* function that prints the
+                                                * syntax associated with it */
+   int         nl_count;       /* number of newlines in syntax (for pager) */
 };
 
 extern const struct _helpStruct QL_HELP[];
@@ -190,17 +191,17 @@ foreach (sort keys %entries)
 {
    my $id = $_;
    $id =~ s/ /_/g;
-   print $cfile_handle "    { \"$_\",
-      N_(\"$entries{$_}{cmddesc}\"),
-      \"$entries{$_}{cmdid}\",
-      sql_help_$id,
-      $entries{$_}{nl_count} },
+   print $cfile_handle "\t{\"$_\",
+\t\tN_(\"$entries{$_}{cmddesc}\"),
+\t\t\"$entries{$_}{cmdid}\",
+\t\tsql_help_$id,
+\t$entries{$_}{nl_count}},
 
 ";
 }
 
 print $cfile_handle "
-    { NULL, NULL, NULL }    /* End of list marker */
+\t{NULL, NULL, NULL}\t\t\t/* End of list marker */
 };
 ";
 
@@ -210,7 +211,7 @@ print $hfile_handle "
 #define QL_MAX_CMD_LEN $maxlen     /* largest strlen(cmd) */
 
 
-#endif /* $define */
+#endif                         /* $define */
 ";
 
 close $cfile_handle;
index 3b33112ff945609b75fccd39d6821995093fa23f..ee18e915289bfd031008adef4a8e190f53ea9311 100644 (file)
@@ -52,7 +52,7 @@ foreach my $opname (opset_to_ops(opset(@allowed_ops)))
    printf $fh qq{  opmask[OP_%-12s] = 0;\t/* %s */ \\\n},
      uc($opname), opdesc($opname);
 }
-printf $fh "  /* end */ \n";
+printf $fh "                               /* end */\n";
 
 close $fh
   or die "Error closing $plperl_opmask_tmp: $!";
index 8eb15fafb996eccf96e3978abecf91568b0c44c5..9b16b0ed504a5da6121a8c09ce30f9324592bbab 100644 (file)
@@ -157,6 +157,14 @@ are excluded because those files are imported from an external project,
 not maintained locally, and are machine-generated anyway.  Likewise for
 plperl/ppport.h.
 
+src/include/jit/llvmjit.h is excluded because it contains C++ constructs
+that confuse pgindent.
+
+src/backend/utils/probes.h and its alias src/include/utils/probes.h
+are excluded because that file is machine-generated by code not under
+our control, and some versions of dtrace build files that confuse
+pgindent.
+
 
 The perltidy run processes all *.pl and *.pm files, plus a few
 executable Perl scripts that are not named that way.  See the "find"
index c8efc9a9131099b114c03969015111641203d8b9..a8f1a92f4b3bd6305860b971e93a89c026f2ca19 100644 (file)
@@ -6,5 +6,6 @@
 /snowball/libstemmer/
 /pl/plperl/ppport\.h$
 /jit/llvmjit\.h$
+/utils/probes\.h$
 /tmp_check/
 /tmp_install/