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 05:00:13 UTC 2023


On Fri, 3 Nov 2023 04:12:46 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> We should set the -permissive- flag for the Microsoft Visual C compiler, as was requested by the now backed out [JDK-8241499](https://bugs.openjdk.org/browse/JDK-8241499). Doing so makes the Visual C compiler much less accepting of ill formed code, which will improve code quality on Windows in the future.
>
> Julian Waters has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Part II awt_PrintJob.cpp

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?

https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2362?view=msvc-170

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

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


More information about the client-libs-dev mailing list