Throughout, keep function definitions and declarations in sync with
newlib in terms of C99 "restrict" keyword.
This commit is contained in:
parent
bd1af1cab5
commit
3073f26d6a
|
@ -1,3 +1,8 @@
|
|||
2013-11-25 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
Throughout, keep function definitions and declarations in sync with
|
||||
newlib in terms of C99 "restrict" keyword.
|
||||
|
||||
2013-11-24 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dtable.cc: Include sys/param.h for MAX definition.
|
||||
|
|
|
@ -177,7 +177,7 @@ readdir (DIR *dir)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
readdir_r (DIR *dir, dirent *de, dirent **ode)
|
||||
readdir_r (DIR *__restrict dir, dirent *__restrict de, dirent **__restrict ode)
|
||||
{
|
||||
int res = readdir_worker (dir, de);
|
||||
if (!res)
|
||||
|
|
|
@ -186,7 +186,7 @@ static void qprintf(const char *, Char *);
|
|||
#endif
|
||||
|
||||
int
|
||||
glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
|
||||
glob(const char *__restrict pattern, int flags, int (*errfunc)(const char *, int), glob_t *__restrict pglob)
|
||||
{
|
||||
const char *patnext;
|
||||
size_t limit;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* cygwin/stat.h
|
||||
|
||||
Copyright 2002, 2007, 2010 Red Hat Inc.
|
||||
Copyright 2002, 2007, 2010, 2013 Red Hat Inc.
|
||||
Written by Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
@ -56,8 +56,10 @@ struct __stat32
|
|||
#endif
|
||||
|
||||
extern int fstat64 (int fd, struct stat *buf);
|
||||
extern int stat64 (const char *file_name, struct stat *buf);
|
||||
extern int lstat64 (const char *file_name, struct stat *buf);
|
||||
extern int stat64 (const char *__restrict file_name,
|
||||
struct stat *__restrict buf);
|
||||
extern int lstat64 (const char *__restrict file_name,
|
||||
struct stat *__restrict buf);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ __BEGIN_DECLS
|
|||
# define DLLEXPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
int DLLEXPORT glob (const char *, int, int (*)(const char *, int), glob_t *);
|
||||
int DLLEXPORT glob (const char __restrict *, int, int (*)(const char *, int), glob_t *__restrict);
|
||||
void DLLEXPORT globfree (glob_t *);
|
||||
int DLLEXPORT glob_pattern_p (const char *, int);
|
||||
__END_DECLS
|
||||
|
|
|
@ -65,7 +65,8 @@ typedef struct __DIR
|
|||
DIR *opendir (const char *);
|
||||
DIR *fdopendir (int);
|
||||
struct dirent *readdir (DIR *);
|
||||
int readdir_r (DIR *, struct dirent *, struct dirent **);
|
||||
int readdir_r (DIR * __restrict, struct dirent * __restrict,
|
||||
struct dirent ** __restrict);
|
||||
void rewinddir (DIR *);
|
||||
int closedir (DIR *);
|
||||
|
||||
|
|
|
@ -763,7 +763,8 @@ literal:
|
|||
}
|
||||
|
||||
char *
|
||||
strptime (const char *buf, const char *fmt, struct tm *tm)
|
||||
strptime (const char *__restrict buf, const char *__restrict fmt,
|
||||
struct tm *__restrict tm)
|
||||
{
|
||||
era_info_t *era_info = NULL;
|
||||
alt_digits_t *alt_digits = NULL;
|
||||
|
|
|
@ -1749,7 +1749,7 @@ localsub(const timezone_t sp, const time_t * const timep, const long offset,
|
|||
** Re-entrant version of localtime.
|
||||
*/
|
||||
extern "C" struct tm *
|
||||
localtime_r(const time_t *timep, struct tm *tmp)
|
||||
localtime_r(const time_t *__restrict timep, struct tm *__restrict tmp)
|
||||
{
|
||||
tzset_guard.init ("tzset_guard")->acquire ();
|
||||
tzset_unlocked();
|
||||
|
@ -1820,7 +1820,7 @@ gmtime(const time_t *const timep)
|
|||
*/
|
||||
|
||||
extern "C" struct tm *
|
||||
gmtime_r(const time_t * const timep, struct tm *tmp)
|
||||
gmtime_r(const time_t *__restrict const timep, struct tm *__restrict tmp)
|
||||
{
|
||||
tmp = gmtsub(NULL, timep, 0L, tmp);
|
||||
|
||||
|
|
|
@ -793,7 +793,7 @@ memset (void *s, int c, size_t n)
|
|||
}
|
||||
|
||||
extern "C" void *
|
||||
memcpy(void *dest, const void *src, size_t n)
|
||||
memcpy(void *__restrict dest, const void *__restrict src, size_t n)
|
||||
{
|
||||
RtlCopyMemory (dest, src, n);
|
||||
return dest;
|
||||
|
|
|
@ -2989,7 +2989,7 @@ symlink_info::set (char *path)
|
|||
/* readlink system call */
|
||||
|
||||
extern "C" ssize_t
|
||||
readlink (const char *path, char *buf, size_t buflen)
|
||||
readlink (const char *__restrict path, char *__restrict buf, size_t buflen)
|
||||
{
|
||||
if (buflen < 0)
|
||||
{
|
||||
|
@ -3413,7 +3413,7 @@ cygwin_conv_to_full_posix_path (const char *path, char *posix_path)
|
|||
/* The realpath function is required by POSIX:2008. */
|
||||
|
||||
extern "C" char *
|
||||
realpath (const char *path, char *resolved)
|
||||
realpath (const char *__restrict path, char *__restrict resolved)
|
||||
{
|
||||
/* Make sure the right errno is returned if path is NULL. */
|
||||
if (!path)
|
||||
|
|
|
@ -681,7 +681,7 @@ sys_mbstowcs_alloc (wchar_t **dst_p, int type, const char *src, size_t nms)
|
|||
NUL-terminate the destination string (s1).
|
||||
Return pointer to terminating byte in dst string. */
|
||||
char * __stdcall
|
||||
strccpy (char *s1, const char **s2, char c)
|
||||
strccpy (char *__restrict s1, const char **__restrict s2, char c)
|
||||
{
|
||||
while (**s2 && **s2 != c)
|
||||
*s1++ = *((*s2)++);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* string.h: Extra string defs
|
||||
|
||||
Copyright 2001, 2002, 2003, 2007, 2008, 2011, 2012 Red Hat, Inc.
|
||||
Copyright 2001, 2002, 2003, 2007, 2008, 2011, 2012, 2013 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
|
@ -89,7 +89,8 @@ char * __stdcall cygwin_strupr (char *);
|
|||
|
||||
#endif /* __INSIDE_CYGWIN__ */
|
||||
|
||||
char *__stdcall strccpy (char *s1, const char **s2, char c);
|
||||
char *__stdcall strccpy (char *__restrict s1, const char **__restrict s2,
|
||||
char c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1885,7 +1885,7 @@ stat_worker (path_conv &pc, struct stat *buf)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
stat64 (const char *name, struct stat *buf)
|
||||
stat64 (const char *__restrict name, struct stat *__restrict buf)
|
||||
{
|
||||
syscall_printf ("entering");
|
||||
path_conv pc (name, PC_SYM_FOLLOW | PC_POSIX | PC_KEEP_HANDLE,
|
||||
|
@ -1894,7 +1894,8 @@ stat64 (const char *name, struct stat *buf)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
_stat64_r (struct _reent *ptr, const char *name, struct stat *buf)
|
||||
_stat64_r (struct _reent *__restrict ptr, const char *__restrict name,
|
||||
struct stat *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1908,7 +1909,7 @@ EXPORT_ALIAS (stat64, stat)
|
|||
EXPORT_ALIAS (_stat64_r, _stat_r)
|
||||
#else
|
||||
extern "C" int
|
||||
stat (const char *name, struct stat *buf)
|
||||
stat (const char *__restrict name, struct stat *__restrict buf)
|
||||
{
|
||||
struct stat buf64;
|
||||
int ret = stat64 (name, &buf64);
|
||||
|
@ -1918,7 +1919,8 @@ stat (const char *name, struct stat *buf)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
_stat_r (struct _reent *ptr, const char *name, struct stat *buf)
|
||||
_stat_r (struct _reent *__restrict ptr, const char *__restrict name,
|
||||
struct stat *__restrict buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1930,7 +1932,7 @@ _stat_r (struct _reent *ptr, const char *name, struct stat *buf)
|
|||
|
||||
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
|
||||
extern "C" int
|
||||
lstat64 (const char *name, struct stat *buf)
|
||||
lstat64 (const char *__restrict name, struct stat *__restrict buf)
|
||||
{
|
||||
syscall_printf ("entering");
|
||||
path_conv pc (name, PC_SYM_NOFOLLOW | PC_POSIX | PC_KEEP_HANDLE,
|
||||
|
@ -1943,7 +1945,7 @@ EXPORT_ALIAS (lstat64, lstat)
|
|||
#else
|
||||
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
|
||||
extern "C" int
|
||||
lstat (const char *name, struct stat *buf)
|
||||
lstat (const char *__restrict name, struct stat *__restrict buf)
|
||||
{
|
||||
struct stat buf64;
|
||||
int ret = lstat64 (name, &buf64);
|
||||
|
@ -4462,7 +4464,8 @@ fchownat (int dirfd, const char *pathname, uid_t uid, gid_t gid, int flags)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
fstatat (int dirfd, const char *pathname, struct stat *st, int flags)
|
||||
fstatat (int dirfd, const char *__restrict pathname, struct stat *__restrict st,
|
||||
int flags)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
|
@ -4592,7 +4595,8 @@ mknodat (int dirfd, const char *pathname, mode_t mode, dev_t dev)
|
|||
}
|
||||
|
||||
extern "C" ssize_t
|
||||
readlinkat (int dirfd, const char *pathname, char *buf, size_t bufsize)
|
||||
readlinkat (int dirfd, const char *__restrict pathname, char *__restrict buf,
|
||||
size_t bufsize)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
myfault efault;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* timer.cc
|
||||
|
||||
Copyright 2004, 2005, 2006, 2008, 2010, 2011, 2012 Red Hat, Inc.
|
||||
Copyright 2004, 2005, 2006, 2008, 2010, 2011, 2012, 2013 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
|
@ -295,7 +295,8 @@ timer_gettime (timer_t timerid, struct itimerspec *ovalue)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
|
||||
timer_create (clockid_t clock_id, struct sigevent *__restrict evp,
|
||||
timer_t *__restrict timerid)
|
||||
{
|
||||
myfault efault;
|
||||
if (efault.faulted (EFAULT))
|
||||
|
@ -318,8 +319,9 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
|
|||
}
|
||||
|
||||
extern "C" int
|
||||
timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
|
||||
struct itimerspec *ovalue)
|
||||
timer_settime (timer_t timerid, int flags,
|
||||
const struct itimerspec *__restrict value,
|
||||
struct itimerspec *__restrict ovalue)
|
||||
{
|
||||
timer_tracker *tt = (timer_tracker *) timerid;
|
||||
myfault efault;
|
||||
|
@ -374,7 +376,8 @@ fixup_timers_after_fork ()
|
|||
|
||||
|
||||
extern "C" int
|
||||
setitimer (int which, const struct itimerval *value, struct itimerval *ovalue)
|
||||
setitimer (int which, const struct itimerval *__restrict value,
|
||||
struct itimerval *__restrict ovalue)
|
||||
{
|
||||
int ret;
|
||||
if (which != ITIMER_REAL)
|
||||
|
|
|
@ -158,7 +158,7 @@ totimeval (struct timeval *dst, PLARGE_INTEGER src, int sub, int flag)
|
|||
|
||||
/* FIXME: Make thread safe */
|
||||
extern "C" int
|
||||
gettimeofday (struct timeval *tv, void *tzvp)
|
||||
gettimeofday (struct timeval *__restrict tv, void *__restrict tzvp)
|
||||
{
|
||||
struct timezone *tz = (struct timezone *) tzvp;
|
||||
static bool tzflag;
|
||||
|
|
Loading…
Reference in New Issue