HomeFreeBSD

java/openjdk8: fix build with clang 19

Description

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)

Details

Provenance
dimAuthored on Aug 1 2024, 10:34 AM
Parents
R11:6ba9a86353c6: www/py-django50: Update to 5.0.8
Branches
Unknown
Tags
Unknown