RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v2]

Daniel D. Daugherty dcubed at openjdk.org
Fri Aug 11 14:13:58 UTC 2023


On Fri, 11 Aug 2023 12:54:40 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> I counted (via grep) 62 occurrences of `int buflen` and 47 occurrences of `size_t` buflen in the hotspot code. So while it does look odd to have two different forms right next to each other, there is at least established precedent for each.
>> 
>> Unfortunately these `-Wconversion` changes in general seem the antithesis of code-cleanup and consistency as they force changes in limited contexts, resulting in inconsistencies unless we let the changes fan out to extreme degrees. I would have preferred in many cases to handle overflow/underflow via assertions rather than via the primitive type system. This quest for `-Wconversion` compliance is causing a great deal of pain - hats off to @coleenp for enduring that pain to put these PRs together.
>
> Thank you for this comment.  This work has become soul crushing. I was optimistic at one point that we could cleanly work through these warnings by making int type consistent, and in many cases, that is possible.  And there have been some local improvements to the code that have come out of this (like primitive_compare).  But this work is hampered by 1. wanting to improve the code further than fixing the warnings, and 2. disagreements and questions about how to fix avoiding C style casts, and whether the fixes are needed, for every fix.
> 
> I'm now no longer optimistic that we'll be able to finish this.  We'll see how @dean-long does with the compiler warnings.  There are a lot more of them.  There are also a lot of warnings in the gc code.  Also, that doesn't include test code or libraries code, like java.deskop.  We need to find a way to enable/disable these on a per component basis or even a per file basis, which requires build changes I think.
> 
> When I started this around June 2, there were 424 files with 73396 warnings in hotspot (due to multiple inclusion).   After this patch, there are 259 files with 5717 warnings.

Those statistics are absolutely impressive! You have done outstanding work on a task
that probably also feels unending and your efforts are very much appreciated.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1291379386


More information about the hotspot-dev mailing list