From 9610b0d1e28aeda02a2ddcf1f0591ae577c3e88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Tue, 7 Oct 2025 19:03:52 -0500 Subject: [PATCH] randomenv: Fix MinGW dllimport warning for `environ` Extends 7703884 to guard environ declaration on all Windows builds, not just MSVC. In the mingw-w64 headers (used by llvm-mingw), environ is defined as a macro which expands through _environ to (* __p__environ()), a call to a dllimport function, causing the same inconsistent linkage warning as MSVC. Use WIN32 instead of _MSC_VER to match the platform-specific guards already used throughout the file. The warning occurs with llvm-mingw (both UCRT and MSVCRT variants as tested by Hebasto), but not with the mingw-w64 toolchain currently used in CI (as mentioned by fanquake). Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> --- src/randomenv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 84486b38ea6..2d32e50cab7 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -57,7 +57,7 @@ #include #endif -#ifndef _MSC_VER +#ifndef WIN32 extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms #endif