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

Julian Waters jwaters at openjdk.org
Tue Jan 21 00:37:43 UTC 2025


On Mon, 20 Jan 2025 23:18:41 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

>> Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>> 
>>  - Merge branch 'openjdk:master' into accessibility
>>  - Cast to void in AccessBridgeCalls.c
>>  - static_cast to void in jaccessinspector.cpp
>>  - Formatting changes in AccessBridgeEventHandler.cpp
>>  - Merge branch 'master' into accessibility
>>  - Remove now unused result
>>  - Merge branch 'master' into accessibility
>>  - 8342870
>
> 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

> 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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21656#discussion_r1922933515
PR Review Comment: https://git.openjdk.org/jdk/pull/21656#discussion_r1922933610


More information about the client-libs-dev mailing list