JDK-8327494 : Enable gcc -Wzero-as-null-pointer-constant for HotSpot
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: other
  • Affected Version: 23
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2024-03-06
  • Updated: 2024-11-26
  • Resolved: 2024-11-19
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.
Other
tbdFixed
Related Reports
Relates :  
Description
When building HotSpot, enable -Wzero-as-null-pointer-constant to enforce the HotSpot Style Guide's admonishment against such usage.

This is aspirational for now, as there are currently several thousand warnings generated by that option. Many are from a small number of widely included header files, but even after that there are quite a few. Some are not trivial to fix (not simply changing a "0" to "nullptr", for example). So some significant work on HotSpot will be required before this option can be enabled. 

Comments
Moving to hotspot component.
14-06-2024

That'd not be for your benefit, but for mine. :-) I'd like to make sure I understand how I can make progress on all issues filed under infrastructure/build. This one is, as it stands, either a bug that should be on Hotspot, or a bug that needs to be declared as blocked by a separate hotspot bug. But maybe I can just move this to the hotspot component and we're both happy? If you get the Hotspot prerequisite changes done, and the only thing that remains is adding the make flag, and this bug is still open, feel free to restore it to infrastructure/build.
26-03-2024

[~ihse] See the part of the description about this being "aspirational for now". There are likely a bunch of HotSpot changes needed, which would should all be considered blockers for this. I don't see any benefit to adding a HotSpot umbrella issue for those changes that is distinct from and blocks this issue, rather than just treating this as one as the umbrella.
25-03-2024

It sounds like this then is a hotspot, not a build issue, then? If there are thousands of fixes in hotspot, and a one-liner in the build, I suggest you either change component for this bug, or create a separate issue for the Hotspot changes and make this (the build changes) dependent on that.
25-03-2024

This option doesn't appear to help to prevent backsliding on uses of NULL in HotSpot, which should always be using nullptr. It looks like that warning at one time *sometimes* complained about NULL or __null: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77513 But there was an explicit change to make that warning not apply to those: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=752e7593b0f19af233a0b7e72daab8413662b60
06-03-2024