JDK-6879689 : Fix warning about ignored return value when compiling with -O2
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-09-08
  • Updated: 2012-10-08
  • Resolved: 2010-04-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
OpenJDK6 b19Fixed
Description
/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

The fwrite library call is marked as requiring a warning if the return value is ignored. More recent gcc's can disable this via -Wno-unused-result but in general this warning will be issued and as we build with -Werror the warning becomes an error. So we need to avoid the warning.

Comments
PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk6/jdk6/hotspot/rev/6ee696377676
07-04-2010

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/5fdbe2cdf565
25-09-2009

EVALUATION See description. We can use the return value in an assert that checks for success of the fwrite call. We also switch the "size" and "nitems" parameters to fwrite to give a more meaningful size comparison.
08-09-2009

SUGGESTED FIX http://cr.openjdk.java.net/~andrew/werror/webrev.02/
08-09-2009