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

Commit 9fb855f

Browse files
committed
Include bison header files into implementation files
Before Bison 3.4, the generated parser implementation files run afoul of -Wmissing-variable-declarations (in spite of commit ab61c40) because declarations for yylval and possibly yylloc are missing. The generated header files contain an extern declaration, but the implementation files don't include the header files. Since Bison 3.4, the generated implementation files automatically include the generated header files, so then it works. To make this work with older Bison versions as well, include the generated header file from the .y file. (With older Bison versions, the generated implementation file contains effectively a copy of the header file pasted in, so including the header file is redundant. But we know this works anyway because the core grammar uses this arrangement already.) Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
1 parent 63bef4d commit 9fb855f

File tree

8 files changed

+13
-3
lines changed

8 files changed

+13
-3
lines changed

contrib/cube/cubeparse.y

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
#include "utils/float.h"
1212
#include "varatt.h"
1313

14+
/* All grammar constructs return strings */
15+
#define YYSTYPE char *
16+
17+
#include "cubeparse.h"
18+
1419
/* silence -Wmissing-variable-declarations */
1520
extern int cube_yychar;
1621
extern int cube_yynerrs;
1722

18-
/* All grammar constructs return strings */
19-
#define YYSTYPE char *
20-
2123
/*
2224
* Bison doesn't allocate anything that needs to live across parser calls,
2325
* so we can easily have it use palloc instead of malloc. This prevents

contrib/seg/segparse.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "utils/float.h"
1313

1414
#include "segdata.h"
15+
#include "segparse.h"
1516

1617
/* silence -Wmissing-variable-declarations */
1718
extern int seg_yychar;

src/backend/bootstrap/bootparse.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "nodes/makefuncs.h"
3333
#include "utils/memutils.h"
3434

35+
#include "bootparse.h"
3536

3637
/* silence -Wmissing-variable-declarations */
3738
extern int boot_yychar;

src/backend/replication/repl_gram.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "replication/walsender.h"
2323
#include "replication/walsender_private.h"
2424

25+
#include "repl_gram.h"
2526

2627
/* silence -Wmissing-variable-declarations */
2728
extern int replication_yychar;

src/backend/replication/syncrep_gram.y

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "nodes/pg_list.h"
1818
#include "replication/syncrep.h"
1919

20+
#include "syncrep_gram.h"
21+
2022
/* Result of parsing is returned in one of these two variables */
2123
SyncRepConfigData *syncrep_parse_result;
2224
char *syncrep_parse_error_msg;

src/interfaces/ecpg/preproc/ecpg.header

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "postgres_fe.h"
66

77
#include "preproc_extern.h"
8+
#include "preproc.h"
89
#include "ecpg_config.h"
910
#include <unistd.h>
1011

src/pl/plpgsql/src/pl_gram.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "plpgsql.h"
2828

29+
#include "pl_gram.h"
2930

3031
/* silence -Wmissing-variable-declarations */
3132
extern int plpgsql_yychar;

src/test/isolation/specparse.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "postgres_fe.h"
1414

1515
#include "isolationtester.h"
16+
#include "specparse.h"
1617

1718
/* silence -Wmissing-variable-declarations */
1819
extern int spec_yychar;

0 commit comments

Comments
 (0)