[flang-commits] [flang] [llvm] [flang] improve compatibility with mingw headers (PR #172041)

Jameson Nash via flang-commits flang-commits at lists.llvm.org
Tue Dec 23 14:51:21 PST 2025


================
@@ -20,7 +20,9 @@
 
 // Target Windows 2000 and above. This is needed for newer Windows API
 // functions, e.g. GetComputerNameExA()
+#ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0500
+#endif
----------------
vtjnash wrote:

Yes, if the user tries to set the compiler to an older version and then uses a feature that requires newer Windows APIs, then they'll get a compiler error. Otherwise there shouldn't be a need to prevent compilation (the value comes from one 

The main conflicting definition comes from `_mingw.h` (if windows.h was already included in the caller), since for whatever reason it is defined there as:
```
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endif
```

https://github.com/llvm/llvm-project/pull/172041


More information about the flang-commits mailing list