RFR: 8335294: Fix simple -Wzero-as-null-pointer-constant warnings in gc code
Kim Barrett
kbarrett at openjdk.org
Fri Jun 28 23:08:17 UTC 2024
On Fri, 28 Jun 2024 12:37:41 GMT, Julian Waters <jwaters at openjdk.org> wrote:
> I would keep the return nullptr in that one place that it was removed (I'm somewhat certain that leaving out a return in a method that has a non void return type isn't allowed in C++, even if there was a call to a noreturn method directly before the return), but besides that this seems ok
Having execution run off the end of a function not returning void is UB. Ending with a [[noreturn]] function prevents
that from happening (assuming the [[noreturn]] attribute is correctly applied, else that is itself UB).
We should instead be removing these "spurious" continuations / returns as encountered, to eliminate any questions
about whether, for example, a function _can_ return null. I don't recommend going on a hunt to clean these up, as
that would likely be a lot of code churn.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19934#issuecomment-2197755214
More information about the hotspot-dev
mailing list