]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Fix compiler warning on some syscalls
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Tue, 6 Jan 2015 12:59:04 +0000 (07:59 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Thu, 8 Jan 2015 13:03:31 +0000 (08:03 -0500)
GCC 5.0 emits an warning when using sizeof on array function parameters
and powerpc internal syscall macros add a check for such cases.  More
specifically, on powerpc64 and powerpc32 sysdep.h:

  if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \
          __illegally_sized_syscall_arg3 (); \

And for sysdeps/unix/sysv/linux/utimensat.c build GCC emits:

error: ‘sizeof’ on array function parameter ‘tsp’ will return size of
‘const struct timespec *’

This patch uses the address of first struct member instead of the struct
itself in syscall macro.

ChangeLog
sysdeps/unix/sysv/linux/futimens.c
sysdeps/unix/sysv/linux/futimesat.c
sysdeps/unix/sysv/linux/utimensat.c
sysdeps/unix/sysv/linux/utimes.c

index 9066946203d22df7d63e082285fac477a83d5e2d..962ec2655051bdf86673b82dc012c0c5424057ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-08  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
+       * 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.
+
 2015-01-07  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #17748]
index c7d03a8f7c862e2b5812602fcd12309fa99fa884..5f2b8a56cd7fd554f0cce278b56685270fdcf9c0 100644 (file)
@@ -37,7 +37,8 @@ futimens (int fd, const struct timespec tsp[2])
       __set_errno (EBADF);
       return -1;
     }
-  return INLINE_SYSCALL (utimensat, 4, fd, NULL, tsp, 0);
+  /* Avoid implicit array coercion in syscall macros.  */
+  return INLINE_SYSCALL (utimensat, 4, fd, NULL, &tsp[0], 0);
 #else
   __set_errno (ENOSYS);
   return -1;
index ac96e2af3971b200dea5a40528f93c9bab129840..27d68702e1d1a813c617837742c23c16648b3eae 100644 (file)
 /* 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);
+  /* Avoid implicit array coercion in syscall macros.  */
+  return INLINE_SYSCALL (futimesat, 3, fd, file, &tvp[0]);
 }
index 5a5dec7f8edfbe9792af9f71ac9b294e2737d3dd..81b565f2ea2bcd4df558cbd1ce6734dfbcb5ce05 100644 (file)
@@ -35,7 +35,8 @@ 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);
+  /* Avoid implicit array coercion in syscall macros.  */
+  return INLINE_SYSCALL (utimensat, 4, fd, file, &tsp[0], flags);
 #else
   __set_errno (ENOSYS);
   return -1;
index 5423ff200ff1dbdb4d8d0e8494fa4fb12d640f4d..2a1f2f90a10fa6d0c19ba1d6c92f4cb417127549 100644 (file)
@@ -29,7 +29,8 @@
 int
 __utimes (const char *file, const struct timeval tvp[2])
 {
-  return INLINE_SYSCALL (utimes, 2, file, tvp);
+  /* Avoid implicit array coercion in syscall macros.  */
+  return INLINE_SYSCALL (utimes, 2, file, &tvp[0]);
 }
 
 weak_alias (__utimes, utimes)