RFR: 8342870: Errors related to unused code on Windows after 8339120 in accessibility [v5]

Alexey Ivanov aivanov at openjdk.org
Tue Jan 21 21:23:45 UTC 2025


On Tue, 21 Jan 2025 00:34:39 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> src/jdk.accessibility/windows/native/bridge/AccessBridgeCalls.c line 233:
>> 
>>> 231:             return TRUE;
>>> 232:         }
>>> 233:         ((void) error);
>> 
>> Not sure why do we need it. I mean there is a value assignment before so why would compiler complain?
>
> The error being cast to void is just there to mark that this was a place that the compiler flagged, as for the warning itself, apparently just assigning the value is not enough, as that yields a -Wunused-but-set-variable, it has to actually be used somehow or explicitly be cast to void to stop the warning altogether

This may be useful in a debug build to look up the error if it occurs…

Shall it be removed?

>> src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp line 326:
>> 
>>> 324: int regEnable() {
>>> 325:     HKEY hKey;
>>> 326:  // DWORD retval = -1;
>> 
>> I don't think we need to comment out both retval and freeData. It is either remnants of the code that was long gone or (more likely) were just a copy of another template method that actually uses these variables. If variables are not used within the function i would just delete them.
>
> Will do, thanks

I agree `retval` was probably used as a return value of the function; now there are explicit `return` statements.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21656#discussion_r1924377383
PR Review Comment: https://git.openjdk.org/jdk/pull/21656#discussion_r1923754007


More information about the client-libs-dev mailing list