RFR: 8307160: Fix AWT/2D/A11Y to support the permissive- flag on the Microsoft Visual C compiler [v18]
Phil Race
prr at openjdk.org
Mon Nov 6 20:09:44 UTC 2023
On Mon, 6 Nov 2023 04:06:57 GMT, Julian Waters <jwaters at openjdk.org> wrote:
> By the way, how outdated is the comment that awt.dll should not rely on msvcp.dll? As far as I can tell we now always distribute msvcp.dll in the JDK, and it would help a lot if I could use the C++ Standard Library for this
Do we ? I'm not sure why that is. We've previously tried hard to avoid that.
Eg https://hg.openjdk.org/jdk9/jdk9/rev/f3c96aea372d
We should still stay away from it.
But it doesn't matter because the changes you are making aren't going in the right direction.
The root of the compiler complaints is the gotos isn't it ?
So the code needs to be changed to not use gotos.
But there are hundreds of those. I guess only a few trigger the warnings ?
So your awt_Canvas example should end up looking something like this
WARNING: I just edited in place, haven't built it, haven't tested it, it is to show what the code should look like
void AwtCanvas::_SetEraseBackground(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
SetEraseBackgroundStruct *sebs = (SetEraseBackgroundStruct *)param;
jobject canvas = sebs->canvas;
if (canvas == NULL) {
env->ExceptionClear();
JNU_ThrowNullPointerException(env, "canvas");
} else {
PDATA pData = JNI_GET_PDATA(canvas);
if (pData == NULL) {
env->DeleteGlobalRef(canvas);
THROW_NULL_PDATA_IF_NOT_DESTROYED(canvas);
} else {
AwtCanvas *c = (AwtCanvas*)pData;
c->m_eraseBackground = sebs->doErase;
c->m_eraseBackgroundOnResize = sebs->doEraseOnResize;
env->DeleteGlobalRef(canvas);
}
}
delete sebs;
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15096#issuecomment-1796303631
More information about the client-libs-dev
mailing list