diff options
author | Peter Eisentraut | 2024-08-02 07:59:35 +0000 |
---|---|---|
committer | Peter Eisentraut | 2024-08-02 08:25:11 +0000 |
commit | 9fb855fe1ae04a147bd4cdaa571a1c9de5f03682 (patch) | |
tree | a8c5711e613dc4fd8fdfbda489c7530cc8402070 /contrib | |
parent | 63bef4df975cd8b0a3fee1384a80c569043a6d72 (diff) |
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 ab61c40bfa2)
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
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cube/cubeparse.y | 8 | ||||
-rw-r--r-- | contrib/seg/segparse.y | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/contrib/cube/cubeparse.y b/contrib/cube/cubeparse.y index fd56d0e1628..52622875cbb 100644 --- a/contrib/cube/cubeparse.y +++ b/contrib/cube/cubeparse.y @@ -11,13 +11,15 @@ #include "utils/float.h" #include "varatt.h" +/* All grammar constructs return strings */ +#define YYSTYPE char * + +#include "cubeparse.h" + /* silence -Wmissing-variable-declarations */ extern int cube_yychar; extern int cube_yynerrs; -/* All grammar constructs return strings */ -#define YYSTYPE char * - /* * Bison doesn't allocate anything that needs to live across parser calls, * so we can easily have it use palloc instead of malloc. This prevents diff --git a/contrib/seg/segparse.y b/contrib/seg/segparse.y index 9635c3af6e6..3e4aa31cada 100644 --- a/contrib/seg/segparse.y +++ b/contrib/seg/segparse.y @@ -12,6 +12,7 @@ #include "utils/float.h" #include "segdata.h" +#include "segparse.h" /* silence -Wmissing-variable-declarations */ extern int seg_yychar; |