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

Julian Waters jwaters at openjdk.org
Fri Nov 3 15:13:19 UTC 2023


On Fri, 3 Nov 2023 05:06:22 GMT, Phil Race <prr at openjdk.org> wrote:

> > Actually, I can do you one better, now that I think of it, so I don't have to explains potentially deeply nested and confusing error logs:
> > ```
> > int main() {
> >     goto skip;
> >     int i = 0;
> >     skip:
> >     std::printf("Done\n");
> > }
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > C:\Users\vertig0\Downloads>cl.exe -nologo -std:c++14 -permissive- -Fo:goto.o goto.cpp
> > goto.cpp(5): error C2362: initialization of 'c' is skipped by 'goto skip' goto.cpp(6): note: see declaration of 'skip'
> > You simply cannot jump over initialization of a local with a goto in C++, as shown by the Visual C compiler above, does this answer your question?
> 
> It tells me 2 things (1) C++ is awful, because the change you made to silence it is a no-op (2) the changes you are making are really wrong, because C++ is telling us it does not like goto, and you aren't addresssing that

I made the decision to use no-op changes based on the review in https://github.com/openjdk/jdk/pull/15996 at @djelinski's suggestion, because I assumed the best way forward is to make the changes minimally disruptive to client code, is that not what we're aiming for here? The quote-on-quote correct ways to fix this are either to wrap everything in a scope, or rewrite a significant portion of the AWT codebase to remove the gotos, the former is very messy and hard to review (as seen above in one of your earlier reviews), the latter would be difficult to do. Not sure which one you'd prefer?

Side note: What about the jdk.accessibility changes? Are those ok at least?

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

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


More information about the client-libs-dev mailing list