I clicked "Trigger" to get a Mingw test run of this, and it failed[1]. I see why: our function win32_langinfo() believes that it shouldn't call GetLocaleInfoEx() on non-MSVC compilers, so we see 'initdb: error: could not find suitable encoding for locale "en-US"'. I think it has fallback code that parses the ".1252" or whatever on the end of the name, but "en-US" hasn't got one. I don't know the first thing about Mingw but it looks like a declaration for that function arrived 6 years ago[2], and deleting the "#if defined(_MSC_VER)" fixes the problem and the tests pass[3]. As far as I know, we don't support any Mingw but the very latest: it's not a target with real users who have version requirements, it's just a developer [in]convenience, so if it passes on CI and whatever MSYS version "fairywren" runs in the build farm right now, that should be enough.
I could just do that in this patch, but I suppose that also means that someone needs to go through pg_locale.c and other places that test _MSC_VER not because they actually care about the compiler but because they want to detect some crusty old Mingw version, and see what else can be deleted as a result, possibly including a lot of fallback code. It feels like a separate cleanup for a separate patch. [1] https://cirrus-ci.com/task/5301814774464512 [2] https://github.com/mirror/mingw-w64/blame/eff726c461e09f35eeaed125a3570fa5f807f02b/mingw-w64-tools/widl/include/winnls.h#L931 [3] https://cirrus-ci.com/task/6558569718349824