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

Aleksey Shipilev shade at openjdk.java.net
Mon Oct 26 09:50:18 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`. Still, it would be good to remove that risky definition, so that it is not used accidentally.

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

Commit messages:
 - 8255389: ConcurrentHashTable::NoOp omits return in non-void return method

Changes: https://git.openjdk.java.net/jdk/pull/863/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=863&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255389
  Stats: 4 lines in 1 file changed: 3 ins; 1 del; 0 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