RFR: 8312121: Fix -Wconversion warnings in tribool.hpp [v6]
Coleen Phillimore
coleenp at openjdk.org
Fri Jul 28 12:12:02 UTC 2023
On Fri, 28 Jul 2023 03:53:29 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - David suggestion
>> - David suggestion
>
> src/hotspot/share/utilities/tribool.hpp line 45:
>
>> 43: TriBool(bool value) : _value(value) {
>> 44: // set to not-default in separate step to avoid conversion warnings
>> 45: _value |= 2;
>
> Suggestion:
>
> TriBool(bool value) {
> *this = value;
Thanks for the suggestion but this makes me squint to try to figure out what it does and why it's correct.
> src/hotspot/share/utilities/tribool.hpp line 81:
>
>> 79: _slot ^= ((u1)_value) << _offset; // reset the tribool
>> 80: _value = newval;
>> 81: _value |= 2; // set to not-default
>
> Suggestion:
>
> TriBool::operator=(newval);
I don't think this is more readable. I believe you that it doesn't give -Wconversion warnings though.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14892#discussion_r1277466616
PR Review Comment: https://git.openjdk.org/jdk/pull/14892#discussion_r1277467452
More information about the hotspot-dev
mailing list