summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro2024-12-14 11:36:30 +0000
committerThomas Munro2024-12-14 11:41:27 +0000
commit7bc9a8bdd2d6f6da664572456f226c54e9c9e3dd (patch)
tree20a61c99e5d5095e2de73e76270c4ce2b113a2b2
parent48c142f78d90fcdcbc0557a4bcdc4f47ec32b333 (diff)
Fix warnings about declaration of environ on MinGW.
POSIX says that the global variable environ shouldn't be declared in a header, and that you have to declare it yourself. MinGW declares it in <stdlib.h> with some macrology that messes up our declarations. Visual Studio doesn't warn (there are clues that it may also declare it, but if so, apparently compatibly). Suppress our declarations, on MinGW only. This clears the last warnings on CI's optional MinGW task, and hopefully on build farm animal fairywren too. Like 1319997d, no back-patch for now as it's not known to be breaking anything, and my humble goal is just to keep the MinGW build clean going forward. Reviewed-by: Tom Lane <[email protected]> (earlier version) Discussion: https://postgr.es/m/CA%2BhUKGJLMh%2B6W5E4M_jSFb43gnrA_-Q6-%2BBf3HkBXyGfRFcBsQ%40mail.gmail.com
-rw-r--r--src/backend/postmaster/postmaster.c2
-rw-r--r--src/backend/utils/misc/ps_status.c2
-rw-r--r--src/test/regress/regress.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index f0f9c66487c..6f37822c887 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -854,7 +854,9 @@ PostmasterMain(int argc, char *argv[])
/* For debugging: display postmaster environment */
if (message_level_is_interesting(DEBUG3))
{
+#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ;
+#endif
char **p;
StringInfoData si;
diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 9da63774020..27798dc51e1 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -23,7 +23,9 @@
#include "utils/guc.h"
#include "utils/ps_status.h"
+#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ;
+#endif
/* GUC variable */
bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index 8309166f5b2..64460327f40 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -647,7 +647,9 @@ PG_FUNCTION_INFO_V1(get_environ);
Datum
get_environ(PG_FUNCTION_ARGS)
{
+#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ;
+#endif
int nvals = 0;
ArrayType *result;
Datum *env;