RFR: 8312121: Fix -Wconversion warnings in tribool.hpp [v6]
    Dean Long 
    dlong at openjdk.org
       
    Fri Jul 28 03:56:44 UTC 2023
    
    
  
On Thu, 27 Jul 2023 22:50:16 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Assigning _value first, and then doing _value | 2 doesn't get -Wconversion warnings.  Also, reduced include file inclusion a little.
>> Tested with tier1 on linux-x64-debug, windows-x64-debug, macos-aarch64-debug
>
> Coleen Phillimore has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - David suggestion
>  - David suggestion
This version still looks good.  If you want to do the |= in only one place, you could do it in TriBool operator = and have the other two places use TriBool operator =.
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;
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);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14892#issuecomment-1654958860
PR Review Comment: https://git.openjdk.org/jdk/pull/14892#discussion_r1277063600
PR Review Comment: https://git.openjdk.org/jdk/pull/14892#discussion_r1277063977
    
    
More information about the hotspot-dev
mailing list