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>
This commit is contained in:
Lőrinc
2025-10-07 19:03:52 -05:00
parent b510893d00
commit 9610b0d1e2

View File

@@ -57,7 +57,7 @@
#include <sys/auxv.h>
#endif
#ifndef _MSC_VER
#ifndef WIN32
extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms
#endif