RFR: 8337683: Fix -Wconversion problem with arrayOop.hpp

Coleen Phillimore coleenp at openjdk.org
Fri Aug 2 12:02:38 UTC 2024


On Thu, 1 Aug 2024 18:49:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Since base_offset_in_bytes and HeapWordSize are int, there's no loss of conversion in making these variables int.  This seems trivial.
> Tested with tier1 on linux and windows.

I run with this:

    diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
    index cf7f4534c89..131e9ece31c 100644
    --- a/make/autoconf/flags-cflags.m4
    +++ b/make/autoconf/flags-cflags.m4
    @@ -186,12 +186,12 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
         gcc)
           DISABLE_WARNING_PREFIX="-Wno-"
           BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
    -      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
    +      CFLAGS_WARNINGS_ARE_ERRORS=""
     
           # Additional warnings that are not activated by -Wall and -Wextra
           WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare \
               -Wunused-function -Wundef -Wunused-value -Wreturn-type \
    -          -Wtrampolines"
    +          -Wtrampolines -Wconversion"
           WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
           WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
           WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS 
    $WARNINGS_ENABLE_ADDITIONAL_CXX"

It doesn't check sign change, which all of the files have a million of these errors.  Only size change.

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

PR Comment: https://git.openjdk.org/jdk/pull/20431#issuecomment-2265203420


More information about the hotspot-dev mailing list