JDK-8239223 : [8u] enable Wparentheses warnings in HotSpot
  • Type: Bug
  • Component: hotspot
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-02-17
  • Updated: 2020-08-14
  • Resolved: 2020-02-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u251Fixed
Description
In 8u HotSpot there are several Wparentheses warnings which causes compilation failure on recent versions of Xcode. We will fix these warnings as part of our toolchain upgrade effort.

This is somewhat complicated by the fact that enabling (or disabling) Wparentheses also changes the default for a number of other parentheses-related warnings [0]. In the current 8u hotspot code, the following warnings are applicable:

logical-op-parentheses
bitwise-op-parentheses
parentheses-equality
parentheses

The first two are already explicitly disabled in gcc.make and will be addressed (very soon) with their own individual bug/changesets. This fix is exclusively for the warnings generated as a result of Wparentheses (and Wbitwise-op-parentheses, which is implicitly disabled by Wno-parentheses).

The two warnings of interest are:

warning: '&' within '|' [-Wbitwise-op-parentheses]
warning: using the result of an assignment as a condition without parentheses [-Wparentheses]

This is a partial backport of Paul Hohensee's massive cleanup [1] of Xcode warnings. A complete backport of that chnageset is well beyond the scope of our toolchain upgrade work. But we do want to clean up as many warnings as we can with minimal risk.

[0] https://clang.llvm.org/docs/DiagnosticsReference.html#wparentheses
[1] http://hg.openjdk.java.net/jdk10/jdk10/hotspot/rev/c044f8d03932