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

Aleksey Shipilev shade at openjdk.java.net
Tue Oct 27 05:46:28 UTC 2020


> 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.

Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:

  Even simpler version

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/863/files
  - new: https://git.openjdk.java.net/jdk/pull/863/files/1154fea6..d84a461f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=863&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=863&range=01-02

  Stats: 8 lines in 1 file changed: 2 ins; 5 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/863.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/863/head:pull/863

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


More information about the hotspot-dev mailing list