[PATCH] Fix some assignments of string literals to non-const char*
Andrew Luo
andrewluotechnologies at outlook.com
Tue May 14 00:21:29 UTC 2019
I've been trying to get the JDK to compile with the new /permissive- switch in VS2017 (https://devblogs.microsoft.com/cppblog/permissive-switch/) however there have been a few issues in various parts of the code. There are a few issues in the hotspot code where we attempt to assign string literals to char* (non-const) variables (unnecessarily). I took some time to fix some of these and attached a patch. Let me know if you have any comments/feedback.
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/test/hotspot/gtest/gtestMain.cpp(234): error C2440: 'initializing': cannot convert from 'const char [19]' to 'char *'
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/test/hotspot/gtest/gtestMain.cpp(234): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/src/hotspot/os/windows/attachListener_windows.cpp(152): error C2664: 'AttachOperation::AttachOperation(AttachOperation &&)': cannot convert argument 1 from 'const char [9]' to 'char *'
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/src/hotspot/os/windows/attachListener_windows.cpp(152): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/src/hotspot/os/windows/os_windows.cpp(204): error C2440: 'initializing': cannot convert from 'const char [5]' to 'char *'
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/src/hotspot/os/windows/os_windows.cpp(204): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
c:/Users/Andrew/Documents/mercurial/openjdk/jdk/src/hotspot/os/windows/os_windows.cpp(2214): error C2440: 'initializing': ...
Thanks,
-Andrew
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jdkcomformance1.txt
URL: <https://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20190514/91320dc8/jdkcomformance1.txt>
More information about the hotspot-dev
mailing list