Patch - Add restrict to sys/time.h
Joel Sherrill
joel.sherrill@oarcorp.com
Fri Nov 22 22:53:00 GMT 2013
There is a typo in this patch. See v2 attached.
Is v2 OK to commit?
And .. v1 accidentally changed _gettimeofday to
gettimeofday in the prototype. Which makes me
ask if the system call _gettimeofday should
have restrict added?
It appears in 44 files in libgloss and libc
if that helps the decision.
On 11/22/2013 4:45 PM, Joel Sherrill wrote:
> Hi
>
> Another in the adding restrict keyword series from
> Google Code-In Students.
>
> OK to commit?
>
> 2013-11-22 Bryan Dunsmore <dunsmoreb@gmail.com>
>
> * libc/include/sys/time.h (gettimeofday): Add restrict keyword.
> (setitimer): Likewise.
> * libc/sys/rdos/gettod.c (gettimeofday): Likewise.
> * libc/sys/rtems/crt0.c (gettimeofday): Likewise.
>
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
-------------- next part --------------
Index: libc/include/sys/time.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/time.h,v
retrieving revision 1.17
diff -u -r1.17 time.h
--- libc/include/sys/time.h 12 Nov 2012 15:57:35 -0000 1.17
+++ libc/include/sys/time.h 22 Nov 2013 22:50:25 -0000
@@ -74,12 +74,13 @@
int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz));
#endif
-int _EXFUN(gettimeofday, (struct timeval *__p, void *__tz));
+int _EXFUN(gettimeofday, (struct timeval *__restrict __p,
+ void *__restrict __tz));
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp));
int _EXFUN(getitimer, (int __which, struct itimerval *__value));
-int _EXFUN(setitimer, (int __which, const struct itimerval *__value,
- struct itimerval *__ovalue));
+int _EXFUN(setitimer, (int __which, const struct itimerval *__restrict __value,
+ struct itimerval *__restrict __ovalue));
#ifdef __cplusplus
}
Index: libc/sys/rdos/gettod.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/rdos/gettod.c,v
retrieving revision 1.3
diff -u -r1.3 gettod.c
--- libc/sys/rdos/gettod.c 21 Nov 2013 19:27:17 -0000 1.3
+++ libc/sys/rdos/gettod.c 22 Nov 2013 22:50:26 -0000
@@ -8,7 +8,8 @@
struct timeval;
struct timezone;
-int gettimeofday(struct timeval *ptimeval, void *ptimezone)
+int gettimeofday(struct timeval *__restrict ptimeval,
+ void *__restrict ptimezone)
{
errno = ENOSYS;
return -1;
Index: libc/sys/rtems/crt0.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/rtems/crt0.c,v
retrieving revision 1.14
diff -u -r1.14 crt0.c
--- libc/sys/rtems/crt0.c 9 May 2012 09:03:06 -0000 1.14
+++ libc/sys/rtems/crt0.c 22 Nov 2013 22:50:26 -0000
@@ -59,7 +59,7 @@
RTEMS_STUB(int, fstat(int fd, struct stat *buf), { return -1; })
RTEMS_STUB(int, getdents(int fd, void *dp, int count), { return -1; })
RTEMS_STUB(char *, getlogin(void), { return 0; })
-RTEMS_STUB(int, gettimeofday(struct timeval *tv, struct timezone *tz), { return -1; })
+RTEMS_STUB(int, gettimeofday(struct timeval *__restrict tv, struct timezone *__restrict tz), { return -1; })
RTEMS_STUB(struct passwd *, getpwnam(const char *name), { return 0; })
RTEMS_STUB(struct passwd *, getpwuid(uid_t uid), { return 0; })
RTEMS_STUB(uid_t, getuid(void), { return 0; })
More information about the Newlib
mailing list