This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Fix compiler warning on some syscalls
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Tue, 06 Jan 2015 13:10:14 -0200
- Subject: Re: [PATCH] powerpc: Fix compiler warning on some syscalls
- Authentication-results: sourceware.org; auth=none
- References: <54ABDECE dot 3030306 at linux dot vnet dot ibm dot com> <87387ot233 dot fsf at igel dot home>
On 06-01-2015 12:29, Andreas Schwab wrote:
> Adhemerval Zanella <azanella@linux.vnet.ibm.com> writes:
>
>> diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
>> index ac96e2a..f7d5645 100644
>> --- a/sysdeps/unix/sysv/linux/futimesat.c
>> +++ b/sysdeps/unix/sysv/linux/futimesat.c
>> @@ -28,13 +28,13 @@
>> /* Change the access time of FILE relative to FD to TVP[0] and
>> the modification time of FILE to TVP[1]. */
>> int
>> -futimesat (fd, file, tvp)
>> - int fd;
>> - const char *file;
>> - const struct timeval tvp[2];
>> +futimesat (int fd, const char *file, const struct timeval tvp[2])
>> {
>> if (file == NULL)
>> return __futimes (fd, tvp);
>>
>> - return INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
>> + /* Some archs (powerpc) add arguments type and size check using sizeof
>> + and without a cast the compiler might emit an warning about using
>> + sizeof on a struct (where the builtin returns the pointer size). */
>> + return INLINE_SYSCALL (futimesat, 3, fd, file, (const struct timeval*)tvp);
> Does &tvp[0] work instead?
>
> Andreas.
>
It does and I think using would not require an explicit comment about it
usage. Would it be a preferable solution?