Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92d4294

Browse files
committed
psql: Fix some strange code in SQL help creation
Struct QL_HELP used to be defined as static in the sql_help.h headerfile, which is included in sql_help.c and help.c, thus creating twoseparate instances of the struct. This causes a warning from GCC 6,because the struct is not used in sql_help.c.Instead, declare the struct as extern in the header file and define itin sql_help.c. This also allows making a bunch of functions staticbecause they are no longer needed outside of sql_help.c.Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
1 parent0d0644d commit92d4294

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎src/bin/psql/create_help.pl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
#ifndef$define
6060
#define$define
6161
62-
#define N_(x) (x)/* gettext noop */
63-
6462
#include\"postgres_fe.h\"
6563
#include\"pqexpbuffer.h\"
6664
@@ -72,6 +70,7 @@
7270
intnl_count;/* number of newlines in syntax (for pager) */
7371
};
7472
73+
extern const struct _helpStruct QL_HELP[];
7574
";
7675

7776
print CFILE"/*
@@ -83,6 +82,8 @@
8382
*
8483
*/
8584
85+
#define N_(x) (x)/* gettext noop */
86+
8687
#include\"$hfile\"
8788
8889
";
@@ -170,8 +171,7 @@
170171
$synopsis =~s/\\n/\\n"\n$prefix"/g;
171172
my@args =
172173
("buf",$synopsis,map("_(\"$_\")", @{$entries{$_}{params} }));
173-
print HFILE"extern void sql_help_$id(PQExpBuffer buf);\n";
174-
print CFILE"void
174+
print CFILE"static void
175175
sql_help_$id(PQExpBuffer buf)
176176
{
177177
\tappendPQExpBuffer(" .join(",\n$prefix",@args) .");
@@ -180,27 +180,27 @@
180180
";
181181
}
182182

183-
print HFILE"
184-
185-
static const struct _helpStruct QL_HELP[] = {
183+
print CFILE"
184+
const struct _helpStruct QL_HELP[] = {
186185
";
187186
foreach (sortkeys%entries)
188187
{
189188
my$id =$_;
190189
$id =~s//_/g;
191-
printHFILE" {\"$_\",
190+
printCFILE" {\"$_\",
192191
N_(\"$entries{$_}{cmddesc}\"),
193192
sql_help_$id,
194193
$entries{$_}{nl_count} },
195194
196195
";
197196
}
198197

199-
printHFILE"
198+
printCFILE"
200199
{ NULL, NULL, NULL } /* End of list marker */
201200
};
201+
";
202202

203-
203+
print HFILE"
204204
#define QL_HELP_COUNT"
205205
.scalar(keys%entries) ."/* number of help items */
206206
#define QL_MAX_CMD_LEN$maxlen/* largest strlen(cmd) */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp