On Thu, 29 Oct 2026 18:38:32 GMT, Phil Race <[email protected]> wrote:

>> While testing new MSVC warning flags, a number of unused but initialized 
>> variables in java.desktop have been found.
>> A lot of them can be removed. A few are needed for special build variants 
>> like (fast)debug only so they have to stay.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 1818:
> 
>> 1816:         bitMapHeader.bmiHeader.biCompression = BI_RGB;
>> 1817: 
>> 1818:         [[maybe_unused]] int result =
> 
> why, in these cases, do you need [[maybe_unused]] for these return values, 
> but not at line 1675 -- above -- in the same source file ?

I think at line 1675, it is always unused. Here it is unused or not, depending 
on the build variant.
But if you do not like the maybe_unused, I can remove it.
As long as we do not set the warning (as error) build flag for these cases of 
unused but initialized vars, it is okay to remove the maybe_unused.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33495#discussion_r4421667132

Reply via email to