RFR: 8307160: Fix AWT/2D/A11Y to support the permissive- flag on the Microsoft Visual C compiler [v52]

Magnus Ihse Bursie ihse at openjdk.org
Mon Mar 25 09:05:43 UTC 2024


On Mon, 25 Mar 2024 05:56:52 GMT, Julian Waters <jwaters at openjdk.org> wrote:

> The only thing I'm uncertain about is the pData local, which I don't see much benefit in removing since the null check associated with it still has to remain for code semantics to be correct

The point is that you can do the null check on the correct variable directly, instead of going a detour with pData. So instead of:


RealType realVal;
void* pData = getVal()
if (pData == null) {
  // bail out
}
realVal = (RealType) pData;


you can just do:


RealType realVal = getVal();
if (realVal == null) {
  // bail out
}


as the code normally would have been written, had there not been an old macro that used the "magic" temporary pData variable.

This is a recurring pattern in this patch and needs to be fixed everywhere.

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

PR Comment: https://git.openjdk.org/jdk/pull/15096#issuecomment-2017510861


More information about the build-dev mailing list