[Bug 262845] java/openjdk13 java/openjdk14 java/openjdk15 java/openjdk16 java/openjdk17: fix build with clang 14

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 26 Mar 2022 19:53:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262845

            Bug ID: 262845
           Summary: java/openjdk13 java/openjdk14 java/openjdk15
                    java/openjdk16 java/openjdk17: fix build with clang 14
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: java@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(java@FreeBSD.org)
          Assignee: java@FreeBSD.org

During an exp-run for llvm 14 (see bug 261742), it turned out that
java/openjdk13 and java/openjdk17 fail to build with clang 14 (but this also
affects openjdk14 through 16):

=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_objs_serviceThread.o:
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
error: use of bitwise '|' with boolean operands
[-Werror,-Wbitwise-instead-of-logical]
      while (((sensors_changed = LowMemoryDetector::has_pending_requests()) |
             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
note: cast one or both operands to int to silence this warning
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
error: use of bitwise '|' with boolean operands
[-Werror,-Wbitwise-instead-of-logical]
      while (((sensors_changed = LowMemoryDetector::has_pending_requests()) |
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
note: cast one or both operands to int to silence this warning
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
error: use of bitwise '|' with boolean operands
[-Werror,-Wbitwise-instead-of-logical]
      while (((sensors_changed = LowMemoryDetector::has_pending_requests()) |
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
note: cast one or both operands to int to silence this warning
/wrkdirs/usr/ports/java/openjdk13/work/jdk13u-jdk-13.0.10-5-1/src/hotspot/share/runtime/serviceThread.cpp:133:15:
error: use of bitwise '|' with boolean operands
[-Werror,-Wbitwise-instead-of-logical]
      while (((sensors_changed = LowMemoryDetector::has_pending_requests()) |
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ... (rest of output omitted)

Although the warning is normally an indication of a potential problem, in this
case a comment just before the affected code explictly mentions the reason for
using bitwise '|' instead of logical '||':

      // Process all available work on each (outer) iteration, rather than
      // only the first recognized bit of work, to avoid frequently true early
      // tests from potentially starving later work.  Hence the use of
      // arithmetic-or to combine results; we don't want short-circuiting.

(See
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/serviceThread.cpp#L140
)

Therefore, we should suppress -Wbitwise-instead-of-logical for clang 14 and
higher.

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