Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit add1058

Browse files
committed
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
1 parent 07082b0 commit add1058

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

src/bin/psql/create_help.pl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@
6363
6464
struct _helpStruct
6565
{
66-
const char *cmd; /* the command name */
67-
const char *help; /* the help associated with it */
68-
const char *docbook_id; /* DocBook XML id (for generating URL) */
69-
void (*syntaxfunc)(PQExpBuffer); /* function that prints the syntax associated with it */
70-
int nl_count; /* number of newlines in syntax (for pager) */
66+
const char *cmd; /* the command name */
67+
const char *help; /* the help associated with it */
68+
const char *docbook_id; /* DocBook XML id (for generating URL) */
69+
void (*syntaxfunc) (PQExpBuffer); /* function that prints the
70+
* syntax associated with it */
71+
int nl_count; /* number of newlines in syntax (for pager) */
7172
};
7273
7374
extern const struct _helpStruct QL_HELP[];
@@ -190,17 +191,17 @@
190191
{
191192
my $id = $_;
192193
$id =~ s/ /_/g;
193-
print $cfile_handle " { \"$_\",
194-
N_(\"$entries{$_}{cmddesc}\"),
195-
\"$entries{$_}{cmdid}\",
196-
sql_help_$id,
197-
$entries{$_}{nl_count} },
194+
print $cfile_handle "\t{\"$_\",
195+
\t\tN_(\"$entries{$_}{cmddesc}\"),
196+
\t\t\"$entries{$_}{cmdid}\",
197+
\t\tsql_help_$id,
198+
\t$entries{$_}{nl_count}},
198199
199200
";
200201
}
201202

202203
print $cfile_handle "
203-
{ NULL, NULL, NULL } /* End of list marker */
204+
\t{NULL, NULL, NULL}\t\t\t/* End of list marker */
204205
};
205206
";
206207

@@ -210,7 +211,7 @@
210211
#define QL_MAX_CMD_LEN $maxlen /* largest strlen(cmd) */
211212
212213
213-
#endif /* $define */
214+
#endif /* $define */
214215
";
215216

216217
close $cfile_handle;

src/pl/plperl/plperl_opmask.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
printf $fh qq{ opmask[OP_%-12s] = 0;\t/* %s */ \\\n},
5353
uc($opname), opdesc($opname);
5454
}
55-
printf $fh " /* end */ \n";
55+
printf $fh " /* end */\n";
5656

5757
close $fh
5858
or die "Error closing $plperl_opmask_tmp: $!";

src/tools/pgindent/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@ are excluded because those files are imported from an external project,
157157
not maintained locally, and are machine-generated anyway. Likewise for
158158
plperl/ppport.h.
159159

160+
src/include/jit/llvmjit.h is excluded because it contains C++ constructs
161+
that confuse pgindent.
162+
163+
src/backend/utils/probes.h and its alias src/include/utils/probes.h
164+
are excluded because that file is machine-generated by code not under
165+
our control, and some versions of dtrace build files that confuse
166+
pgindent.
167+
160168

161169
The perltidy run processes all *.pl and *.pm files, plus a few
162170
executable Perl scripts that are not named that way. See the "find"

src/tools/pgindent/exclude_file_patterns

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
/snowball/libstemmer/
77
/pl/plperl/ppport\.h$
88
/jit/llvmjit\.h$
9+
/utils/probes\.h$
910
/tmp_check/
1011
/tmp_install/

0 commit comments

Comments
 (0)