Skip to content

Commit 8722e79

Browse files
committed
Silence -Wmissing-variable-declarations in headerscheck.
Newer gcc versions will emit warnings about missing extern declarations if certain header files are compiled by themselves. Add the "extern" declarations needed to quiet that. Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/1127775.1754417387@sss.pgh.pa.us
1 parent da9f9f7 commit 8722e79

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/interfaces/ecpg/test/expected/preproc-strings.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
#line 3 "strings.pgc"
1919
/* exec sql begin declare section */
2020
#line 1 "strings.h"
21+
/* redundant declaration to silence -Wmissing-variable-declarations */
22+
23+
24+
25+
26+
27+
28+
29+
30+
2131

2232

2333

@@ -29,7 +39,10 @@
2939

3040
#line 5 "strings.pgc"
3141

32-
#line 1 "strings.h"
42+
#line 2 "strings.h"
43+
extern char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
44+
45+
#line 11 "strings.h"
3346
char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
3447
/* exec sql end declare section */
3548
#line 5 "strings.pgc"

src/interfaces/ecpg/test/preproc/strings.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/* redundant declaration to silence -Wmissing-variable-declarations */
2+
extern char *s1,
3+
*s2,
4+
*s3,
5+
*s4,
6+
*s5,
7+
*s6,
8+
*s7,
9+
*s8;
10+
111
char *s1,
212
*s2,
313
*s3,

src/tools/gen_keywordlist.pl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,16 @@
169169

170170
# Emit the struct that wraps all this lookup info into one variable.
171171

172-
printf $kwdef "static " if !$extern;
172+
if ($extern)
173+
{
174+
# redundant declaration to silence -Wmissing-variable-declarations
175+
printf $kwdef "extern PGDLLIMPORT const ScanKeywordList %s;\n\n",
176+
$varname;
177+
}
178+
else
179+
{
180+
printf $kwdef "static ";
181+
}
173182
printf $kwdef "const ScanKeywordList %s = {\n", $varname;
174183
printf $kwdef qq|\t%s_kw_string,\n|, $varname;
175184
printf $kwdef qq|\t%s_kw_offsets,\n|, $varname;

0 commit comments

Comments
 (0)