[cp-patches] RFC: fix warning in cpio_df

Robert Schuster theBohemian at gmx.net
Thu Nov 8 15:44:55 UTC 2007


Hi.

Mario Torre schrieb:
> Il giorno gio, 08/11/2007 alle 13.06 +0100, Mark Wielaard ha scritto:
>> Hi Robert,
>>
>> On Wed, 2007-11-07 at 22:13 +0100, Robert Schuster wrote:
>>> this patch marks the parameters of cpio_df as possibly unused and
>>> silents the warning/lets the build continue with -Wall.
>> Which system is this?
>> I am not really opposed to the patch, but it would of course be better
>> to figure out how to correctly return something for your setup if at all
>> possible.
> 
> Yes, please, I had troubles figuring out this.
> 
> As for the patch, I did that way to catch exactly the systems where no
> statvfs is available.
> 
> Can you try using statfs? If it's a system where df is available we can
> try to steal some code from there also.
This is Debian Lenny/Sid x86. I am not sure whether it is normal that
statvfs is not available on it but even then I think the problem is more
a tiny glitch in the code:

JNIEXPORT long long
cpio_df (const char *path, CPFILE_DF_TYPE type)
{
  long long result = 0L;

#if defined(HAVE_STATVFS)

  ... much stuff

#endif

  return result;
}

Now if HAVE_STATVFS is not defined the compiler is correct mourning that
'path' and 'type' are not used. I have seen code (in classpath) where
this issue is solved this way:

JNIEXPORT long long
cpio_df (const char *path, CPFILE_DF_TYPE type)
{
  long long result = 0L;

#if defined(HAVE_STATVFS)

  ... much stuff
#else

 (void) path;
 (void) type;

#endif

  return result;
}

See Java_gnu_java_nio_KqueueSelectorImpl_kevent_1set for example.

Regards
Robert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20071108/b37b0dba/signature.pgp


More information about the Classpath-patches mailing list