1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-31 03:21:24 +03:00

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 <tgl@sss.pgh.pa.us> (earlier version)
Discussion: https://postgr.es/m/CA%2BhUKGJLMh%2B6W5E4M_jSFb43gnrA_-Q6-%2BBf3HkBXyGfRFcBsQ%40mail.gmail.com
This commit is contained in:
Thomas Munro 2024-12-15 00:36:30 +13:00
parent 48c142f78d
commit 7bc9a8bdd2
3 changed files with 6 additions and 0 deletions

View File

@ -854,7 +854,9 @@ PostmasterMain(int argc, char *argv[])
/* For debugging: display postmaster environment */ /* For debugging: display postmaster environment */
if (message_level_is_interesting(DEBUG3)) if (message_level_is_interesting(DEBUG3))
{ {
#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ; extern char **environ;
#endif
char **p; char **p;
StringInfoData si; StringInfoData si;

View File

@ -23,7 +23,9 @@
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/ps_status.h" #include "utils/ps_status.h"
#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ; extern char **environ;
#endif
/* GUC variable */ /* GUC variable */
bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE; bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;

View File

@ -647,7 +647,9 @@ PG_FUNCTION_INFO_V1(get_environ);
Datum Datum
get_environ(PG_FUNCTION_ARGS) get_environ(PG_FUNCTION_ARGS)
{ {
#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ; extern char **environ;
#endif
int nvals = 0; int nvals = 0;
ArrayType *result; ArrayType *result;
Datum *env; Datum *env;