Improve formatting of create_help.pl and plperl_opmask.pl output.

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
This commit is contained in:
Tom Lane 2020-09-16 20:31:19 -04:00
parent 07082b08cc
commit add105840b
4 changed files with 23 additions and 13 deletions

View 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;

View 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: $!";

View 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"

View File

@ -6,5 +6,6 @@
/snowball/libstemmer/
/pl/plperl/ppport\.h$
/jit/llvmjit\.h$
/utils/probes\.h$
/tmp_check/
/tmp_install/