On Fri, 30 Jan 2026 00:16:54 GMT, Kim Barrett <[email protected]> wrote:

> Please review this change which enables `-Wzero-as-null-pointer-constant`
> warnings in HotSpot code when building with gcc or clang.
> 
> There are three parts to this change.
> 
> The first part augments the warning flags setup to support adding warning
> options that are only applied to HotSpot, rather than the JDK as a whole.
> There was previously some unused and possibly incomplete support for this when
> using gcc. Note that the Windows/Visual Studio support hasn't been tested
> much, and I think might not be working yet. I'm going to investigate that
> further in followup work.
> 
> The second part enables `-Wzero-as-null-pointer-constant` for HotSpot code.
> This follows the guidance to avoid such in the HotSpot Style Guide.
> 
> The third part removes a note in the HotSpot Style Guide about lingering uses
> of literal 0 as a null pointer constant.  Those have been removed, and this
> change will block backsliding.
> 
> Testing: mach5 tier1, GHA Sanity tests
> 
> Integration of this change needs to wait for JDK-8376758.

This pull request has now been integrated.

Changeset: 4e3033f2
Author:    Kim Barrett <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/4e3033f2122d773c173b0bb50120099589adcf3c
Stats:     41 lines in 3 files changed: 14 ins; 13 del; 14 mod

8332189: Enable -Wzero-as-null-pointer-constant for gcc/clang

Reviewed-by: azafari, dholmes, erikj

-------------

PR: https://git.openjdk.org/jdk/pull/29497

Reply via email to