fix hotspot build failures with -D_FORTIFY_SOURCE=2 and -Wformat=1

Matthias Klose doko at ubuntu.com
Wed Dec 3 04:38:27 PST 2008


Christian Thalinger schrieb:
> On Tue, 2008-12-02 at 18:12 +0100, Matthias Klose wrote:
>> --- openjdk/hotspot/src/share/vm/prims/jvm.cpp~ 2008-11-20
>> 09:41:05.000000000 +0100
>> +++ openjdk/hotspot/src/share/vm/prims/jvm.cpp  2008-12-02
>> 16:55:32.000000000 +0100
>> @@ -2474,7 +2474,7 @@
>>    if (Arguments::vfprintf_hook() != NULL) {
>>      jio_fprintf(defaultStream::output_stream(), "%s", s);
>>    } else {
>> -    ::write(defaultStream::output_fd(), s, (int)strlen(s));
>> +    ssize_t rv = ::write(defaultStream::output_fd(), s,
>> (int)strlen(s));
>>    }
>>  }
> 
> David and Kelly already answered what I wanted to say, but as I still
> have this compose window open since yesterday... :-)
> 
> I would also prefer the void cast here as it would be much clearer for
> the unexperienced reader.

a void cast doesn't help. collected some suggestions, and the "best" seems to be

  ssize_t rv_neverused __attribute__((unused)) = ...

although this file cannot be built with -Wunused or -Wunused-variable anyway.

  Matthias




More information about the distro-pkg-dev mailing list