Backpatch: Fix warnings about declaration of environ on MinGW
authorAndres Freund <[email protected]>
Tue, 4 Nov 2025 18:24:58 +0000 (13:24 -0500)
committerAndres Freund <[email protected]>
Tue, 4 Nov 2025 18:24:58 +0000 (13:24 -0500)
Backpatch commit 7bc9a8bdd2d to 13-17. The motivation for backpatching is that
we want to update CI to Debian Trixie. Trixie contains a newer mingw
installation, which would trigger the warning addressed by 7bc9a8bdd2d. The
risk of backpatching seems fairly low, given that it did not cause issues in
the branches the commit is already present.

While CI is not present in 13-14, it seems better to be consistent across
branches.

Author: Thomas Munro <[email protected]>
Discussion: https://postgr.es/m/o5yadhhmyjo53svzwvaocww6zkrp63i4f32cw3treuh46pxtza@hyqio5b2tkt6
Backpatch-through: 13

src/backend/postmaster/postmaster.c
src/backend/utils/misc/ps_status.c
src/test/regress/regress.c

index 152a8a173910a4cbb96b29f533349c5570a6899c..5d328b9807c2f8c0af5b4dbdd9193637d786612f 100644 (file)
@@ -954,7 +954,9 @@ PostmasterMain(int argc, char *argv[])
 
    /* For debugging: display postmaster environment */
    {
+#if !defined(WIN32) || defined(_MSC_VER)
        extern char **environ;
+#endif
        char      **p;
 
        ereport(DEBUG3,
index b364902c8db44c860668502e31a0faa31f41da1f..9827228a474c2aa52ec759efa3f9b57ed9089a6b 100644 (file)
@@ -25,7 +25,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;
index 0fc787c1aaff0ef6d3b03883cb7f9a545859241c..c168081eb4a3bedef02b62b2038d3c0017ecf1f2 100644 (file)
@@ -650,7 +650,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;