[PATCH FOR REVIEW]: Fix warning in src/share/vm/adlc/archDesc.cpp

Andrew John Hughes gnu_andrew at member.fsf.org
Sun Sep 6 06:40:14 PDT 2009

2009/9/5 David Holmes - Sun Microsystems <David.Holmes at sun.com>:
> Christian Thalinger said the following on 09/05/09 18:59:
>> Well, looking more closely it's actually a system header attribute that
>> brings up that warning:
>> /mnt/builder/icedtea7/openjdk-ecj/hotspot/src/share/vm/adlc/archDesc.cpp:1034:
>> error: ignoring return value of 'size_t fwrite(const void*, size_t,
>> size_t, FILE*)', declared with attribute warn_unused_result
>> And it seems there is no GCC switch to turn that warning off (except
>> -O0).  Maybe we should check for the written bytes to be the same as
>> requested:
>>  assert(count == size, "copyright info truncated");
> I recall this coming up in the past. gcc manual lists:
> -Wno-unused-result
> but that might be version specific.
> David

It's a very recent addition:


which means there is a period (which includes GCC 4.4) where the
warning is produced but can't be disabled :(

BTW, my current approach was influenced by
http://hg.openjdk.java.net/jdk7/jdk7/hotspot/rev/2328d1d3f8cf where
the same fix is applied to remove this warning.
I have to say I personally prefer twisti's assert fix and can apply
this if others are in agreement.
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

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