RFR 8014431 : cleanup warnings indicated by the -Wunused-value compiler option on linux
David Holmes
david.holmes at oracle.com
Thu May 23 17:56:34 PDT 2013
trimming ...
On 24/05/2013 3:55 AM, Calvin Cheung wrote:
> On 5/23/2013 5:45 AM, David Holmes wrote:
>> src/share/vm/runtime/perfData.hpp
>>
>> This can't be right:
>>
>> 773 return create_string_variable(ns, name, (int)0, s, CHECK_NULL);
>>
>> why do we have to cast 0 to int ????
> I've removed it.
Okay - but what made you add it? Did it produce a warning?
>> src/share/vm/utilities/taskqueue.hpp
>>
>> I do not understand this code:
>>
>> ! // g++ complains if the volatile result of the assignment is unused.
>> ! const_cast<E&>(_elems[localBot] = t);
>>
>> why do we even need the const cast? How is the assignment not used ???
> I've tried without the const cast and got the following error:
> /scratch/cccheung/hs25/src/share/vm/utilities/taskqueue.hpp:348: error:
> object of type ‘volatile StarTask&’ will not be accessed in statement
>
> There was an original comment about the const cast as follows:
> 343 // g++ complains if the volatile result of the assignment is unused.
> 344 const_cast<E&>(_elems[localBot] = t);
Yep I already quoted that comment above :) And I still don't understand
it. What variable is a "volatile E&"? _elems is a "volatile E*" so I
guess _elems[i] is a "volatile E&" but we are assigning it, so how can
it not be used ??? I wonder if the problem is that "t" is a plain E not
a "volatile E&"? But then I also wonder whether _elems was meant to be
declared as "E * volatile" ?
Anyway your current fix is fine.
Thanks,
David
> thanks,
> Calvin
>>
>> I understand your fix of adding (void) but I'm baffled by the original
>> code.
>>
>> ---
>>
>> Thanks,
>> David
>> -----
>>
>> On 22/05/2013 5:32 AM, Calvin Cheung wrote:
>>> This change is for fixing the errors resulting from enabling the
>>> -Wunused-value compiler option on linux.
>>>
>>> The patch was initiated by Jeremy (jeremymanson at google.com).
>>> More changes are needed for it to pass the build.
>>>
>>> Tests performed:
>>> jprt
>>> jtreg on linux_x64
>>> vm.quick on linux_x64
>>>
>>> Webrev: http://cr.openjdk.java.net/~ccheung/8014431/webrev/
>>> Bug: http://bugs.sun.com/view_bug.do?bug_id=8014431
>>>
>>> thanks,
>>> Calvin
>
More information about the hotspot-runtime-dev
mailing list