Looking to tidy up c.h a bit, I think the NON_EXEC_STATIC #define
doesn't need to be known globally, and it's not related to establishing
a portable C environment, so I propose to move it to a more localized
header, such as postmaster.h, as in the attached patch.From 29f2f1a8f8111b3d232c776a145f57759131396a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Tue, 16 Aug 2022 10:56:41 +0200
Subject: [PATCH] Move NON_EXEC_STATIC from c.h to postmaster.h
It is not needed at the scope of c.h, so move it to a more localized
place.
---
src/backend/storage/lmgr/proc.c | 1 +
src/include/c.h | 7 -------
src/include/postmaster/postmaster.h | 6 ++++++
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 37aaab1338..448e7a2efa 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -41,6 +41,7 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
+#include "postmaster/postmaster.h"
#include "replication/slot.h"
#include "replication/syncrep.h"
#include "replication/walsender.h"
diff --git a/src/include/c.h b/src/include/c.h
index 65e91a6b89..17d1cc28e3 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1348,13 +1348,6 @@ typedef intptr_t sigjmp_buf[5];
#endif /* __MINGW64__ */
#endif /* WIN32 */
-/* EXEC_BACKEND defines */
-#ifdef EXEC_BACKEND
-#define NON_EXEC_STATIC
-#else
-#define NON_EXEC_STATIC static
-#endif
-
/* /port compatibility functions */
#include "port.h"
diff --git a/src/include/postmaster/postmaster.h
b/src/include/postmaster/postmaster.h
index 90e333ccd2..03c624fb1b 100644
--- a/src/include/postmaster/postmaster.h
+++ b/src/include/postmaster/postmaster.h
@@ -55,6 +55,12 @@ extern int MaxLivePostmasterChildren(void);
extern bool PostmasterMarkPIDForWorkerNotify(int);
+#ifdef EXEC_BACKEND
+#define NON_EXEC_STATIC
+#else
+#define NON_EXEC_STATIC static
+#endif
+
#ifdef EXEC_BACKEND
extern pid_t postmaster_forkexec(int argc, char *argv[]);
extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
--
2.37.1