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

Christian Thalinger Christian.Thalinger at Sun.COM
Tue Sep 8 01:16:11 PDT 2009


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


More information about the hotspot-dev mailing list