RFR: 8255389: ConcurrentHashTable::NoOp omits return in non-void return method

Robbin Ehn rehn at openjdk.java.net
Mon Oct 26 12:45:11 UTC 2020


On Mon, 26 Oct 2020 09:41:12 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Static analysis complains there is a non-void return method without a return statement:
> 
>   struct NoOp {
>     void operator()(VALUE*) {}
>     const VALUE& operator()() {} // <--- here
>     void operator()(bool, VALUE*) {}
>   } noOp;
> 
> AFAICS, this is UB, and we have seen cases like these break compilers in other places. Not in this case, though, because `noOp` is only used as the default functor in `remove`, which does not use this getter-like definition. Still, it would be good to remove that risky definition, so that it is not used accidentally.

This fix is fine by me.
Kim's suggestions seems more like enhancements.

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

Marked as reviewed by rehn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/863


More information about the hotspot-dev mailing list