maintainer-feedback requested: [Bug 280559] java/openjdk8: fix build with clang 19

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 01 Aug 2024 16:07:18 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-java (Nobody)
<java@FreeBSD.org> for maintainer-feedback:
Bug 280559: java/openjdk8: fix build with clang 19
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280559



--- Description ---
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.