On 2013-12-19 14:56:38 -0800, Kevin Grittner wrote:
> Bruce Momjian <br...@momjian.us> wrote:
> 
> > I have fixed the binary_upgrade_* variables defines, and Heikki has
> > fixed some other cases.  Can you rerun the test against git head and
> > post the updated output?  Thanks.
> 
> I'm now seeing the attached.

Heh, too fast for me. I was just working on a patch to fix some of these
;)

The attached patch fixes some of the easiest cases, where either an
include was missing o a variable should have been static.

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
>From a7c6d7b2f5d6d61a302adadb841926cd27582843 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Fri, 20 Dec 2013 00:06:17 +0100
Subject: [PATCH] Mark some more variables as static or include the appropriate
 header.

Detected by clang's -Wmissing-variable-declarations.
---
 src/backend/commands/event_trigger.c | 2 +-
 src/backend/postmaster/bgworker.c    | 2 +-
 src/backend/postmaster/postmaster.c  | 3 +--
 src/backend/storage/lmgr/s_lock.c    | 1 +
 src/backend/utils/init/globals.c     | 1 +
 src/bin/initdb/initdb.c              | 2 +-
 src/include/storage/pg_shmem.h       | 2 +-
 src/interfaces/ecpg/preproc/pgc.l    | 2 +-
 8 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index 328e2a8..1164199 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -51,7 +51,7 @@ typedef struct EventTriggerQueryState
 	struct EventTriggerQueryState *previous;
 } EventTriggerQueryState;
 
-EventTriggerQueryState *currentEventTriggerState = NULL;
+static EventTriggerQueryState *currentEventTriggerState = NULL;
 
 typedef struct
 {
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index bca2380..7f02294 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -90,7 +90,7 @@ struct BackgroundWorkerHandle
 	uint64	generation;
 };
 
-BackgroundWorkerArray *BackgroundWorkerData;
+static BackgroundWorkerArray *BackgroundWorkerData;
 
 /*
  * Calculate shared memory needed.
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 048a189..5580489 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -238,8 +238,6 @@ bool		enable_bonjour = false;
 char	   *bonjour_name;
 bool		restart_after_crash = true;
 
-char	   *output_config_variable = NULL;
-
 /* PIDs of special child processes; 0 when not running */
 static pid_t StartupPID = 0,
 			BgWriterPID = 0,
@@ -545,6 +543,7 @@ PostmasterMain(int argc, char *argv[])
 	char	   *userDoption = NULL;
 	bool		listen_addr_saved = false;
 	int			i;
+	char	   *output_config_variable = NULL;
 
 	MyProcPid = PostmasterPid = getpid();
 
diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c
index 138b337..0dad679 100644
--- a/src/backend/storage/lmgr/s_lock.c
+++ b/src/backend/storage/lmgr/s_lock.c
@@ -19,6 +19,7 @@
 #include <unistd.h>
 
 #include "storage/s_lock.h"
+#include "storage/barrier.h"
 
 slock_t		dummy_spinlock;
 
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index dd1309b..db832fa 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -18,6 +18,7 @@
  */
 #include "postgres.h"
 
+#include "libpq/libpq-be.h"
 #include "libpq/pqcomm.h"
 #include "miscadmin.h"
 #include "storage/backendid.h"
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 964d284..83fdc88 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -182,7 +182,7 @@ static const char *backend_options = "--single -F -O -c search_path=pg_catalog -
 #ifdef WIN32
 char	   *restrict_env;
 #endif
-const char *subdirs[] = {
+static const char *subdirs[] = {
 	"global",
 	"pg_xlog",
 	"pg_xlog/archive_status",
diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h
index 251fbdf..8959299 100644
--- a/src/include/storage/pg_shmem.h
+++ b/src/include/storage/pg_shmem.h
@@ -39,7 +39,6 @@ typedef struct PGShmemHeader	/* standard header for all Postgres shmem */
 } PGShmemHeader;
 
 
-#ifdef EXEC_BACKEND
 #ifndef WIN32
 extern unsigned long UsedShmemSegID;
 #else
@@ -47,6 +46,7 @@ extern HANDLE UsedShmemSegID;
 #endif
 extern void *UsedShmemSegAddr;
 
+#ifdef EXEC_BACKEND
 extern void PGSharedMemoryReAttach(void);
 #endif
 
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index f04e34a..69a0027 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -56,7 +56,7 @@ static bool isdefine(void);
 static bool isinformixdefine(void);
 
 char *token_start;
-int state_before;
+static int state_before;
 
 struct _yy_buffer
 {
-- 
1.8.3.251.g1462b67

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to