RFR: 8332189: Enable -Wzero-as-null-pointer-constant for gcc/clang [v2]
Afshin Zafari
azafari at openjdk.org
Tue Feb 10 09:30:11 UTC 2026
On Tue, 10 Feb 2026 05:44:09 GMT, Kim Barrett <kbarrett at openjdk.org> 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.
>
> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>
> update copyright
Thanks.
LGTM.
-------------
Marked as reviewed by azafari (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29497#pullrequestreview-3777769510
More information about the hotspot-dev
mailing list