[Bug 280559] java/openjdk8: fix build with clang 19

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 07 Aug 2024 16:52:30 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280559

--- Comment #4 from commit-hook@FreeBSD.org ---
A commit in branch 2024Q3 references this bug:

URL:
https://cgit.FreeBSD.org/ports/commit/?id=81c40ab2f6ae458d0bcb01d25385c86b6c52fcb3

commit 81c40ab2f6ae458d0bcb01d25385c86b6c52fcb3
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-01 10:34:13 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-07 16:51:45 +0000

    java/openjdk8: fix build with clang 19

    Clang 19 is now more strict about undefined integral expressions used as
    constants in enum, which results in errors compiling java/openjdk8,
    similar to:

       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/hotspot/src/share/vm/oops/cpCache.hpp:195:34:
error: expression is not an integral constant expression
          195 |     option_bits_mask           = ~(((-1) << tos_state_shift) |
(field_index_mask | parameter_size_mask))
              |                                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/hotspot/src/share/vm/oops/cpCache.hpp:195:42:
note: left shift of negative value -1
          195 |     option_bits_mask           = ~(((-1) << tos_state_shift) |
(field_index_mask | parameter_size_mask))
              |                                          ^

       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/hotspot/src/share/vm/code/dependencies.hpp:173:27:
error: expression is not an integral constant expression
          173 |     all_types           = ((1 << TYPE_LIMIT) - 1) & ((-1) <<
FIRST_TYPE),
              |                          
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/hotspot/src/share/vm/code/dependencies.hpp:173:59:
note: left shift of negative value -1
          173 |     all_types           = ((1 << TYPE_LIMIT) - 1) & ((-1) <<
FIRST_TYPE),
              |                                                           ^

        In file included from
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp:43:
       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h:226:33:
error: expression is not an integral constant expression
          226 |     AO_UNUSED_MBZ             = (-1)<<13, // options bits
reserved for future use.
              |                                 ^~~~~~~~
       
/wrkdirs/usr/ports/java/openjdk8/work/jdk8u-jdk8u422-b05.1/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h:226:37:
note: left shift of negative value -1
          226 |     AO_UNUSED_MBZ             = (-1)<<13, // options bits
reserved for future use.
              |                                     ^

    In openjdk11 and later, the (-1) constants have been replaced by the
    unsigned variant (~0u), which fixes these errors.

    PR:             280559
    Approved by:    glewis (maintainer)
    MFH:            2024Q3

    (cherry picked from commit 55925767376bb8d4ffe1a0304555988464c25599)

 .../patch-hotspot_src_share_vm_code_dependencies.hpp (new)    | 11 +++++++++++
 .../files/patch-hotspot_src_share_vm_oops_cpCache.hpp (new)   | 11 +++++++++++
 ..._share_native_com_sun_java_util_jar_pack_constants.h (new) | 11 +++++++++++
 3 files changed, 33 insertions(+)

-- 
You are receiving this mail because:
You are the assignee for the bug.