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

Andrew John Hughes gnu_andrew at member.fsf.org
Tue Sep 8 06:50:18 PDT 2009


2009/9/8 Christian Thalinger <Christian.Thalinger at sun.com>:
> David Schlosnagle wrote:
>> Is it worthwhile to change the method signature to better identify its
>> arguments?
>>
>> void ArchDesc::addSunCopyright(const char* legal, size_t size, FILE *fp) {
>>     size_t count = fwrite(legal, sizeof(char), size, fp);
>>     assert(count == size);
>>     fprintf(fp,"\n");
>>     fprintf(fp,"// Machine Generated File.  Do Not Edit!\n");
>>     fprintf(fp,"\n");
>> }
>>
>>
>> Its a slippery slope to start checking the return values on those I/O
>> functions, and it doesn't look like anything else in that file is
>> checking them. I'm definitely not the right person to say whether the
>> assert is the proper error handling for this situation, but I'd assume
>> the user should know that the files weren't able to be written (most
>> likely due to some larger I/O problem) rather than fail silently.
>
> I'm not the right person too, as I'm too new to this.  But checking a
> return value can't be too bad and if a build fails somewhere then we
> have a problem anyway.  Additionally a truncated or bad generated file
> is likely to fail when we want to build it.
>
> -- Christian
>

I pushed this, with a size_t cast to be on the safe side:

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/5fdbe2cdf565

Thanks to everyone who reviewed/commented on this,
-- 
Andrew :-)

Free Java 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