RFR: 8313564: Fix -Wconversion warnings in classfile code [v4]

Dean Long dlong at openjdk.org
Thu Aug 3 10:39:35 UTC 2023


On Thu, 3 Aug 2023 01:37:08 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This patch fixes various -Wconversion warnings in classfile code.  I broke the change into commits so the changes are easier to see.
>> Tested with tier1-4.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix Atomic items_added code.

src/hotspot/share/classfile/classFileParser.cpp line 973:

> 971:   void remove_annotation(ID id) {
> 972:     assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
> 973:     _annotations_present &= (int)~nth_bit((int)id);

This silences the warning but without a runtime check.  It would be nice to have a constexpr template version of nth_bit that return the desire type and also do a range check on the input, unlike this macro version always returns intx and returns 0 if the shift is out of range.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15111#discussion_r1283009813


More information about the graal-dev mailing list