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
This commit is contained in:
Peter Eisentraut 2024-07-25 09:26:08 +02:00
parent 32d3ed8165
commit ab61c40bfa
8 changed files with 33 additions and 0 deletions
contrib
src
backend
interfaces/ecpg/preproc
pl/plpgsql/src
test/isolation

@ -11,6 +11,10 @@
#include "utils/float.h"
#include "varatt.h"
/* silence -Wmissing-variable-declarations */
extern int cube_yychar;
extern int cube_yynerrs;
/* All grammar constructs return strings */
#define YYSTYPE char *

@ -13,6 +13,10 @@
#include "segdata.h"
/* silence -Wmissing-variable-declarations */
extern int seg_yychar;
extern int seg_yynerrs;
/*
* 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

@ -33,6 +33,11 @@
#include "utils/memutils.h"
/* silence -Wmissing-variable-declarations */
extern int boot_yychar;
extern int boot_yynerrs;
/*
* 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

@ -23,6 +23,11 @@
#include "replication/walsender_private.h"
/* silence -Wmissing-variable-declarations */
extern int replication_yychar;
extern int replication_yynerrs;
/* Result of the parsing is returned here */
Node *replication_parse_result;

@ -24,6 +24,10 @@ char *syncrep_parse_error_msg;
static SyncRepConfigData *create_syncrep_config(const char *num_sync,
List *members, uint8 syncrep_method);
/* silence -Wmissing-variable-declarations */
extern int syncrep_yychar;
extern int syncrep_yynerrs;
/*
* 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

@ -8,6 +8,10 @@
#include "ecpg_config.h"
#include <unistd.h>
/* silence -Wmissing-variable-declarations */
extern int base_yychar;
extern int base_yynerrs;
/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \

@ -27,6 +27,10 @@
#include "plpgsql.h"
/* silence -Wmissing-variable-declarations */
extern int plpgsql_yychar;
extern int plpgsql_yynerrs;
/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \

@ -14,6 +14,9 @@
#include "isolationtester.h"
/* silence -Wmissing-variable-declarations */
extern int spec_yychar;
extern int spec_yynerrs;
TestSpec parseresult; /* result of parsing is left here */