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: libc-alpha at sourceware dot org
- Date: Tue, 06 Jan 2015 15:06:23 -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> <54ABFAD6 dot 8020008 at linux dot vnet dot ibm dot com> <54AC0560 dot 60707 at cs dot ucla dot edu>
On 06-01-2015 13:55, Paul Eggert wrote:
> On 01/06/2015 07:10 AM, Adhemerval Zanella wrote:
>>> 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?
>>
>
> Absolutely. Casts are too powerful and can get one into trouble too easily.
>
Fair enough, is it ok now for push?
--
* sysdeps/unix/sysv/linux/futimens.c (futimens): Use address of first
timespec struct member in syscall macro.
* sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise.
* sysdeps/unix/sysv/linux/futimesat.c (futimesat): Use address of
first timeval struct member in syscall macro.
* sysdeps/unix/sysv/linux/utimes.c (__utimeS): Likewise.
--
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index c7d03a8..1dda738f 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -37,7 +37,7 @@ futimens (int fd, const struct timespec tsp[2])
__set_errno (EBADF);
return -1;
}
- return INLINE_SYSCALL (utimensat, 4, fd, NULL, tsp, 0);
+ return INLINE_SYSCALL (utimensat, 4, fd, NULL, &tsp[0], 0);
#else
__set_errno (ENOSYS);
return -1;
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index ac96e2a..e2cba1a 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -28,13 +28,10 @@
/* 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);
+ return INLINE_SYSCALL (futimesat, 3, fd, file, &tvp[0]);
}
diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c
index 5a5dec7..24fd13a 100644
--- a/sysdeps/unix/sysv/linux/utimensat.c
+++ b/sysdeps/unix/sysv/linux/utimensat.c
@@ -35,7 +35,7 @@ utimensat (int fd, const char *file, const struct timespec tsp[2],
return -1;
}
#ifdef __NR_utimensat
- return INLINE_SYSCALL (utimensat, 4, fd, file, tsp, flags);
+ return INLINE_SYSCALL (utimensat, 4, fd, file, &tsp[0], flags);
#else
__set_errno (ENOSYS);
return -1;
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index 5423ff2..8864e48 100644
--- a/sysdeps/unix/sysv/linux/utimes.c
+++ b/sysdeps/unix/sysv/linux/utimes.c
@@ -29,7 +29,7 @@
int
__utimes (const char *file, const struct timeval tvp[2])
{
- return INLINE_SYSCALL (utimes, 2, file, tvp);
+ return INLINE_SYSCALL (utimes, 2, file, &tvp[0]);
}
weak_alias (__utimes, utimes)