RFR: JDK-8285730: unify _WIN32_WINNT settings [v3]

David Holmes dholmes at openjdk.java.net
Tue May 3 13:31:12 UTC 2022


On Tue, 3 May 2022 07:10:58 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Currently we set _WIN32_WINNT at various places in the codebase; this is used to target a minimum Windows version we want to support. See also for more detailled information :
>> https://docs.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers?redirectedfrom=MSDN#setting-winver-or-_win32_winnt
>> Macros for Conditional Declarations
>> "Certain functions that depend on a particular version of Windows are declared using conditional code. This enables you to use the compiler to detect whether your application uses functions that are not supported on its target version(s) of Windows."
>> 
>> However currently we have quite a lot of differing settings of _WIN32_WINNT in the codebase ; setting _WIN32_WINNT to 0x0601 (Windows 7) where possible would make sense because we have this setting already at   java_props_md.c  (so targeting older Windows versions at other places is most likely not useful).
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adjust Copyright year in wepoll.c

I agree with Erik - the source locations need to be modified to not define it. If we want to keep a record perhaps add an assertion that the value is what was expected?

I still feel we have a disconnect between this and an actual check for what the build and runtime platform version is ...

and it isn't at all clear how someone using an API only in a later Windows version, and so setting _WIN32_WINNT to a higher value, will know that this is defined down in the build files ?

-------------

PR: https://git.openjdk.java.net/jdk/pull/8428


More information about the nio-dev mailing list