Fix warnings occurring with gcc 4.3
Andrew John Hughes
gnu_andrew at member.fsf.org
Tue Feb 3 18:43:12 PST 2009
009/2/4 Xiaobin Lu <Xiaobin.Lu at sun.com>:
> On 02/03/09 16:41, David Holmes - Sun Microsystems wrote:
>>
>> Hi Xiaobin,
>>
>> I'm a bit confused about VMError because internally _lineno is now (not
>> sure when it changed) defined as size_t but all the constructors that take a
>> lineno argument take an int ?? So why bother with size_t?
>>
>> But if it is meant to be size_t then you also need to fix this at line
>> 200:
>>
>> jio_snprintf(buf, buflen,
>> "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT " \nError:
>> %s",
>> p ? p + 1 : _filename, _lineno,
>> os::current_process_id(), os::current_thread_id(),
>> _message ? _message : "");
>
> I think the right way to fix this is to define _lineno as "int" and fix line
> 309 of vmError.cpp to use "%d" for _lineno instead of "SIZE_FORMAT" (which
> is why I thought to use size_t for _lineno). It is strange I didn't get
> error message for the above statement on 64 bit Linux.
>
> -Xiaobin
>>
>> Cheers,
>> David Holmes
>>
>> Xiaobin Lu said the following on 02/04/09 09:56:
>>>
>>> On 02/03/09 15:12, Vladimir Kozlov wrote:
>>>>
>>>> 6778669. Still in Dispatched state.
>>>
>>> The problem mentioned in Andrew's patch has actually been fixed recently
>>> by Coleen and me. I don't have Redhat machine around, but I can build
>>> hotspot successfully with latest fedora 10 release.
>>>
>>> -Xiaobin
>>>>
>>>> Vladimir
>>>>
>>>> Andrew John Hughes wrote:
>>>>>
>>>>> 2009/2/3 Xiaobin Lu <Xiaobin.Lu at sun.com>:
>>>>>>
>>>>>> On 02/03/09 14:24, Andrew John Hughes wrote:
>>>>>>
>>>>>> 2009/2/3 Xiaobin Lu <Xiaobin.Lu at sun.com>:
>>>>>>
>>>>>>
>>>>>> Did you check out the latest code? Those you pointed out have been
>>>>>> already
>>>>>> fixed.
>>>>>>
>>>>>> -Xiaobin
>>>>>>
>>>>>> On 02/03/09 12:30, Andrew John Hughes wrote:
>>>>>>
>>>>>>
>>>>>> A number of warnings are thrown when compiling the HotSpot code with
>>>>>> gcc 4.3, all of which are related to the incorrect use of printf
>>>>>> format specifiers. As HotSpot is built with -Werror, these cause the
>>>>>> build to fail. The attached patch against OpenJDK7 fixes them.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> They are not fixed in b45.
>>>>>>
>>>>>>
>>>>>> b45 is the latest promoted build. hg.openjdk.java.net/jdk7/hotspot
>>>>>> should
>>>>>> have those what you are trying to fix. Those will show up in the next
>>>>>> promotion build.
>>>>>>
>>>>>> -Xiaobin
>>>>>>
>>>>>>
>>>>>
>>>>> Good. We obviously don't build directly from the forest and it isn't
>>>>> clear that such changes are in that tree; the commit list just shows
>>>>> the branch being tagged.
>>>
>
>
This is how I fixed it in the patch I sent earlier (switching back to
'%d'), given _lineno is declared everywhere as int. It does fail on
x86_64 with gcc 4.3.3 and -Werror.
It looked to me like it might have been meant to be SIZE_FORMAT_W to
specify an integer of a certain width, but with no idea what that
width should be, I reverted it back to %d.
--
Andrew :-)
IcedTea/OpenJDK Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
More information about the hotspot-dev
mailing list