RFR: 8332189: Enable -Wzero-as-null-pointer-constant for gcc/clang [v2]
Kim Barrett
kbarrett at openjdk.org
Tue Feb 10 05:44:09 UTC 2026
> 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.
Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
update copyright
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29497/files
- new: https://git.openjdk.org/jdk/pull/29497/files/90ead8b1..ba299872
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29497&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29497&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/29497.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29497/head:pull/29497
PR: https://git.openjdk.org/jdk/pull/29497
More information about the hotspot-dev
mailing list