[llvm] Support: unlock Windows API support, switch to Windows 10 RS1+ APIs (PR #102240)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 10:46:06 PDT 2024
================
@@ -21,13 +21,16 @@
#ifndef LLVM_SUPPORT_WINDOWSSUPPORT_H
#define LLVM_SUPPORT_WINDOWSSUPPORT_H
+#if defined(__MINGW32__)
// mingw-w64 tends to define it as 0x0502 in its headers.
#undef _WIN32_WINNT
#undef _WIN32_IE
// Require at least Windows 7 API.
#define _WIN32_WINNT 0x0601
----------------
cjacek wrote:
> in some cases it also serves as the minimum target API version. E.g. some headers, such as psapi.h use _WIN32_WINNT (or more precisely NTDDI_VERSION) to select a newer ABI construct, which only works on the version selected by _WIN32_WINNT
Yes, there is the infamous example of psapi.h, but I don't think there are many other cases like that. This one is only about being older than Windows 7 or not, so it's not the problem in this context. I don't recall any example where such checks are done against newer Windows versions, so I think it's safe in this context. I presume that a lesson was learned from psapi.h mistake...
(FWIW, modern mingw-w64 defaults to 0xa00, which could in theory allow to remove the whole thing here instead of ifdefing `__MINGW32__`. Unfortunately, mingw-w64 was late to do that and in the mean time various assumptions spread among users, making the increase tricky from compatibility point of view and causing some vendors to override that to still define an older version by default.)
https://github.com/llvm/llvm-project/pull/102240
More information about the llvm-commits
mailing list