RFR: 8336346: Fix -Wzero-as-null-pointer-constant warnings in jvmciJavaClasses.cpp

Julian Waters jwaters at openjdk.org
Tue Jul 16 07:05:54 UTC 2024


On Sun, 14 Jul 2024 12:02:47 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this trivial change to remove -Wzero-as-null-pointer-constant
> warnings (when enabled), triggered by assignment to or comparison with a
> jfieldID (a pointer type) with a value of 0.  Changing the value to nullptr
> removes the warnings.
> 
> Because these changes are in macros that are used many times, this change
> removes about 100 warnings.
> 
> Testing: mach5 tier1

src/hotspot/share/jvmci/jvmciJavaClasses.cpp line 629:

> 627:     assert(obj.is_non_null(), "null field access of %s.%s", #className, field_name);                                              \
> 628:     assert(jvmciEnv->isa_##className(obj), "wrong class, " #className " expected, found %s", jvmciEnv->klass_name(obj));          \
> 629:     assert(offset != nullptr, "must be valid offset");                                                                                  \

Alignment of the backslash seems off

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20175#discussion_r1678864003


More information about the hotspot-compiler-dev mailing list