From 559ea0edba736524b517e1d729c4e64f983e00a7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 8 May 2024 13:49:37 +0200 Subject: [PATCH v1 5/7] Fix -Wmissing-variable-declarations warnings in bison code Add extern declarations for global variables produced by bison. TODO: Consider converting all these to pure parsers. (See also 91e71929ba3.) --- contrib/cube/cubeparse.y | 3 +++ contrib/seg/segparse.y | 3 +++ src/backend/bootstrap/bootparse.y | 4 ++++ src/backend/replication/repl_gram.y | 4 ++++ src/backend/replication/syncrep_gram.y | 3 +++ src/interfaces/ecpg/preproc/ecpg.header | 3 +++ src/pl/plpgsql/src/pl_gram.y | 3 +++ src/test/isolation/specparse.y | 2 ++ 8 files changed, 25 insertions(+) diff --git a/contrib/cube/cubeparse.y b/contrib/cube/cubeparse.y index b39fbe63e6b..2338687f2c5 100644 --- a/contrib/cube/cubeparse.y +++ b/contrib/cube/cubeparse.y @@ -11,6 +11,9 @@ #include "utils/float.h" #include "varatt.h" +extern int cube_yychar; +extern int cube_yynerrs; + /* All grammar constructs return strings */ #define YYSTYPE char * diff --git a/contrib/seg/segparse.y b/contrib/seg/segparse.y index bf759dbbd84..1c74449733a 100644 --- a/contrib/seg/segparse.y +++ b/contrib/seg/segparse.y @@ -13,6 +13,9 @@ #include "segdata.h" +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 diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 3c9c1da0216..51b00755f98 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -33,6 +33,10 @@ #include "utils/memutils.h" +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 diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y index 53780bbf297..29e4a92feda 100644 --- a/src/backend/replication/repl_gram.y +++ b/src/backend/replication/repl_gram.y @@ -23,6 +23,10 @@ #include "replication/walsender_private.h" +extern int replication_yychar; +extern int replication_yynerrs; + + /* Result of the parsing is returned here */ Node *replication_parse_result; diff --git a/src/backend/replication/syncrep_gram.y b/src/backend/replication/syncrep_gram.y index a14f63b6582..11f0f46df74 100644 --- a/src/backend/replication/syncrep_gram.y +++ b/src/backend/replication/syncrep_gram.y @@ -24,6 +24,9 @@ char *syncrep_parse_error_msg; static SyncRepConfigData *create_syncrep_config(const char *num_sync, List *members, uint8 syncrep_method); +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 diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 59502894256..42a683152f8 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -8,6 +8,9 @@ #include "ecpg_config.h" #include +extern int base_yychar; +extern int base_yynerrs; + /* Location tracking support --- simpler than bison's default */ #define YYLLOC_DEFAULT(Current, Rhs, N) \ do { \ diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y index a29d2dfacdd..2c45ccb8a2d 100644 --- a/src/pl/plpgsql/src/pl_gram.y +++ b/src/pl/plpgsql/src/pl_gram.y @@ -27,6 +27,9 @@ #include "plpgsql.h" +extern int plpgsql_yychar; +extern int plpgsql_yynerrs; + /* Location tracking support --- simpler than bison's default */ #define YYLLOC_DEFAULT(Current, Rhs, N) \ do { \ diff --git a/src/test/isolation/specparse.y b/src/test/isolation/specparse.y index 0e8b166a53e..a7cac5b9ea7 100644 --- a/src/test/isolation/specparse.y +++ b/src/test/isolation/specparse.y @@ -14,6 +14,8 @@ #include "isolationtester.h" +extern int spec_yychar; +extern int spec_yynerrs; TestSpec parseresult; /* result of parsing is left here */ -- 2.44.0