Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7bc9a8b

Browse files
committed
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 1319997, 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
1 parent 48c142f commit 7bc9a8b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,9 @@ PostmasterMain(int argc, char *argv[])
854854
/* For debugging: display postmaster environment */
855855
if (message_level_is_interesting(DEBUG3))
856856
{
857+
#if !defined(WIN32) || defined(_MSC_VER)
857858
extern char **environ;
859+
#endif
858860
char **p;
859861
StringInfoData si;
860862

src/backend/utils/misc/ps_status.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include "utils/guc.h"
2424
#include "utils/ps_status.h"
2525

26+
#if !defined(WIN32) || defined(_MSC_VER)
2627
extern char **environ;
28+
#endif
2729

2830
/* GUC variable */
2931
bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;

src/test/regress/regress.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,9 @@ PG_FUNCTION_INFO_V1(get_environ);
647647
Datum
648648
get_environ(PG_FUNCTION_ARGS)
649649
{
650+
#if !defined(WIN32) || defined(_MSC_VER)
650651
extern char **environ;
652+
#endif
651653
int nvals = 0;
652654
ArrayType *result;
653655
Datum *env;

0 commit comments

Comments
 (0)