RFR: JDK-8354316 : clang/linux build fails with -Wunused-result warning at XToolkit.c:695:9 [v2]

Erik Joelsson erikj at openjdk.org
Fri May 23 13:13:04 UTC 2025


On Tue, 13 May 2025 18:33:40 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> make/modules/java.desktop/lib/AwtLibraries.gmk line 281:
>> 
>>> 279:       DISABLED_WARNINGS_gcc_XlibWrapper.c := type-limits pointer-to-int-cast, \
>>> 280:       DISABLED_WARNINGS_gcc_XRBackendNative.c := maybe-uninitialized, \
>>> 281:       DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \
>> 
>> Probably a question for build team -
>> One thing to be noted here is that:  With unused-result line removed and WITHOUT the if block changes in XToolkit.c, I expected the build to fail due to unused-result on linux/gcc but it did not.
>> So is there any chance that this disabled warning is being added from else where for gcc ?
>
> Maybe gcc doesn't detect this specific case.
> 
> There could've been other cases which triggered the warning in gcc.

It could be that not all versions of GCC trigger this warning in this particular case. We don't track disabling of warnings on a per version granularity, as that would be incredibly tedious, so it's hard to know. It could also be that this disabling of `unused-result` was added for a different case that has since disappeared.

Regardless, since you are fixing such an issue in the code and no longer see this warning with a reasonably new GCC, it should be safe to remove this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25217#discussion_r2104557140


More information about the client-libs-dev mailing list