On Wed, 9 Sep 2026 13:13:23 GMT, Matthias Baesken <[email protected]> wrote:
>> src/java.base/unix/native/libnio/ch/Net.c line 694: >> >>> 692: struct ipv6_mreq mreq6; >>> 693: #ifndef __APPLE__ >>> 694: struct group_source_req req; >> >> Hello Matthias, would it be more appropriate to move this declaration >> directly into the `#else` block where the call to `initGroupSourceReq()` >> function happens for non-Apple platforms? I don't know if there are specific >> guidelines in the JDK C code which require us to declare the function >> variables right at the beginning of the function. > > We build with std=c11 so it should be fine to move the declaration. > And there are already code locations in the C codebase where this is done > https://github.com/openjdk/jdk/blob/master/src/java.base/macosx/native/libnio/ch/FileDispatcherImpl.c#L54 Looking at it more, we need the `struct group_source_req req;` declaration twice, once for the 'non-Apple' code at lines 710ff. And also for the AIX-only code a few lines before the end of the function. So I would prefer keeping the code as it is, because declaring it twice is not really nicer than having the non-APPLE macro check. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32782#discussion_r3968912277
