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

Commit ab61c40

Browse files
committed
Add extern declarations for Bison global variables
This adds extern declarations for some global variables produced by Bison that are not already declared in its generated header file. This is a workaround to be able to add -Wmissing-variable-declarations to the global set of warning options in the near future. Another longer-term solution would be to convert these grammars to "pure" parsers in Bison, to avoid global variables altogether. Note that the core grammar is already pure, so this patch did not need to touch it. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
1 parent 32d3ed8 commit ab61c40

File tree

8 files changed

+33
-0
lines changed

8 files changed

+33
-0
lines changed

contrib/cube/cubeparse.y

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "utils/float.h"
1212
#include "varatt.h"
1313

14+
/* silence -Wmissing-variable-declarations */
15+
extern int cube_yychar;
16+
extern int cube_yynerrs;
17+
1418
/* All grammar constructs return strings */
1519
#define YYSTYPE char *
1620

contrib/seg/segparse.y

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
#include "segdata.h"
1515

16+
/* silence -Wmissing-variable-declarations */
17+
extern int seg_yychar;
18+
extern int seg_yynerrs;
19+
1620
/*
1721
* Bison doesn't allocate anything that needs to live across parser calls,
1822
* so we can easily have it use palloc instead of malloc. This prevents

src/backend/bootstrap/bootparse.y

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include "utils/memutils.h"
3434

3535

36+
/* silence -Wmissing-variable-declarations */
37+
extern int boot_yychar;
38+
extern int boot_yynerrs;
39+
40+
3641
/*
3742
* Bison doesn't allocate anything that needs to live across parser calls,
3843
* so we can easily have it use palloc instead of malloc. This prevents

src/backend/replication/repl_gram.y

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
#include "replication/walsender_private.h"
2424

2525

26+
/* silence -Wmissing-variable-declarations */
27+
extern int replication_yychar;
28+
extern int replication_yynerrs;
29+
30+
2631
/* Result of the parsing is returned here */
2732
Node *replication_parse_result;
2833

src/backend/replication/syncrep_gram.y

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ char *syncrep_parse_error_msg;
2424
static SyncRepConfigData *create_syncrep_config(const char *num_sync,
2525
List *members, uint8 syncrep_method);
2626

27+
/* silence -Wmissing-variable-declarations */
28+
extern int syncrep_yychar;
29+
extern int syncrep_yynerrs;
30+
2731
/*
2832
* Bison doesn't allocate anything that needs to live across parser calls,
2933
* so we can easily have it use palloc instead of malloc. This prevents

src/interfaces/ecpg/preproc/ecpg.header

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include "ecpg_config.h"
99
#include <unistd.h>
1010

11+
/* silence -Wmissing-variable-declarations */
12+
extern int base_yychar;
13+
extern int base_yynerrs;
14+
1115
/* Location tracking support --- simpler than bison's default */
1216
#define YYLLOC_DEFAULT(Current, Rhs, N) \
1317
do { \

src/pl/plpgsql/src/pl_gram.y

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#include "plpgsql.h"
2828

2929

30+
/* silence -Wmissing-variable-declarations */
31+
extern int plpgsql_yychar;
32+
extern int plpgsql_yynerrs;
33+
3034
/* Location tracking support --- simpler than bison's default */
3135
#define YYLLOC_DEFAULT(Current, Rhs, N) \
3236
do { \

src/test/isolation/specparse.y

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#include "isolationtester.h"
1616

17+
/* silence -Wmissing-variable-declarations */
18+
extern int spec_yychar;
19+
extern int spec_yynerrs;
1720

1821
TestSpec parseresult; /* result of parsing is left here */
1922

0 commit comments

Comments
 (0)