[PATCH] Fix some assignments of string literals to non-const char*
Andrew Luo
andrewluotechnologies at outlook.com
Thu May 16 05:29:22 UTC 2019
Awesome, thanks for your reviews and help getting this in.
-----Original Message-----
From: David Holmes <david.holmes at oracle.com>
Sent: Tuesday, May 14, 2019 5:42 PM
To: Andrew Luo <andrewluotechnologies at outlook.com>
Cc: hotspot-dev developers <hotspot-dev at openjdk.java.net>
Subject: Re: [PATCH] Fix some assignments of string literals to non-const char*
Pushed:
Changeset: f67269c129f9
Author: dholmes
Date: 2019-05-14 20:29 -0400
URL: http://hg.openjdk.java.net/jdk/jdk/rev/f67269c129f9
8223810: HotSpot compile warnings from VS2017
Reviewed-by: dholmes, stuefe
Contributed-by: Andrew Luo <andrewluotechnologies at outlook.com>
! src/hotspot/os/windows/os_windows.cpp
! src/hotspot/share/services/attachListener.hpp
! test/hotspot/gtest/gtestMain.cpp
David
On 14/05/2019 5:49 pm, David Holmes wrote:
> Thanks Thomas. My testing passed so I'll push this in the morning.
>
> David
> -----
>
> On 14/05/2019 5:12 pm, Thomas Stüfe wrote:
>> This looks fine.
>>
>> Cheers, Thomas
>>
>> On Tue, May 14, 2019 at 6:45 AM David Holmes <david.holmes at oracle.com
>> <mailto:david.holmes at oracle.com>> wrote:
>>
>> Hi Andrew,
>>
>> Thanks for the report and patch. We just had something very
>> similar go
>> through for gcc 9 on non-Windows. :) Interesting gcc didn't
>> complain
>> about the code in attachListener.hpp.
>>
>> I've filed:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8223810
>>
>> and I will sponsor this for you. I've posted a webrev here:
>>
>> http://cr.openjdk.java.net/~dholmes/8223810/webrev/
>>
>> and am running the patch through our build.
>>
>> Thanks,
>> David
>>
>> On 14/05/2019 10:21 am, Andrew Luo wrote:
>> > 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
>> >
>>
More information about the hotspot-dev
mailing list