use restrict everywhere it's required by c99 and/or posix 2008
authorRich Felker <dalias@aerifal.cx>
Fri, 7 Sep 2012 02:44:55 +0000 (22:44 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 7 Sep 2012 02:44:55 +0000 (22:44 -0400)
to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.

192 files changed:
include/aio.h
include/arpa/inet.h
include/dirent.h
include/dlfcn.h
include/glob.h
include/iconv.h
include/inttypes.h
include/monetary.h
include/mqueue.h
include/netdb.h
include/pthread.h
include/regex.h
include/search.h
include/semaphore.h
include/signal.h
include/spawn.h
include/stdio.h
include/stdlib.h
include/string.h
include/sys/select.h
include/sys/socket.h
include/sys/stat.h
include/sys/statvfs.h
include/sys/time.h
include/time.h
include/unistd.h
include/wchar.h
include/wordexp.h
src/aio/lio_listio.c
src/dirent/readdir_r.c
src/ldso/dlsym.c
src/ldso/dynlink.c
src/locale/iconv.c
src/locale/strfmon.c
src/locale/strftime_l.c
src/locale/strxfrm.c
src/locale/strxfrm_l.c
src/locale/wcsxfrm.c
src/locale/wcsxfrm_l.c
src/misc/realpath.c
src/misc/wordexp.c
src/mq/mq_setattr.c
src/mq/mq_timedreceive.c
src/multibyte/mbrlen.c
src/multibyte/mbrtowc.c
src/multibyte/mbsnrtowcs.c
src/multibyte/mbsrtowcs.c
src/multibyte/mbstowcs.c
src/multibyte/mbtowc.c
src/multibyte/wcrtomb.c
src/multibyte/wcsnrtombs.c
src/multibyte/wcsrtombs.c
src/multibyte/wcstombs.c
src/network/accept.c
src/network/getaddrinfo.c
src/network/getnameinfo.c
src/network/getpeername.c
src/network/getsockname.c
src/network/getsockopt.c
src/network/inet_ntop.c
src/network/inet_pton.c
src/network/recvfrom.c
src/process/posix_spawn.c
src/process/posix_spawn_file_actions_addopen.c
src/process/posix_spawnattr_getflags.c
src/process/posix_spawnattr_getpgroup.c
src/process/posix_spawnattr_getsigdefault.c
src/process/posix_spawnattr_getsigmask.c
src/process/posix_spawnattr_setsigdefault.c
src/process/posix_spawnattr_setsigmask.c
src/process/posix_spawnp.c
src/regex/glob.c
src/regex/regcomp.c
src/regex/regerror.c
src/regex/regexec.c
src/select/pselect.c
src/select/select.c
src/signal/setitimer.c
src/signal/sigaction.c
src/signal/sigaltstack.c
src/signal/sigprocmask.c
src/signal/sigtimedwait.c
src/signal/sigwait.c
src/signal/sigwaitinfo.c
src/stat/fstatat.c
src/stat/lstat.c
src/stat/stat.c
src/stat/statvfs.c
src/stdio/dprintf.c
src/stdio/fgetpos.c
src/stdio/fgets.c
src/stdio/fgetws.c
src/stdio/fmemopen.c
src/stdio/fopen.c
src/stdio/fprintf.c
src/stdio/fputs.c
src/stdio/fputws.c
src/stdio/fread.c
src/stdio/freopen.c
src/stdio/fscanf.c
src/stdio/fwprintf.c
src/stdio/fwrite.c
src/stdio/fwscanf.c
src/stdio/getdelim.c
src/stdio/getline.c
src/stdio/printf.c
src/stdio/scanf.c
src/stdio/setbuf.c
src/stdio/setvbuf.c
src/stdio/snprintf.c
src/stdio/sprintf.c
src/stdio/sscanf.c
src/stdio/swprintf.c
src/stdio/swscanf.c
src/stdio/vdprintf.c
src/stdio/vfprintf.c
src/stdio/vfscanf.c
src/stdio/vfwprintf.c
src/stdio/vfwscanf.c
src/stdio/vprintf.c
src/stdio/vscanf.c
src/stdio/vsnprintf.c
src/stdio/vsprintf.c
src/stdio/vsscanf.c
src/stdio/vswprintf.c
src/stdio/vswscanf.c
src/stdio/vwprintf.c
src/stdio/vwscanf.c
src/stdio/wprintf.c
src/stdio/wscanf.c
src/stdlib/strtod.c
src/stdlib/strtol.c
src/stdlib/wcstod.c
src/stdlib/wcstol.c
src/string/memccpy.c
src/string/memcpy.c
src/string/stpcpy.c
src/string/stpncpy.c
src/string/strcat.c
src/string/strcpy.c
src/string/strncat.c
src/string/strncpy.c
src/string/strtok.c
src/string/strtok_r.c
src/string/swab.c
src/string/wcpcpy.c
src/string/wcpncpy.c
src/string/wcscat.c
src/string/wcscpy.c
src/string/wcsncat.c
src/string/wcsncpy.c
src/string/wcsstr.c
src/string/wcstok.c
src/string/wmemcpy.c
src/thread/pthread_attr_getguardsize.c
src/thread/pthread_attr_getschedparam.c
src/thread/pthread_attr_getscope.c
src/thread/pthread_attr_getstack.c
src/thread/pthread_attr_getstacksize.c
src/thread/pthread_attr_setschedparam.c
src/thread/pthread_barrier_init.c
src/thread/pthread_barrierattr_getpshared.c
src/thread/pthread_cond_init.c
src/thread/pthread_cond_timedwait.c
src/thread/pthread_cond_wait.c
src/thread/pthread_condattr_getclock.c
src/thread/pthread_condattr_getpshared.c
src/thread/pthread_create.c
src/thread/pthread_mutex_init.c
src/thread/pthread_mutex_timedlock.c
src/thread/pthread_mutexattr_getpshared.c
src/thread/pthread_mutexattr_getrobust.c
src/thread/pthread_mutexattr_gettype.c
src/thread/pthread_rwlock_init.c
src/thread/pthread_rwlock_timedrdlock.c
src/thread/pthread_rwlock_timedwrlock.c
src/thread/pthread_rwlockattr_getpshared.c
src/thread/pthread_sigmask.c
src/thread/sem_getvalue.c
src/thread/sem_timedwait.c
src/time/__asctime.c
src/time/asctime_r.c
src/time/gettimeofday.c
src/time/gmtime_r.c
src/time/localtime_r.c
src/time/strftime.c
src/time/strptime.c
src/time/timer_create.c
src/time/timer_settime.c
src/time/wcsftime.c
src/unistd/readlink.c
src/unistd/readlinkat.c

index 2edd5a2..3e35134 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #include <signal.h>
 #include <time.h>
 
@@ -46,7 +52,7 @@ int aio_cancel(int, struct aiocb *);
 int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
 int aio_fsync(int, struct aiocb *);
 
-int lio_listio(int, struct aiocb *const [], int, struct sigevent *);
+int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
 
 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
 #define aiocb64 aiocb
index b604f60..82e2ac1 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #include <netinet/in.h>
 #include <inttypes.h>
 
@@ -24,8 +30,8 @@ uint16_t ntohs(uint16_t);
 
 in_addr_t inet_addr (const char *);
 char *inet_ntoa (struct in_addr);
-int inet_pton (int, const char *, void *);
-const char *inet_ntop (int, const void *, char *, socklen_t);
+int inet_pton (int, const char *__restrict, void *__restrict);
+const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
 
 int inet_aton (const char *, struct in_addr *); /* nonstandard but widely used */
 
index c19f7d5..b626159 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_ino_t
 #define __NEED_off_t
 #ifdef _BSD_SOURCE
@@ -30,7 +36,7 @@ int            closedir(DIR *);
 DIR           *fdopendir(int);
 DIR           *opendir(const char *);
 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 *);
 void           seekdir(DIR *, long);
 long           telldir(DIR *);
index e98c8ca..2e7d028 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define RTLD_LAZY   1
 #define RTLD_NOW    2
 #define RTLD_GLOBAL 256
@@ -16,7 +22,7 @@ extern "C" {
 int    dlclose(void *);
 char  *dlerror(void);
 void  *dlopen(const char *, int);
-void  *dlsym(void *, const char *);
+void  *dlsym(void *__restrict, const char *__restrict);
 
 #ifdef _GNU_SOURCE
 typedef struct {
index 376baa7..c49a2de 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 
 #include <bits/alltypes.h>
@@ -17,7 +23,7 @@ typedef struct {
        void *__dummy2[5];
 } glob_t;
 
-int  glob(const char *, int, int (*)(const char *, int), glob_t *);
+int  glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict);
 void globfree(glob_t *);
 
 #define GLOB_ERR      0x01
index f2ccaf8..cef06f6 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 
 #include <bits/alltypes.h>
@@ -12,7 +18,7 @@ extern "C" {
 typedef void *iconv_t;
 
 iconv_t iconv_open(const char *, const char *);
-size_t iconv(iconv_t, char **, size_t *, char **, size_t *);
+size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict);
 int iconv_close(iconv_t);
 
 #ifdef __cplusplus
index 13ba6e0..23acc5b 100644 (file)
@@ -10,16 +10,22 @@ extern "C" {
 #define __NEED_wchar_t
 #include <bits/alltypes.h>
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 typedef struct { intmax_t quot, rem; } imaxdiv_t;
 
 intmax_t imaxabs(intmax_t);
 imaxdiv_t imaxdiv(intmax_t, intmax_t);
 
-intmax_t strtoimax(const char *, char **, int);
-uintmax_t strtoumax(const char *, char **, int);
+intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
 
-intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
-uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
+intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
 
 #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
 
index df904eb..11dabb2 100644 (file)
@@ -5,14 +5,20 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_ssize_t
 #define __NEED_size_t
 #define __NEED_locale_t
 
 #include <bits/alltypes.h>
 
-ssize_t strfmon(char *, size_t, const char *, ...);
-ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...);
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
 
 #ifdef __cplusplus
 }
index 92e6ae5..bd35842 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 #define __NEED_ssize_t
 #define __NEED_pthread_attr_t
@@ -23,8 +29,8 @@ int mq_notify(mqd_t, const struct sigevent *);
 mqd_t mq_open(const char *, int, ...);
 ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
 int mq_send(mqd_t, const char *, size_t, unsigned);
-int mq_setattr(mqd_t, const struct mq_attr *, struct mq_attr *);
-ssize_t mq_timedreceive(mqd_t, char *, size_t, unsigned *, const struct timespec *);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict);
 int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *);
 int mq_unlink(const char *);
 
index 42a4b68..d915d9d 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #define __NEED_size_t
 #endif
@@ -55,9 +61,9 @@ struct addrinfo
 #define EAI_SYSTEM     -11
 #define EAI_OVERFLOW   -12
 
-int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **);
+int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
 void freeaddrinfo (struct addrinfo *);
-int getnameinfo (const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);
+int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
 const char *gai_strerror(int);
 
 
index d4ffb9a..417156c 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_time_t
 #define __NEED_clockid_t
 #define __NEED_struct_timespec
@@ -71,7 +77,7 @@ extern "C" {
 #define PTHREAD_BARRIER_SERIAL_THREAD (-1)
 
 
-int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *);
+int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
 int pthread_detach(pthread_t);
 void pthread_exit(void *);
 int pthread_join(pthread_t, void **);
@@ -91,29 +97,29 @@ int pthread_cancel(pthread_t);
 
 int pthread_once(pthread_once_t *, void (*)(void));
 
-int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
+int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
 int pthread_mutex_lock(pthread_mutex_t *);
 int pthread_mutex_unlock(pthread_mutex_t *);
 int pthread_mutex_trylock(pthread_mutex_t *);
-int pthread_mutex_timedlock(pthread_mutex_t *, const struct timespec *);
+int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
 int pthread_mutex_destroy(pthread_mutex_t *);
 int pthread_mutex_consistent(pthread_mutex_t *);
 
-int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
+int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
 int pthread_cond_destroy(pthread_cond_t *);
-int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
-int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *);
+int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
+int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
 int pthread_cond_broadcast(pthread_cond_t *);
 int pthread_cond_signal(pthread_cond_t *);
 
-int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
+int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
 int pthread_rwlock_destroy(pthread_rwlock_t *);
 int pthread_rwlock_rdlock(pthread_rwlock_t *);
 int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
-int pthread_rwlock_timedrdlock(pthread_rwlock_t *, const struct timespec *);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
 int pthread_rwlock_wrlock(pthread_rwlock_t *);
 int pthread_rwlock_trywrlock(pthread_rwlock_t *);
-int pthread_rwlock_timedwrlock(pthread_rwlock_t *, const struct timespec *);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
 int pthread_rwlock_unlock(pthread_rwlock_t *);
 
 int pthread_spin_init(pthread_spinlock_t *, int);
@@ -122,7 +128,7 @@ int pthread_spin_lock(pthread_spinlock_t *);
 int pthread_spin_trylock(pthread_spinlock_t *);
 int pthread_spin_unlock(pthread_spinlock_t *);
 
-int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *, unsigned);
+int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
 int pthread_barrier_destroy(pthread_barrier_t *);
 int pthread_barrier_wait(pthread_barrier_t *);
 
@@ -134,29 +140,29 @@ int pthread_setspecific(pthread_key_t, const void *);
 int pthread_attr_init(pthread_attr_t *);
 int pthread_attr_destroy(pthread_attr_t *);
 
-int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
+int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
 int pthread_attr_setguardsize(pthread_attr_t *, size_t);
-int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
+int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
 int pthread_attr_setstacksize(pthread_attr_t *, size_t);
 int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
 int pthread_attr_setdetachstate(pthread_attr_t *, int);
-int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *);
+int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
 int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
-int pthread_attr_getscope(const pthread_attr_t *, int *);
+int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
 int pthread_attr_setscope(pthread_attr_t *, int);
-int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
+int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
 int pthread_attr_setschedpolicy(pthread_attr_t *, int);
-int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *);
-int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *);
-int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
+int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
+int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
+int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
 int pthread_attr_setinheritsched(pthread_attr_t *, int);
 
 int pthread_mutexattr_destroy(pthread_mutexattr_t *);
-int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_getrobust(const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
 int pthread_mutexattr_init(pthread_mutexattr_t *);
 int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
@@ -168,16 +174,16 @@ int pthread_condattr_init(pthread_condattr_t *);
 int pthread_condattr_destroy(pthread_condattr_t *);
 int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
 int pthread_condattr_setpshared(pthread_condattr_t *, int);
-int pthread_condattr_getclock(const pthread_condattr_t *, clockid_t *);
-int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
 
 int pthread_rwlockattr_init(pthread_rwlockattr_t *);
 int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
 int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
-int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
 
 int pthread_barrierattr_destroy(pthread_barrierattr_t *);
-int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, int *);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
 int pthread_barrierattr_init(pthread_barrierattr_t *);
 int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
 
index d57208a..b7167b8 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 
 #include <bits/alltypes.h>
@@ -47,11 +53,11 @@ typedef struct {
 
 #define REG_ENOSYS      -1
 
-int regcomp(regex_t *, const char *, int);
-int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
+int regcomp(regex_t *__restrict, const char *__restrict, int);
+int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
 void regfree(regex_t *);
 
-size_t regerror(int, const regex_t *, char *, size_t);
+size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
 
 #ifdef __cplusplus
 }
index 7c4fc58..680eee7 100644 (file)
@@ -5,6 +5,13 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+
 #define __NEED_size_t
 #include <bits/alltypes.h>
 
@@ -28,7 +35,7 @@ void *lsearch(const void *, void *, size_t *, size_t,
 void *lfind(const void *, const void *, size_t *, size_t,
        int (*)(const void *, const void *));
 
-void *tdelete(const void *, void **, int(*)(const void *, const void *));
+void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
 void *tfind(const void *, void *const *, int(*)(const void *, const void *));
 void *tsearch(const void *, void **, int (*)(const void *, const void *));
 void twalk(const void *, void (*)(const void *, VISIT, int));
index 2e9b810..724957f 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_time_t
 #define __NEED_struct_timespec
 #include <bits/alltypes.h>
@@ -18,11 +24,11 @@ typedef struct {
 
 int    sem_close(sem_t *);
 int    sem_destroy(sem_t *);
-int    sem_getvalue(sem_t *, int *);
+int    sem_getvalue(sem_t *__restrict, int *__restrict);
 int    sem_init(sem_t *, int, unsigned);
 sem_t *sem_open(const char *, int, ...);
 int    sem_post(sem_t *);
-int    sem_timedwait(sem_t *, const struct timespec *);
+int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
 int    sem_trywait(sem_t *);
 int    sem_unlink(const char *);
 int    sem_wait(sem_t *);
index d4856a8..e0dae19 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
@@ -165,16 +171,16 @@ int sigaddset(sigset_t *, int);
 int sigdelset(sigset_t *, int);
 int sigismember(const sigset_t *, int);
 
-int sigprocmask(int, const sigset_t *, sigset_t *);
+int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
 int sigsuspend(const sigset_t *);
-int sigaction(int, const struct sigaction *, struct sigaction *);
+int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
 int sigpending(sigset_t *);
-int sigwait(const sigset_t *, int *);
-int sigwaitinfo(const sigset_t *, siginfo_t *);
-int sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *);
+int sigwait(const sigset_t *__restrict, int *__restrict);
+int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
+int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
 int sigqueue(pid_t, int, const union sigval);
 
-int pthread_sigmask(int, const sigset_t *, sigset_t *);
+int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
 int pthread_kill(pthread_t, int);
 
 void psiginfo(const siginfo_t *, const char *);
@@ -184,7 +190,7 @@ void psignal(int, const char *);
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
 int killpg(pid_t, int);
-int sigaltstack(const stack_t *, stack_t *);
+int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
 int sighold(int);
 int sigignore(int);
 int siginterrupt(int, int);
index 99ec6f1..c934d42 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_mode_t
 #define __NEED_pid_t
 #define __NEED_sigset_t
@@ -33,30 +39,30 @@ typedef struct {
        int __pad[16];
 } posix_spawn_file_actions_t;
 
-int posix_spawn(pid_t *, const char *, const posix_spawn_file_actions_t *,
-       const posix_spawnattr_t *, char *const [], char *const []);
-int posix_spawnp(pid_t *, const char *, const posix_spawn_file_actions_t *,
-       const posix_spawnattr_t *, char *const [], char *const []);
+int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+       const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+       const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
 
 int posix_spawnattr_init(posix_spawnattr_t *);
 int posix_spawnattr_destroy(posix_spawnattr_t *);
 
 int posix_spawnattr_setflags(posix_spawnattr_t *, short);
-int posix_spawnattr_getflags(const posix_spawnattr_t *, short *);
+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
 
 int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
-int posix_spawnattr_getpgroup(const posix_spawnattr_t *, pid_t *);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
 
-int posix_spawnattr_setsigmask(posix_spawnattr_t *, const sigset_t *);
-int posix_spawnattr_getsigmask(const posix_spawnattr_t *, sigset_t *);
+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
 
-int posix_spawnattr_setsigdefault(posix_spawnattr_t *, const sigset_t *);
-int posix_spawnattr_getsigdefault(const posix_spawnattr_t *, sigset_t *);
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
 
 int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
 int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
 
-int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *, int, const char *, int, mode_t);
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
 int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
 int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
 
index 9aa2f78..7d3130e 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_FILE
 #define __NEED_va_list
 #define __NEED_size_t
@@ -58,8 +64,8 @@ extern FILE *const stderr;
 #define stdout (stdout)
 #define stderr (stderr)
 
-FILE *fopen(const char *, const char *);
-FILE *freopen(const char *, const char *, FILE *);
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
 int fclose(FILE *);
 
 int remove(const char *);
@@ -74,11 +80,11 @@ int fseek(FILE *, long, int);
 long ftell(FILE *);
 void rewind(FILE *);
 
-int fgetpos(FILE *, fpos_t *);
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
 int fsetpos(FILE *, const fpos_t *);
 
-size_t fread(void *, size_t, size_t, FILE *);
-size_t fwrite(const void *, size_t, size_t, FILE *);
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
 
 int fgetc(FILE *);
 int getc(FILE *);
@@ -89,35 +95,35 @@ int fputc(int, FILE *);
 int putc(int, FILE *);
 int putchar(int);
 
-char *fgets(char *, int, FILE *);
+char *fgets(char *__restrict, int, FILE *__restrict);
 #if __STDC_VERSION__ < 201112L
 char *gets(char *);
 #endif
 
-int fputs(const char *, FILE *);
+int fputs(const char *__restrict, FILE *__restrict);
 int puts(const char *);
 
-int printf(const char *, ...);
-int fprintf(FILE *, const char *, ...);
-int sprintf(char *, const char *, ...);
-int snprintf(char *, size_t, const char *, ...);
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
 
-int vprintf(const char *, va_list);
-int vfprintf(FILE *, const char *, va_list);
-int vsprintf(char *, const char *, va_list);
-int vsnprintf(char *, size_t, const char *, va_list);
+int vprintf(const char *__restrict, va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, va_list);
+int vsprintf(char *__restrict, const char *__restrict, va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list);
 
-int scanf(const char *, ...);
-int fscanf(FILE *, const char *, ...);
-int sscanf(const char *, const char *, ...);
-int vscanf(const char *, va_list);
-int vfscanf(FILE *, const char *, va_list);
-int vsscanf(const char *, const char *, va_list);
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, va_list);
+int vsscanf(const char *__restrict, const char *__restrict, va_list);
 
 void perror(const char *);
 
-int setvbuf(FILE *, char *, int, size_t);
-void setbuf(FILE *, char *);
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
 
 char *tmpnam(char *);
 FILE *tmpfile(void);
@@ -125,7 +131,7 @@ FILE *tmpfile(void);
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
-FILE *fmemopen(void *, size_t, const char *);
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
 FILE *open_memstream(char **, size_t *);
 FILE *fdopen(int, const char *);
 FILE *popen(const char *, const char *);
@@ -133,8 +139,8 @@ int pclose(FILE *);
 int fileno(FILE *);
 int fseeko(FILE *, off_t, int);
 off_t ftello(FILE *);
-int dprintf(int, const char *, ...);
-int vdprintf(int, const char *, va_list);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, va_list);
 void flockfile(FILE *);
 int ftrylockfile(FILE *);
 void funlockfile(FILE *);
@@ -142,8 +148,8 @@ int getc_unlocked(FILE *);
 int getchar_unlocked(void);
 int putc_unlocked(int, FILE *);
 int putchar_unlocked(int);
-ssize_t getdelim(char **, size_t *, int, FILE *);
-ssize_t getline(char **, size_t *, FILE *);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
 int renameat(int, const char *, int, const char *);
 char *ctermid(char *);
 #define L_ctermid 20
index 1749cb3..14cc71b 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #undef NULL
 #ifdef __cplusplus
 #define NULL 0
@@ -22,14 +28,14 @@ long atol (const char *);
 long long atoll (const char *);
 double atof (const char *);
 
-float strtof (const char *, char **);
-double strtod (const char *, char **);
-long double strtold (const char *, char **);
+float strtof (const char *__restrict, char **__restrict);
+double strtod (const char *__restrict, char **__restrict);
+long double strtold (const char *__restrict, char **__restrict);
 
-long strtol (const char *, char **, int);
-unsigned long strtoul (const char *, char **, int);
-long long strtoll (const char *, char **, int);
-unsigned long long strtoull (const char *, char **, int);
+long strtol (const char *__restrict, char **__restrict, int);
+unsigned long strtoul (const char *__restrict, char **__restrict, int);
+long long strtoll (const char *__restrict, char **__restrict, int);
+unsigned long long strtoull (const char *__restrict, char **__restrict, int);
 
 int rand (void);
 void srand (unsigned);
@@ -67,10 +73,10 @@ ldiv_t ldiv (long, long);
 lldiv_t lldiv (long long, long long);
 
 int mblen (const char *, size_t);
-int mbtowc (wchar_t *, const char *, size_t);
+int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
 int wctomb (char *, wchar_t);
-size_t mbstowcs (wchar_t *, const char *, size_t);
-size_t wcstombs (char *, const wchar_t *, size_t);
+size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
+size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
 
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
@@ -108,7 +114,7 @@ int rand_r (unsigned *);
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
-char *realpath (const char *, char *);
+char *realpath (const char *__restrict, char *__restrict);
 long int random (void);
 void srandom (unsigned int);
 char *initstate (unsigned int, char *, size_t);
index 24cb1ca..f96f71e 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #undef NULL
 #ifdef __cplusplus
 #define NULL 0
@@ -21,23 +27,23 @@ extern "C" {
 
 #include <bits/alltypes.h>
 
-void *memcpy (void *, const void *, size_t);
+void *memcpy (void *__restrict, const void *__restrict, size_t);
 void *memmove (void *, const void *, size_t);
 void *memset (void *, int, size_t);
 int memcmp (const void *, const void *, size_t);
 void *memchr (const void *, int, size_t);
 
-char *strcpy (char *, const char *);
-char *strncpy (char *, const char *, size_t);
+char *strcpy (char *__restrict, const char *__restrict);
+char *strncpy (char *__restrict, const char *__restrict, size_t);
 
-char *strcat (char *, const char *);
-char *strncat (char *, const char *, size_t);
+char *strcat (char *__restrict, const char *__restrict);
+char *strncat (char *__restrict, const char *__restrict, size_t);
 
 int strcmp (const char *, const char *);
 int strncmp (const char *, const char *, size_t);
 
 int strcoll (const char *, const char *);
-size_t strxfrm (char *, const char *, size_t);
+size_t strxfrm (char *__restrict, const char *__restrict, size_t);
 
 char *strchr (const char *, int);
 char *strrchr (const char *, int);
@@ -46,7 +52,7 @@ size_t strcspn (const char *, const char *);
 size_t strspn (const char *, const char *);
 char *strpbrk (const char *, const char *);
 char *strstr (const char *, const char *);
-char *strtok (char *, const char *);
+char *strtok (char *__restrict, const char *__restrict);
 
 size_t strlen (const char *);
 
@@ -59,22 +65,22 @@ char *strerror (int);
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
-char *strtok_r (char *, const char *, char **);
+char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
 int strerror_r (int, char *, size_t);
-char *stpcpy(char *, const char *);
-char *stpncpy(char *, const char *, size_t);
+char *stpcpy(char *__restrict, const char *__restrict);
+char *stpncpy(char *__restrict, const char *__restrict, size_t);
 size_t strnlen (const char *, size_t);
 char *strdup (const char *);
 char *strndup (const char *, size_t);
 char *strsignal(int);
 char *strerror_l (int, locale_t);
 int strcoll_l (const char *, const char *, locale_t);
-size_t strxfrm_l (char *, const char *, size_t, locale_t);
+size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
 #endif
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
-void *memccpy (void *, const void *, int, size_t);
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
 #endif
 
 #ifdef _BSD_SOURCE
index 47d195f..dd4176d 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 #define __NEED_time_t
 #define __NEED_suseconds_t
@@ -27,8 +33,8 @@ typedef struct
 #define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
 #define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
 
-int select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
-int pselect (int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *);
+int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
+int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
 
 
 #ifdef __cplusplus
index a384ca1..7024d23 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_socklen_t
 #define __NEED_sa_family_t
 #define __NEED_size_t
@@ -232,19 +238,19 @@ int shutdown (int, int);
 int bind (int, const struct sockaddr *, socklen_t);
 int connect (int, const struct sockaddr *, socklen_t);
 int listen (int, int);
-int accept (int, struct sockaddr *, socklen_t *);
+int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
 
-int getsockname (int, struct sockaddr *, socklen_t *);
-int getpeername (int, struct sockaddr *, socklen_t *);
+int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
 
 ssize_t send (int, const void *, size_t, int);
 ssize_t recv (int, void *, size_t, int);
 ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
-ssize_t recvfrom (int, void *, size_t, int, struct sockaddr *, socklen_t *);
+ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
 ssize_t sendmsg (int, const struct msghdr *, int);
 ssize_t recvmsg (int, struct msghdr *, int);
 
-int getsockopt (int, int, int, void *, socklen_t *);
+int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
 int setsockopt (int, int, int, const void *, socklen_t);
 
 int sockatmark (int);
index 2a7ce23..e16a968 100644 (file)
@@ -4,6 +4,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_dev_t
 #define __NEED_ino_t
 #define __NEED_mode_t
@@ -68,10 +74,10 @@ extern "C" {
 #define UTIME_NOW  0x3fffffff
 #define UTIME_OMIT 0x3ffffffe
 
-int stat(const char *, struct stat *);
+int stat(const char *__restrict, struct stat *__restrict);
 int fstat(int, struct stat *);
-int lstat(const char *, struct stat *);
-int fstatat(int, const char *, struct stat *, int);
+int lstat(const char *__restrict, struct stat *__restrict);
+int fstatat(int, const char *__restrict, struct stat *__restrict, int);
 int chmod(const char *, mode_t);
 int fchmod(int, mode_t);
 int fchmodat(int, const char *, mode_t, int);
index 0a3ac9e..be41c28 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_fsblkcnt_t
 #define __NEED_fsfilcnt_t
 #include <bits/alltypes.h>
@@ -26,7 +32,7 @@ struct statvfs {
        int __reserved[6];
 };
 
-int statvfs (const char *, struct statvfs *);
+int statvfs (const char *__restrict, struct statvfs *__restrict);
 int fstatvfs (int, struct statvfs *);
 
 #define ST_RDONLY 1
index 144dd23..bf02643 100644 (file)
@@ -4,9 +4,15 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #include <sys/select.h>
 
-int gettimeofday (struct timeval *, void *);
+int gettimeofday (struct timeval *__restrict, void *__restrict);
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
@@ -22,7 +28,7 @@ struct itimerval
 };
 
 int getitimer (int, struct itimerval *);
-int setitimer (int, const struct itimerval *, struct itimerval *);
+int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
 int utimes (const char *, const struct timeval [2]);
 
 #endif
index 3cc0d28..f24789e 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #undef NULL
 #ifdef __cplusplus
 #define NULL 0
@@ -48,7 +54,7 @@ clock_t clock (void);
 time_t time (time_t *);
 double difftime (time_t, time_t);
 time_t mktime (struct tm *);
-size_t strftime (char *, size_t, const char *, const struct tm *);
+size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
 struct tm *gmtime (const time_t *);
 struct tm *localtime (const time_t *);
 char *asctime (const struct tm *);
@@ -61,11 +67,11 @@ char *ctime (const time_t *);
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  || defined(_BSD_SOURCE)
 
-size_t strftime_l (char *, size_t, const char *, const struct tm *, locale_t);
+size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const struct tm *  __restrict, locale_t);
 
-struct tm *gmtime_r (const time_t *, struct tm *);
-struct tm *localtime_r (const time_t *, struct tm *);
-char *asctime_r (const struct tm *, char *);
+struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
+char *asctime_r (const struct tm *__restrict, char *__restrict);
 char *ctime_r (const time_t *, char *);
 
 void tzset (void);
@@ -91,9 +97,9 @@ int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *)
 int clock_getcpuclockid (pid_t, clockid_t *);
 
 struct sigevent;
-int timer_create (clockid_t, struct sigevent *, timer_t *);
+int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
 int timer_delete (timer_t);
-int timer_settime (timer_t, int, const struct itimerspec *, struct itimerspec *);
+int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
 int timer_gettime (timer_t, struct itimerspec *);
 int timer_getoverrun (timer_t);
 
@@ -101,7 +107,7 @@ int timer_getoverrun (timer_t);
 
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
-char *strptime (const char *, const char *, struct tm *);
+char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
 extern int daylight;
 extern long timezone;
 extern char *tzname[2];
index 12d153b..ecb23f8 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
@@ -52,8 +58,8 @@ int link(const char *, const char *);
 int linkat(int, const char *, int, const char *, int);
 int symlink(const char *, const char *);
 int symlinkat(const char *, int, const char *);
-ssize_t readlink(const char *, char *, size_t);
-ssize_t readlinkat(int, const char *, char *, size_t);
+ssize_t readlink(const char *__restrict, char *__restrict, size_t);
+ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
 int unlink(const char *);
 int unlinkat(int, const char *, int);
 int rmdir(const char *);
@@ -141,7 +147,7 @@ void sync(void);
 pid_t setpgrp(void);
 char *crypt(const char *, const char *);
 void encrypt(char *, int);
-void swab(const void *, void *, ssize_t);
+void swab(const void *__restrict, void *__restrict, ssize_t);
 #endif
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
index 12ddd4f..b1c6b7f 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_FILE
 #define __NEED_va_list
 #define __NEED_size_t
@@ -39,17 +45,17 @@ typedef struct
        unsigned __opaque1, __opaque2;
 } mbstate_t;
 
-wchar_t *wcscpy (wchar_t *, const wchar_t *);
-wchar_t *wcsncpy (wchar_t *, const wchar_t *, size_t);
+wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
 
-wchar_t *wcscat (wchar_t *, const wchar_t *);
-wchar_t *wcsncat (wchar_t *, const wchar_t *, size_t);
+wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
 
 int wcscmp (const wchar_t *, const wchar_t *);
 int wcsncmp (const wchar_t *, const wchar_t *, size_t);
 
 int wcscoll(const wchar_t *, const wchar_t *);
-size_t wcsxfrm (wchar_t *, const wchar_t *, size_t n);
+size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t n);
 
 wchar_t *wcschr (const wchar_t *, wchar_t);
 wchar_t *wcsrchr (const wchar_t *, wchar_t);
@@ -58,16 +64,16 @@ size_t wcscspn (const wchar_t *, const wchar_t *);
 size_t wcsspn (const wchar_t *, const wchar_t *);
 wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
 
-wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **);
+wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
 
 size_t wcslen (const wchar_t *);
 
-wchar_t *wcsstr (const wchar_t *, const wchar_t *);
+wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
 wchar_t *wcswcs (const wchar_t *, const wchar_t *);
 
 wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
 int wmemcmp (const wchar_t *, const wchar_t *, size_t);
-wchar_t *wmemcpy (wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
 wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
 wchar_t *wmemset (wchar_t *, wchar_t, size_t);
 
@@ -75,44 +81,44 @@ wint_t btowc (int);
 int wctob (wint_t);
 
 int mbsinit (const mbstate_t *);
-size_t mbrtowc (wchar_t *, const char *, size_t, mbstate_t *);
-size_t wcrtomb (char *, wchar_t, mbstate_t *);
+size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
 
-size_t mbrlen (const char *, size_t, mbstate_t *);
+size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
 
-size_t mbsrtowcs (wchar_t *, const char **, size_t, mbstate_t *);
-size_t wcsrtombs (char *, const wchar_t **, size_t, mbstate_t *);
+size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
+size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
 
-float wcstof (const wchar_t *, wchar_t **);
-double wcstod (const wchar_t *, wchar_t **);
-long double wcstold (const wchar_t *, wchar_t **);
+float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
+double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
+long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
 
-long wcstol (const wchar_t *, wchar_t **, int);
-unsigned long wcstoul (const wchar_t *, wchar_t **, int);
+long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
 
-long long wcstoll (const wchar_t *, wchar_t **, int);
-unsigned long long wcstoull (const wchar_t *, wchar_t **, int);
+long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
 
 
 
 int fwide (FILE *, int);
 
 
-int wprintf (const wchar_t *, ...);
-int fwprintf (FILE *, const wchar_t *, ...);
-int swprintf (wchar_t *, size_t, const wchar_t *, ...);
+int wprintf (const wchar_t *__restrict, ...);
+int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
 
-int vwprintf (const wchar_t *, va_list);
-int vfwprintf (FILE *, const wchar_t *, va_list);
-int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
+int vwprintf (const wchar_t *__restrict, va_list);
+int vfwprintf (FILE *__restrict, const wchar_t *__restrict, va_list);
+int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, va_list);
 
-int wscanf (const wchar_t *, ...);
-int fwscanf (FILE *, const wchar_t *, ...);
-int swscanf (const wchar_t *, const wchar_t *, ...);
+int wscanf (const wchar_t *__restrict, ...);
+int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
 
-int vwscanf (const wchar_t *, va_list);
-int vfwscanf (FILE *, const wchar_t *, va_list);
-int vswscanf (const wchar_t *, const wchar_t *, va_list);
+int vwscanf (const wchar_t *__restrict, va_list);
+int vfwscanf (FILE *__restrict, const wchar_t *__restrict, va_list);
+int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, va_list);
 
 wint_t fgetwc (FILE *);
 wint_t getwc (FILE *);
@@ -122,31 +128,31 @@ wint_t fputwc (wchar_t, FILE *);
 wint_t putwc (wchar_t, FILE *);
 wint_t putwchar (wchar_t);
 
-wchar_t *fgetws (wchar_t *, int, FILE *);
-int fputws (const wchar_t *, FILE *);
+wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
+int fputws (const wchar_t *__restrict, FILE *__restrict);
 
 wint_t ungetwc (wint_t, FILE *);
 
 struct tm;
-size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
+size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
 
 #undef iswdigit
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
 FILE *open_wmemstream(wchar_t **, size_t *);
-size_t mbsnrtowcs(wchar_t *, const char **, size_t, size_t, mbstate_t *);
-size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t *);
+size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
+size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
 wchar_t *wcsdup(const wchar_t *);
 size_t wcsnlen (const wchar_t *, size_t);
-wchar_t *wcpcpy (wchar_t *, const wchar_t *);
-wchar_t *wcpncpy (wchar_t *, const wchar_t *, size_t);
+wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
 int wcscasecmp(const wchar_t *, const wchar_t *);
 int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
 int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
 int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
 int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
-size_t wcsxfrm_l(wchar_t *, const wchar_t *, size_t n, locale_t);
+size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t n, locale_t);
 #endif
 
 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
index 0691c8e..e7eb325 100644 (file)
@@ -5,6 +5,12 @@
 extern "C" {
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
 #define __NEED_size_t
 
 #include <bits/alltypes.h>
@@ -30,7 +36,7 @@ typedef struct
 #define WRDE_CMDSUB  4
 #define WRDE_SYNTAX  5
 
-int wordexp (const char *, wordexp_t *, int);
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
 void wordfree (wordexp_t *);
 
 #ifdef __cplusplus
index 8c851ca..30f7cc0 100644 (file)
@@ -64,7 +64,7 @@ static void *wait_thread(void *p)
        return 0;
 }
 
-int lio_listio(int mode, struct aiocb *const cbs[], int cnt, struct sigevent *sev)
+int lio_listio(int mode, struct aiocb *restrict const cbs[restrict], int cnt, struct sigevent *restrict sev)
 {
        int i, ret;
        struct lio_state *st=0;
@@ -81,7 +81,7 @@ int lio_listio(int mode, struct aiocb *const cbs[], int cnt, struct sigevent *se
                }
                st->cnt = cnt;
                st->sev = sev;
-               memcpy(st->cbs, cbs, cnt*sizeof *cbs);
+               memcpy(st->cbs, (void*) cbs, cnt*sizeof *cbs);
        }
 
        for (i=0; i<cnt; i++) {
index d3d7c60..639d49a 100644 (file)
@@ -5,7 +5,7 @@
 #include "__dirent.h"
 #include "libc.h"
 
-int readdir_r(DIR *dir, struct dirent *buf, struct dirent **result)
+int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **restrict result)
 {
        struct dirent *de;
        int errno_save = errno;
index 3369314..c0f50e9 100644 (file)
@@ -1,8 +1,8 @@
 #include <dlfcn.h>
 
-void *__dlsym(void *, const char *, void *);
+void *__dlsym(void *restrict, const char *restrict, void *restrict);
 
-void *dlsym(void *p, const char *s)
+void *dlsym(void *restrict p, const char *restrict s)
 {
        return __dlsym(p, s, 0);
 }
index 93a4b44..1c18133 100644 (file)
@@ -973,7 +973,7 @@ int __dladdr(void *addr, Dl_info *info)
        return 1;
 }
 
-void *__dlsym(void *p, const char *s, void *ra)
+void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
 {
        void *res;
        pthread_rwlock_rdlock(&lock);
@@ -986,7 +986,7 @@ void *dlopen(const char *file, int mode)
 {
        return 0;
 }
-void *__dlsym(void *p, const char *s, void *ra)
+void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
 {
        return 0;
 }
index 508d322..7b341fe 100644 (file)
@@ -139,7 +139,7 @@ static void put_32(unsigned char *s, unsigned c, int e)
 #define mbrtowc_utf8 mbrtowc
 #define wctomb_utf8 wctomb
 
-size_t iconv(iconv_t cd0, char **in, size_t *inb, char **out, size_t *outb)
+size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
 {
        size_t x=0;
        unsigned long cd = (unsigned long)cd0;
index 81dfe38..f510d9a 100644 (file)
@@ -75,7 +75,7 @@ static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_l
        return s-s0;
 }
 
-ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
+ssize_t strfmon_l(char *restrict s, size_t n, locale_t loc, const char *restrict fmt, ...)
 {
        va_list ap;
        ssize_t ret;
@@ -88,7 +88,7 @@ ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
 }
 
 
-ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+ssize_t strfmon(char *restrict s, size_t n, const char *restrict fmt, ...)
 {
        va_list ap;
        ssize_t ret;
index 70b2f15..f19f5bf 100644 (file)
@@ -1,7 +1,7 @@
 #include <locale.h>
 #include <time.h>
 
-size_t strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l)
+size_t strftime_l(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t l)
 {
        return strftime(s, n, f, tm);
 }
index 8f12339..d40be9e 100644 (file)
@@ -1,7 +1,7 @@
 #include <string.h>
 
 /* collate only by code points */
-size_t strxfrm(char *dest, const char *src, size_t n)
+size_t strxfrm(char *restrict dest, const char *restrict src, size_t n)
 {
        size_t l = strlen(src);
        if (n > l) strcpy(dest, src);
index 78e5655..81a7bad 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t l)
+size_t strxfrm_l(char *restrict dest, const char *restrict src, size_t n, locale_t l)
 {
        return strxfrm(dest, src, n);
 }
index 5f76e5a..bfa01b5 100644 (file)
@@ -1,7 +1,7 @@
 #include <wchar.h>
 
 /* collate only by code points */
-size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n)
+size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n)
 {
        size_t l = wcslen(src);
        if (l >= n) {
index 831998e..66a0019 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale)
+size_t wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t locale)
 {
        return wcsxfrm(dest, src, n);
 }
index ef156fc..5756817 100644 (file)
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-char *realpath(const char *filename, char *resolved)
+char *realpath(const char *restrict filename, char *restrict resolved)
 {
        int fd;
        ssize_t r;
index 15adddb..617706e 100644 (file)
@@ -147,7 +147,7 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags)
        return err;
 }
 
-int wordexp(const char *s, wordexp_t *we, int flags)
+int wordexp(const char *restrict s, wordexp_t *restrict we, int flags)
 {
        int r, cs;
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
index 9064fa0..eae022e 100644 (file)
@@ -1,7 +1,7 @@
 #include <mqueue.h>
 #include "syscall.h"
 
-int mq_setattr(mqd_t mqd, const struct mq_attr *new, struct mq_attr *old)
+int mq_setattr(mqd_t mqd, const struct mq_attr *restrict new, struct mq_attr *restrict old)
 {
        return syscall(SYS_mq_getsetattr, mqd, new, old);
 }
index 099f213..2cef6a8 100644 (file)
@@ -1,7 +1,7 @@
 #include <mqueue.h>
 #include "syscall.h"
 
-ssize_t mq_timedreceive(mqd_t mqd, char *msg, size_t len, unsigned *prio, const struct timespec *at)
+ssize_t mq_timedreceive(mqd_t mqd, char *restrict msg, size_t len, unsigned *restrict prio, const struct timespec *restrict at)
 {
        return syscall_cp(SYS_mq_timedreceive, mqd, msg, len, prio, at);
 }
index c9a9f03..c9714ef 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t mbrlen(const char *s, size_t n, mbstate_t *st)
+size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st)
 {
        static unsigned internal;
        return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal);
index 291537f..cc49781 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t mbrtowc(wchar_t *wc, const char *src, size_t n, mbstate_t *st)
+size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate_t *restrict st)
 {
        static unsigned internal_state;
        unsigned c;
index f42e30d..33457f9 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "internal.h"
 
-size_t mbsnrtowcs(wchar_t *wcs, const char **src, size_t n, size_t wn, mbstate_t *st)
+size_t mbsnrtowcs(wchar_t *restrict wcs, const char **restrict src, size_t n, size_t wn, mbstate_t *restrict st)
 {
        size_t l, cnt=0, n2;
        wchar_t *ws, wbuf[256];
index ebf0d6c..8313d37 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t mbsrtowcs(wchar_t *ws, const char **src, size_t wn, mbstate_t *st)
+size_t mbsrtowcs(wchar_t *restrict ws, const char **restrict src, size_t wn, mbstate_t *restrict st)
 {
        unsigned c;
        const unsigned char *s = (const void *)*src;
index 23e1d92..5071baf 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t mbstowcs(wchar_t *ws, const char *s, size_t wn)
+size_t mbstowcs(wchar_t *restrict ws, const char *restrict s, size_t wn)
 {
        mbstate_t st = { 0 };
        return mbsrtowcs(ws, (void*)&s, wn, &st);
index bdcaeb3..b5dd7e3 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-int mbtowc(wchar_t *wc, const char *s, size_t n)
+int mbtowc(wchar_t *restrict wc, const char *restrict s, size_t n)
 {
        mbstate_t st = { 0 };
        n = mbrtowc(wc, s, n, &st);
index 36180c8..250649f 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t wcrtomb(char *s, wchar_t wc, mbstate_t *st)
+size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict st)
 {
        if (!s) return 1;
        if ((unsigned)wc < 0x80) {
index 70b0cac..a2e308b 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t wcsnrtombs(char *dst, const wchar_t **wcs, size_t wn, size_t n, mbstate_t *st)
+size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st)
 {
        size_t l, cnt=0, n2;
        char *s, buf[256];
index 3c48d65..2582ac2 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "internal.h"
 
-size_t wcsrtombs(char *s, const wchar_t **ws, size_t n, mbstate_t *st)
+size_t wcsrtombs(char *restrict s, const wchar_t **restrict ws, size_t n, mbstate_t *restrict st)
 {
        const wchar_t *ws2;
        char buf[4];
index b9c1b18..b6ae473 100644 (file)
@@ -11,7 +11,8 @@
 
 #include "internal.h"
 
-size_t wcstombs(char *s, const wchar_t *ws, size_t n)
+size_t wcstombs(char *restrict s, const wchar_t *restrict ws, size_t n)
 {
-       return wcsrtombs(s, &ws, n, 0);
+       const wchar_t * x = ws;
+       return wcsrtombs(s, &x, n, 0);
 }
index f6b75ba..521e9ef 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int accept(int fd, struct sockaddr *addr, socklen_t *len)
+int accept(int fd, struct sockaddr *restrict addr, socklen_t *restrict len)
 {
        return socketcall_cp(accept, fd, addr, len, 0, 0, 0);
 }
index 8386216..b9e562f 100644 (file)
@@ -47,7 +47,7 @@ struct aibuf {
 /* Extra slots needed for storing canonical name */
 #define EXTRA ((256+sizeof(struct aibuf)-1)/sizeof(struct aibuf))
 
-int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint, struct addrinfo **res)
+int getaddrinfo(const char *restrict host, const char *restrict serv, const struct addrinfo *restrict hint, struct addrinfo **restrict res)
 {
        int flags = hint ? hint->ai_flags : 0;
        int family = hint ? hint->ai_family : AF_UNSPEC;
index 0763ca8..3d115c7 100644 (file)
@@ -8,9 +8,9 @@
 #include <arpa/inet.h>
 #include "__dns.h"
 
-int getnameinfo(const struct sockaddr *sa, socklen_t sl,
-       char *node, socklen_t nodelen,
-       char *serv, socklen_t servlen,
+int getnameinfo(const struct sockaddr *restrict sa, socklen_t sl,
+       char *restrict node, socklen_t nodelen,
+       char *restrict serv, socklen_t servlen,
        int flags)
 {
        char buf[256];
index 22effda..6567b45 100644 (file)
@@ -1,7 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
 
-int getpeername(int fd, struct sockaddr *addr, socklen_t *len)
+int getpeername(int fd, struct sockaddr *restrict addr, socklen_t *restrict len)
 {
        return socketcall(getpeername, fd, addr, len, 0, 0, 0);
 }
index 271e3b4..7885fc1 100644 (file)
@@ -1,7 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
 
-int getsockname(int fd, struct sockaddr *addr, socklen_t *len)
+int getsockname(int fd, struct sockaddr *restrict addr, socklen_t *restrict len)
 {
        return socketcall(getsockname, fd, addr, len, 0, 0, 0);
 }
index a9e0a72..28079d8 100644 (file)
@@ -1,7 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
 
-int getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen)
+int getsockopt(int fd, int level, int optname, void *restrict optval, socklen_t *restrict optlen)
 {
        return socketcall(getsockopt, fd, level, optname, optval, optlen, 0);
 }
index 4817187..76ae556 100644 (file)
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 
-const char *inet_ntop(int af, const void *a0, char *s, socklen_t l)
+const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen_t l)
 {
        const unsigned char *a = a0;
        int i, j, max, best;
index bb16fb9..5c4850a 100644 (file)
@@ -14,7 +14,7 @@ static int hexval(unsigned c)
        return -1;
 }
 
-int inet_pton(int af, const char *s, void *a0)
+int inet_pton(int af, const char *restrict s, void *restrict a0)
 {
        uint16_t ip[8];
        unsigned char *a = a0;
index 035a15f..436f344 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-ssize_t recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *alen)
+ssize_t recvfrom(int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict addr, socklen_t *restrict alen)
 {
        return socketcall_cp(recvfrom, fd, buf, len, flags, addr, alen);
 }
index 9f2d742..1120be0 100644 (file)
@@ -8,11 +8,11 @@
 
 extern char **environ;
 
-int __posix_spawnx(pid_t *res, const char *path,
+int __posix_spawnx(pid_t *restrict res, const char *restrict path,
        int (*exec)(const char *, char *const *),
        const posix_spawn_file_actions_t *fa,
-       const posix_spawnattr_t *attr,
-       char *const argv[], char *const envp[])
+       const posix_spawnattr_t *restrict attr,
+       char *const argv[restrict], char *const envp[restrict])
 {
        pid_t pid;
        sigset_t oldmask;
@@ -89,10 +89,10 @@ int __posix_spawnx(pid_t *res, const char *path,
        return 0;
 }
 
-int posix_spawn(pid_t *res, const char *path,
+int posix_spawn(pid_t *restrict res, const char *restrict path,
        const posix_spawn_file_actions_t *fa,
-       const posix_spawnattr_t *attr,
-       char *const argv[], char *const envp[])
+       const posix_spawnattr_t *restrict attr,
+       char *const argv[restrict], char *const envp[restrict])
 {
        return __posix_spawnx(res, path, execv, fa, attr, argv, envp);
 }
index af3ca60..368922c 100644 (file)
@@ -4,7 +4,7 @@
 #include <errno.h>
 #include "fdop.h"
 
-int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *fa, int fd, const char *path, int flags, mode_t mode)
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict fa, int fd, const char *restrict path, int flags, mode_t mode)
 {
        struct fdop *op = malloc(sizeof *op + strlen(path) + 1);
        if (!op) return ENOMEM;
index 7353d24..aa635dd 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_getflags(const posix_spawnattr_t *attr, short *flags)
+int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr, short *restrict flags)
 {
        *flags = attr->__flags;
        return 0;
index 2c72e98..0480527 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_getpgroup(const posix_spawnattr_t *attr, pid_t *pgrp)
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr, pid_t *restrict pgrp)
 {
        *pgrp = attr->__pgrp;
        return 0;
index 5f0dfb5..a49050a 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_getsigdefault(const posix_spawnattr_t *attr, sigset_t *def)
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr, sigset_t *restrict def)
 {
        *def = attr->__def;
        return 0;
index b449075..f60ad7f 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_getsigmask(const posix_spawnattr_t *attr, sigset_t *mask)
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr, sigset_t *restrict mask)
 {
        *mask = attr->__mask;
        return 0;
index a6ddd4d..5686972 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_setsigdefault(posix_spawnattr_t *attr, const sigset_t *def)
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr, const sigset_t *restrict def)
 {
        attr->__def = *def;
        return 0;
index 6afbf87..f2532f8 100644 (file)
@@ -1,6 +1,6 @@
 #include <spawn.h>
 
-int posix_spawnattr_setsigmask(posix_spawnattr_t *attr, const sigset_t *mask)
+int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr, const sigset_t *restrict mask)
 {
        attr->__mask = *mask;
        return 0;
index 04d768d..91355fb 100644 (file)
@@ -1,15 +1,15 @@
 #include <spawn.h>
 #include <unistd.h>
 
-int __posix_spawnx(pid_t *, const char *,
+int __posix_spawnx(pid_t *restrict, const char *restrict,
        int (*)(const char *, char *const *),
        const posix_spawn_file_actions_t *,
-       const posix_spawnattr_t *, char *const [], char *const []);
+       const posix_spawnattr_t *restrict, char *const *restrict, char *const *restrict);
 
-int posix_spawnp(pid_t *res, const char *file,
+int posix_spawnp(pid_t *restrict res, const char *restrict file,
        const posix_spawn_file_actions_t *fa,
-       const posix_spawnattr_t *attr,
-       char *const argv[], char *const envp[])
+       const posix_spawnattr_t *restrict attr,
+       char *const argv[restrict], char *const envp[restrict])
 {
        return __posix_spawnx(res, file, execvp, fa, attr, argv, envp);
 }
index 3476e01..6c07e6b 100644 (file)
@@ -156,7 +156,7 @@ static int sort(const void *a, const void *b)
        return strcmp(*(const char **)a, *(const char **)b);
 }
 
-int glob(const char *pat, int flags, int (*errfunc)(const char *path, int err), glob_t *g)
+int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, int err), glob_t *restrict g)
 {
        const char *p=pat, *d;
        struct match head = { .next = NULL }, *tail = &head;
index 322a5e6..399989e 100644 (file)
@@ -3091,7 +3091,7 @@ tre_ast_to_tnfa(tre_ast_node_t *node, tre_tnfa_transition_t *transitions,
 
 
 int
-regcomp(regex_t *preg, const char *regex, int cflags)
+regcomp(regex_t *restrict preg, const char *restrict regex, int cflags)
 {
   tre_stack_t *stack;
   tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;
index 0645b8e..df4afa4 100644 (file)
@@ -26,7 +26,7 @@ static const char messages[] = {
   "\0Unknown error"
 };
 
-size_t regerror(int e, const regex_t *preg, char *buf, size_t size)
+size_t regerror(int e, const regex_t *restrict preg, char *restrict buf, size_t size)
 {
        const char *s;
        for (s=messages; e && *s; e--, s+=strlen(s)+1);
index 8107aae..855cef5 100644 (file)
@@ -977,8 +977,8 @@ tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
 */
 
 int
-regexec(const regex_t *preg, const char *string,
-         size_t nmatch, regmatch_t pmatch[], int eflags)
+regexec(const regex_t *restrict preg, const char *restrict string,
+         size_t nmatch, regmatch_t pmatch[restrict], int eflags)
 {
   tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
   reg_errcode_t status;
index 48fcefe..50343fb 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int pselect(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, const struct timespec *ts, const sigset_t *mask)
+int pselect(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict efds, const struct timespec *restrict ts, const sigset_t *restrict mask)
 {
        long data[2] = { (long)mask, __SYSCALL_SSLEN };
        struct timespec ts_tmp;
index 696cb28..f93597b 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)
+int select(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict efds, struct timeval *restrict tv)
 {
        return syscall_cp(SYS_select, n, rfds, wfds, efds, tv);
 }
index 3b23758..21b1f45 100644 (file)
@@ -1,7 +1,7 @@
 #include <sys/time.h>
 #include "syscall.h"
 
-int setitimer(int which, const struct itimerval *new, struct itimerval *old)
+int setitimer(int which, const struct itimerval *restrict new, struct itimerval *restrict old)
 {
        return syscall(SYS_setitimer, which, new, old);
 }
index e0c58b7..2331dc9 100644 (file)
@@ -11,7 +11,7 @@ void __restore(), __restore_rt();
 static pthread_t dummy(void) { return 0; }
 weak_alias(dummy, __pthread_self_def);
 
-int __libc_sigaction(int sig, const struct sigaction *sa, struct sigaction *old)
+int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
 {
        struct k_sigaction ksa;
        if (sa) {
@@ -31,7 +31,7 @@ int __libc_sigaction(int sig, const struct sigaction *sa, struct sigaction *old)
        return 0;
 }
 
-int __sigaction(int sig, const struct sigaction *sa, struct sigaction *old)
+int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
 {
        if (sig-32U < 3) {
                errno = EINVAL;
index 550f2f9..62cb81a 100644 (file)
@@ -2,7 +2,7 @@
 #include <errno.h>
 #include "syscall.h"
 
-int sigaltstack(const stack_t *ss, stack_t *old)
+int sigaltstack(const stack_t *restrict ss, stack_t *restrict old)
 {
        if (ss) {
                if (ss->ss_size < MINSIGSTKSZ) {
index 67e2b82..297e20c 100644 (file)
@@ -1,7 +1,7 @@
 #include <signal.h>
 #include <errno.h>
 
-int sigprocmask(int how, const sigset_t *set, sigset_t *old)
+int sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
 {
        int r = pthread_sigmask(how, set, old);
        if (!r) return r;
index f62db2f..4f8589b 100644 (file)
@@ -3,7 +3,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int sigtimedwait(const sigset_t *mask, siginfo_t *si, const struct timespec *timeout)
+int sigtimedwait(const sigset_t *restrict mask, siginfo_t *restrict si, const struct timespec *restrict timeout)
 {
        int ret;
        do ret = syscall_cp(SYS_rt_sigtimedwait, mask,
index 9569d6b..48a855b 100644 (file)
@@ -1,7 +1,7 @@
 #include <signal.h>
 #include <stddef.h>
 
-int sigwait(const sigset_t *mask, int *sig)
+int sigwait(const sigset_t *restrict mask, int *restrict sig)
 {
        siginfo_t si;
        if (sigtimedwait(mask, &si, NULL) < 0)
index e79feb9..c7b164d 100644 (file)
@@ -1,7 +1,7 @@
 #include <signal.h>
 #include <stddef.h>
 
-int sigwaitinfo(const sigset_t *mask, siginfo_t *si)
+int sigwaitinfo(const sigset_t *restrict mask, siginfo_t *restrict si)
 {
        return sigtimedwait(mask, si, NULL);
 }
index d6b9390..863d526 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int fstatat(int fd, const char *path, struct stat *buf, int flag)
+int fstatat(int fd, const char *restrict path, struct stat *restrict buf, int flag)
 {
        return syscall(SYS_fstatat, fd, path, buf, flag);
 }
index 9053d99..8f60358 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int lstat(const char *path, struct stat *buf)
+int lstat(const char *restrict path, struct stat *restrict buf)
 {
        return syscall(SYS_lstat, path, buf);
 }
index c5491eb..c6de716 100644 (file)
@@ -2,7 +2,7 @@
 #include "syscall.h"
 #include "libc.h"
 
-int stat(const char *path, struct stat *buf)
+int stat(const char *restrict path, struct stat *restrict buf)
 {
        return syscall(SYS_stat, path, buf);
 }
index 5fadb3b..637bf82 100644 (file)
@@ -39,7 +39,7 @@ static void fixup(struct statvfs *out, const struct statfs *in)
        out->f_namemax = in->f_namelen;
 }
 
-int statvfs(const char *path, struct statvfs *buf)
+int statvfs(const char *restrict path, struct statvfs *restrict buf)
 {
        struct statfs kbuf;
        if (__statfs(path, &kbuf)<0) return -1;
index fa28322..93082ee 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int dprintf(int fd, const char *fmt, ...)
+int dprintf(int fd, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 5b663d1..c3fa0eb 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdio_impl.h"
 
-int fgetpos(FILE *f, fpos_t *pos)
+int fgetpos(FILE *restrict f, fpos_t *restrict pos)
 {
        off_t off = __ftello(f);
        if (off < 0) return -1;
index 3135a69..ee0ac30 100644 (file)
@@ -2,7 +2,7 @@
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
-char *fgets(char *s, int n, FILE *f)
+char *fgets(char *restrict s, int n, FILE *restrict f)
 {
        char *p = s;
        unsigned char *z;
index 2e76b56..fab9bd0 100644 (file)
@@ -2,7 +2,7 @@
 
 wint_t __fgetwc_unlocked(FILE *);
 
-wchar_t *fgetws(wchar_t *s, int n, FILE *f)
+wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f)
 {
        wchar_t *p = s;
 
index 1b054a9..770fd99 100644 (file)
@@ -67,7 +67,7 @@ static int mclose(FILE *m)
        return 0;
 }
 
-FILE *fmemopen(void *buf, size_t size, const char *mode)
+FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode)
 {
        FILE *f;
        struct cookie *c;
index 0d5b1af..560b77e 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdio_impl.h"
 
-FILE *fopen(const char *filename, const char *mode)
+FILE *fopen(const char *restrict filename, const char *restrict mode)
 {
        FILE *f;
        int fd;
index a220cc1..948743f 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int fprintf(FILE *f, const char *fmt, ...)
+int fprintf(FILE *restrict f, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index e6bdb20..b41bc8c 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdio_impl.h"
 
-int fputs(const char *s, FILE *f)
+int fputs(const char *restrict s, FILE *restrict f)
 {
        size_t l = strlen(s);
        if (!l) return 0;
index b75f95b..0b593c0 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdio_impl.h"
 
-int fputws(const wchar_t *ws, FILE *f)
+int fputws(const wchar_t *restrict ws, FILE *restrict f)
 {
        unsigned char buf[BUFSIZ];
        size_t l=0;
index 5c23577..3f31af8 100644 (file)
@@ -2,7 +2,7 @@
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
-size_t fread(void *destv, size_t size, size_t nmemb, FILE *f)
+size_t fread(void *restrict destv, size_t size, size_t nmemb, FILE *restrict f)
 {
        unsigned char *dest = destv;
        size_t len = size*nmemb, l = len, k;
index b1f8fe7..57c3cd2 100644 (file)
@@ -7,7 +7,7 @@
 /* Locking is not necessary because, in the event of failure, the stream
  * passed to freopen is invalid as soon as freopen is called. */
 
-FILE *freopen(const char *filename, const char *mode, FILE *f)
+FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict f)
 {
        int fl;
        FILE *f2;
index 51fc9b3..ff6c776 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int fscanf(FILE *f, const char *fmt, ...)
+int fscanf(FILE *restrict f, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 26d9729..9ce4f01 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int fwprintf(FILE *f, const wchar_t *fmt, ...)
+int fwprintf(FILE *restrict f, const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 1b8641a..8027b30 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdio_impl.h"
 
-size_t __fwritex(const unsigned char *s, size_t l, FILE *f)
+size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
 {
        size_t i=0;
 
@@ -24,7 +24,7 @@ size_t __fwritex(const unsigned char *s, size_t l, FILE *f)
        return l+i;
 }
 
-size_t fwrite(const void *src, size_t size, size_t nmemb, FILE *f)
+size_t fwrite(const void *restrict src, size_t size, size_t nmemb, FILE *restrict f)
 {
        size_t k, l = size*nmemb;
        if (!l) return l;
index a6892cf..2f30dab 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int fwscanf(FILE *f, const wchar_t *fmt, ...)
+int fwscanf(FILE *restrict f, const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index b7e04ac..5015c3a 100644 (file)
@@ -2,7 +2,7 @@
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
-ssize_t getdelim(char **s, size_t *n, int delim, FILE *f)
+ssize_t getdelim(char **restrict s, size_t *restrict n, int delim, FILE *restrict f)
 {
        char *tmp;
        unsigned char *z;
index a3a6651..476d0b0 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-ssize_t getline(char **s, size_t *n, FILE *f)
+ssize_t getline(char **restrict s, size_t *restrict n, FILE *restrict f)
 {
        return getdelim(s, n, '\n', f);
 }
index 7b7c329..cebfe40 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int printf(const char *fmt, ...)
+int printf(const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index a04a440..3b35bdc 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int scanf(const char *fmt, ...)
+int scanf(const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 1b98d50..74ad783 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-void setbuf(FILE *f, char *buf)
+void setbuf(FILE *restrict f, char *restrict buf)
 {
        setvbuf(f, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
 }
index 6dea0eb..541a125 100644 (file)
@@ -9,7 +9,7 @@
  * In the case of stderr where the preexisting buffer is length 1, it
  * is not possible to set line buffering or full buffering. */
 
-int setvbuf(FILE *f, char *buf, int type, size_t size)
+int setvbuf(FILE *restrict f, char *restrict buf, int type, size_t size)
 {
        f->lbf = EOF;
 
index 4071c2f..771503b 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int snprintf(char *s, size_t n, const char *fmt, ...)
+int snprintf(char *restrict s, size_t n, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 6b22540..9dff524 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int sprintf(char *s, const char *fmt, ...)
+int sprintf(char *restrict s, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index a1cea69..b575edf 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int sscanf(const char *s, const char *fmt, ...)
+int sscanf(const char *restrict s, const char *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 5ece97c..cbf83d2 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int swprintf(wchar_t *s, size_t n, const wchar_t *fmt, ...)
+int swprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index b66ad03..1fe3c3d 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int swscanf(const wchar_t *s, const wchar_t *fmt, ...)
+int swscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index b41a3c7..c35d9b4 100644 (file)
@@ -5,7 +5,7 @@ static size_t wrap_write(FILE *f, const unsigned char *buf, size_t len)
        return __stdio_write(f, buf, len);
 }
 
-int vdprintf(int fd, const char *fmt, va_list ap)
+int vdprintf(int fd, const char *restrict fmt, va_list ap)
 {
        FILE f = {
                .fd = fd, .lbf = EOF, .write = wrap_write,
index d186d58..6525938 100644 (file)
@@ -636,7 +636,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
        return 1;
 }
 
-int vfprintf(FILE *f, const char *fmt, va_list ap)
+int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
 {
        va_list ap2;
        int nl_type[NL_ARGMAX+1] = {0};
index 61b0edb..54d0849 100644 (file)
@@ -71,7 +71,7 @@ static int readwc(int c, wchar_t **wcs, mbstate_t *st)
        return 0;
 }
 
-int vfscanf(FILE *f, const char *fmt, va_list ap)
+int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
 {
        int width;
        int size;
index 6282980..a42ba19 100644 (file)
@@ -336,7 +336,7 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
        return 1;
 }
 
-int vfwprintf(FILE *f, const wchar_t *fmt, va_list ap)
+int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 {
        va_list ap2;
        int nl_type[NL_ARGMAX] = {0};
index de74fe0..b3bc6f3 100644 (file)
@@ -86,7 +86,7 @@ static int in_set(const wchar_t *set, int c)
        ((f)->rend && (c)<128U ? *--(f)->rpos : ungetwc((c),(f)))
 #endif
 
-int vfwscanf(FILE *f, const wchar_t *fmt, va_list ap)
+int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 {
        int width;
        int size;
index 67b38da..30d2bff 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-int vprintf(const char *fmt, va_list ap)
+int vprintf(const char *restrict fmt, va_list ap)
 {
        return vfprintf(stdout, fmt, ap);
 }
index 6f55b1c..6901958 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-int vscanf(const char *fmt, va_list ap)
+int vscanf(const char *restrict fmt, va_list ap)
 {
        return vfscanf(stdin, fmt, ap);
 }
index ba17bd7..6f19b02 100644 (file)
@@ -10,7 +10,7 @@ static size_t sn_write(FILE *f, const unsigned char *s, size_t l)
        return l;
 }
 
-int vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
+int vsnprintf(char *restrict s, size_t n, const char *restrict fmt, va_list ap)
 {
        int r;
        char b;
index 7836ccb..c57349d 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <limits.h>
 
-int vsprintf(char *s, const char *fmt, va_list ap)
+int vsprintf(char *restrict s, const char *restrict fmt, va_list ap)
 {
        return vsnprintf(s, INT_MAX, fmt, ap);
 }
index fbc15e6..049f4dd 100644 (file)
@@ -5,7 +5,7 @@ static size_t do_read(FILE *f, unsigned char *buf, size_t len)
        return __string_read(f, buf, len);
 }
 
-int vsscanf(const char *s, const char *fmt, va_list ap)
+int vsscanf(const char *restrict s, const char *restrict fmt, va_list ap)
 {
        FILE f = {
                .buf = (void *)s, .cookie = (void *)s,
index 8e8f80c..f3d4fec 100644 (file)
@@ -22,7 +22,7 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
        return i<0 ? i : l0;
 }
 
-int vswprintf(wchar_t *s, size_t n, const wchar_t *fmt, va_list ap)
+int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_list ap)
 {
        int r;
        FILE f;
index 4c39f80..a205200 100644 (file)
@@ -23,7 +23,7 @@ static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
        return 1;
 }
 
-int vswscanf(const wchar_t *s, const wchar_t *fmt, va_list ap)
+int vswscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, va_list ap)
 {
        unsigned char buf[256];
        FILE f = {
index c1923e6..eeeecdc 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <wchar.h>
 
-int vwprintf(const wchar_t *fmt, va_list ap)
+int vwprintf(const wchar_t *restrict fmt, va_list ap)
 {
        return vfwprintf(stdout, fmt, ap);
 }
index 86da045..9297cf0 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int vwscanf(const wchar_t *fmt, va_list ap)
+int vwscanf(const wchar_t *restrict fmt, va_list ap)
 {
        return vfwscanf(stdin, fmt, ap);
 }
index 20ca61a..342cd97 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int wprintf(const wchar_t *fmt, ...)
+int wprintf(const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 34b5884..a207cc1 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdarg.h>
 #include <wchar.h>
 
-int wscanf(const wchar_t *fmt, ...)
+int wscanf(const wchar_t *restrict fmt, ...)
 {
        int ret;
        va_list ap;
index 1886efa..c6f89e7 100644 (file)
@@ -16,17 +16,17 @@ static long double strtox(const char *s, char **p, int prec)
        return y;
 }
 
-float strtof(const char *s, char **p)
+float strtof(const char *restrict s, char **restrict p)
 {
        return strtox(s, p, 0);
 }
 
-double strtod(const char *s, char **p)
+double strtod(const char *restrict s, char **restrict p)
 {
        return strtox(s, p, 1);
 }
 
-long double strtold(const char *s, char **p)
+long double strtold(const char *restrict s, char **restrict p)
 {
        return strtox(s, p, 2);
 }
index 4a949cb..23a2f3b 100644 (file)
@@ -22,32 +22,32 @@ static unsigned long long strtox(const char *s, char **p, int base, unsigned lon
        return y;
 }
 
-unsigned long long strtoull(const char *s, char **p, int base)
+unsigned long long strtoull(const char *restrict s, char **restrict p, int base)
 {
        return strtox(s, p, base, ULLONG_MAX);
 }
 
-long long strtoll(const char *s, char **p, int base)
+long long strtoll(const char *restrict s, char **restrict p, int base)
 {
        return strtox(s, p, base, LLONG_MIN);
 }
 
-unsigned long strtoul(const char *s, char **p, int base)
+unsigned long strtoul(const char *restrict s, char **restrict p, int base)
 {
        return strtox(s, p, base, ULONG_MAX);
 }
 
-long strtol(const char *s, char **p, int base)
+long strtol(const char *restrict s, char **restrict p, int base)
 {
        return strtox(s, p, base, 0UL+LONG_MIN);
 }
 
-intmax_t strtoimax(const char *s, char **p, int base)
+intmax_t strtoimax(const char *restrict s, char **restrict p, int base)
 {
        return strtoll(s, p, base);
 }
 
-uintmax_t strtoumax(const char *s, char **p, int base)
+uintmax_t strtoumax(const char *restrict s, char **restrict p, int base)
 {
        return strtoull(s, p, base);
 }
index 5ec45dd..03670b0 100644 (file)
@@ -47,17 +47,17 @@ static long double wcstox(const wchar_t *s, wchar_t **p, int prec)
        return y;
 }
 
-float wcstof(const wchar_t *s, wchar_t **p)
+float wcstof(const wchar_t *restrict s, wchar_t **restrict p)
 {
        return wcstox(s, p, 0);
 }
 
-double wcstod(const wchar_t *s, wchar_t **p)
+double wcstod(const wchar_t *restrict s, wchar_t **restrict p)
 {
        return wcstox(s, p, 1);
 }
 
-long double wcstold(const wchar_t *s, wchar_t **p)
+long double wcstold(const wchar_t *restrict s, wchar_t **restrict p)
 {
        return wcstox(s, p, 2);
 }
index 840bb0a..3d7c97d 100644 (file)
@@ -47,32 +47,32 @@ static unsigned long long wcstox(const wchar_t *s, wchar_t **p, int base, unsign
        return y;
 }
 
-unsigned long long wcstoull(const wchar_t *s, wchar_t **p, int base)
+unsigned long long wcstoull(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstox(s, p, base, ULLONG_MAX);
 }
 
-long long wcstoll(const wchar_t *s, wchar_t **p, int base)
+long long wcstoll(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstox(s, p, base, LLONG_MIN);
 }
 
-unsigned long wcstoul(const wchar_t *s, wchar_t **p, int base)
+unsigned long wcstoul(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstox(s, p, base, ULONG_MAX);
 }
 
-long wcstol(const wchar_t *s, wchar_t **p, int base)
+long wcstol(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstox(s, p, base, 0UL+LONG_MIN);
 }
 
-intmax_t wcstoimax(const wchar_t *s, wchar_t **p, int base)
+intmax_t wcstoimax(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstoll(s, p, base);
 }
 
-uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base)
+uintmax_t wcstoumax(const wchar_t *restrict s, wchar_t **restrict p, int base)
 {
        return wcstoull(s, p, base);
 }
index 2ccb31b..b85009c 100644 (file)
@@ -8,7 +8,7 @@
 #define HIGHS (ONES * (UCHAR_MAX/2+1))
 #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)
 
-void *memccpy(void *dest, const void *src, int c, size_t n)
+void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
 {
        unsigned char *d = dest;
        const unsigned char *s = src;
index 02cb469..8e98302 100644 (file)
@@ -6,7 +6,7 @@
 #define ALIGN (sizeof(size_t)-1)
 #define ONES ((size_t)-1/UCHAR_MAX)
 
-void *memcpy(void *dest, const void *src, size_t n)
+void *memcpy(void *restrict dest, const void *restrict src, size_t n)
 {
        unsigned char *d = dest;
        const unsigned char *s = src;
index 10ca493..da96f21 100644 (file)
@@ -9,7 +9,7 @@
 #define HIGHS (ONES * (UCHAR_MAX/2+1))
 #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)
 
-char *__stpcpy(char *d, const char *s)
+char *__stpcpy(char *restrict d, const char *restrict s)
 {
        size_t *wd;
        const size_t *ws;
index a04cdce..0a2c2a9 100644 (file)
@@ -9,7 +9,7 @@
 #define HIGHS (ONES * (UCHAR_MAX/2+1))
 #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)
 
-char *__stpncpy(char *d, const char *s, size_t n)
+char *__stpncpy(char *restrict d, const char *restrict s, size_t n)
 {
        size_t *wd;
        const size_t *ws;
index 29fdb61..33f749b 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-char *strcat(char *dest, const char *src)
+char *strcat(char *restrict dest, const char *restrict src)
 {
        strcpy(dest + strlen(dest), src);
        return dest;
index 7675e9c..f7e3ba3 100644 (file)
@@ -2,7 +2,7 @@
 
 char *__stpcpy(char *, const char *);
 
-char *strcpy(char *dest, const char *src)
+char *strcpy(char *restrict dest, const char *restrict src)
 {
 #if 1
        __stpcpy(dest, src);
index 08685ad..01ca2a2 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-char *strncat(char *d, const char *s, size_t n)
+char *strncat(char *restrict d, const char *restrict s, size_t n)
 {
        char *a = d;
        d += strlen(d);
index c0cd797..441ba03 100644 (file)
@@ -2,7 +2,7 @@
 
 char *__stpncpy(char *, const char *, size_t);
 
-char *strncpy(char *d, const char *s, size_t n)
+char *strncpy(char *restrict d, const char *restrict s, size_t n)
 {
        __stpncpy(d, s, n);
        return d;
index 1ba221c..3508790 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-char *strtok(char *s, const char *sep)
+char *strtok(char *restrict s, const char *restrict sep)
 {
        static char *p;
        if (!s && !(s = p)) return NULL;
index c763897..862d4fe 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-char *strtok_r(char *s, const char *sep, char **p)
+char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p)
 {
        if (!s && !(s = *p)) return NULL;
        s += strspn(s, sep);
index b213288..9ed6fcd 100644 (file)
@@ -1,6 +1,6 @@
 #include <unistd.h>
 
-void swab(const void *_src, void *_dest, ssize_t n)
+void swab(const void *restrict _src, void *restrict _dest, ssize_t n)
 {
        const char *src = _src;
        char *dest = _dest;
index fdf878f..ef40134 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcpcpy(wchar_t *d, const wchar_t *s)
+wchar_t *wcpcpy(wchar_t *restrict d, const wchar_t *restrict s)
 {
        return wcscpy(d, s) + wcslen(s);
 }
index aef8096..b667f6d 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcpncpy(wchar_t *d, const wchar_t *s, size_t n)
+wchar_t *wcpncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n)
 {
        return wcsncpy(d, s, n) + wcsnlen(s, n);
 }
index 946f16e..d4f00eb 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcscat(wchar_t *dest, const wchar_t *src)
+wchar_t *wcscat(wchar_t *restrict dest, const wchar_t *restrict src)
 {
        wcscpy(dest + wcslen(dest), src);
        return dest;
index e0ac194..625bf53 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcscpy(wchar_t *d, const wchar_t *s)
+wchar_t *wcscpy(wchar_t *restrict d, const wchar_t *restrict s)
 {
        wchar_t *a = d;
        while ((*d++ = *s++));
index 9d61bbb..8563f1a 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcsncat(wchar_t *d, const wchar_t *s, size_t n)
+wchar_t *wcsncat(wchar_t *restrict d, const wchar_t *restrict s, size_t n)
 {
        wchar_t *a = d;
        d += wcslen(d);
index 714eeb6..4bede04 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
+wchar_t *wcsncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n)
 {
        wchar_t *a = d;
        while (n && *s) n--, *d++ = *s++;
index fc4bace..037d096 100644 (file)
@@ -93,7 +93,7 @@ static wchar_t *twoway_wcsstr(const wchar_t *h, const wchar_t *n)
        }
 }
 
-wchar_t *wcsstr(const wchar_t *h, const wchar_t *n)
+wchar_t *wcsstr(const wchar_t *restrict h, const wchar_t *restrict n)
 {
        /* Return immediately on empty needle or haystack */
        if (!n[0]) return (wchar_t *)h;
index c932d0a..ecc8033 100644 (file)
@@ -1,6 +1,6 @@
 #include <wchar.h>
 
-wchar_t *wcstok(wchar_t *s, const wchar_t *sep, wchar_t **p)
+wchar_t *wcstok(wchar_t *restrict s, const wchar_t *restrict sep, wchar_t **restrict p)
 {
        if (!s && !(s = *p)) return NULL;
        s += wcsspn(s, sep);
index 330e37c..55a8e1d 100644 (file)
@@ -1,7 +1,7 @@
 #include <string.h>
 #include <wchar.h>
 
-wchar_t *wmemcpy(wchar_t *d, const wchar_t *s, size_t n)
+wchar_t *wmemcpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n)
 {
        wchar_t *a = d;
        while (n--) *d++ = *s++;
index 71133f8..93ba05d 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_getguardsize(const pthread_attr_t *a, size_t *size)
+int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
 {
        *size = a->_a_guardsize + DEFAULT_GUARD_SIZE;
        return 0;
index 804f6f0..5806bdf 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_getschedparam(const pthread_attr_t *a, struct sched_param *param)
+int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param)
 {
        param->sched_priority = 0;
        return 0;
index fc42a52..c0167b6 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_getscope(const pthread_attr_t *a, int *scope)
+int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope)
 {
        return 0;
 }
index 07ac592..70adbb0 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_getstack(const pthread_attr_t *a, void **addr, size_t *size)
+int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size)
 {
        if (!a->_a_stackaddr)
                return EINVAL;
index 9575203..f69cc1e 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_getstacksize(const pthread_attr_t *a, size_t *size)
+int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
 {
        *size = a->_a_stacksize + DEFAULT_STACK_SIZE;
        return 0;
index b305f2f..77ce9c9 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_attr_setschedparam(pthread_attr_t *a, const struct sched_param *param)
+int pthread_attr_setschedparam(pthread_attr_t *restrict a, const struct sched_param *restrict param)
 {
        if (param->sched_priority) return ENOTSUP;
        return 0;
index ccaab4e..01e8cd6 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *a, unsigned count)
+int pthread_barrier_init(pthread_barrier_t *restrict b, const pthread_barrierattr_t *restrict a, unsigned count)
 {
        if (count-1 > INT_MAX-1) return EINVAL;
        *b = (pthread_barrier_t){ ._b_limit = count-1 | (a?*a:0) };
index 8428bbe..df337c2 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_barrierattr_getpshared(const pthread_barrierattr_t *a, int *pshared)
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared)
 {
        *pshared = !!*a;
        return 0;
index 03aff76..2eac30f 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_cond_init(pthread_cond_t *c, const pthread_condattr_t *a)
+int pthread_cond_init(pthread_cond_t *restrict c, const pthread_condattr_t *restrict a)
 {
        memset(c, 0, sizeof *c);
        if (a) {
index 1d0f578..1f25c8e 100644 (file)
@@ -36,7 +36,7 @@ static void cleanup(void *p)
        pthread_mutex_lock(cm->m);
 }
 
-int pthread_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, const struct timespec *ts)
+int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m, const struct timespec *restrict ts)
 {
        struct cm cm = { .c=c, .m=m };
        int r, e=0, seq;
index eb70e5f..8735bf1 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
+int pthread_cond_wait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m)
 {
        return pthread_cond_timedwait(c, m, 0);
 }
index a77cc3e..d293384 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_condattr_getclock(const pthread_condattr_t *a, clockid_t *clk)
+int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk)
 {
        *clk = *a & 0x7fffffff;
        return 0;
index b620976..4991e49 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_condattr_getpshared(const pthread_condattr_t *a, int *pshared)
+int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared)
 {
        *pshared = *a>>31;
        return 0;
index 52b48d6..4567b41 100644 (file)
@@ -84,7 +84,7 @@ static void init_file_lock(FILE *f)
        if (f && f->lock<0) f->lock = 0;
 }
 
-int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(void *), void *arg)
+int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attr, void *(*entry)(void *), void *restrict arg)
 {
        int ret;
        size_t size = DEFAULT_STACK_SIZE + DEFAULT_GUARD_SIZE;
index 75ddf02..fb68927 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a)
+int pthread_mutex_init(pthread_mutex_t *restrict m, const pthread_mutexattr_t *restrict a)
 {
        memset(m, 0, sizeof *m);
        if (a) m->_m_type = *a & 7;
index 44bd4bb..c24270d 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *at)
+int pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec *restrict at)
 {
        int r, t;
 
index 3e0438b..e7340b1 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *pshared)
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared)
 {
        *pshared = *a>>31;
        return 0;
index b83cb7c..4d176f2 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_mutexattr_getrobust(const pthread_mutexattr_t *a, int *robust)
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust)
 {
        *robust = *a / 4U % 2;
        return 0;
index 9edb16c..7688b06 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type)
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type)
 {
        *type = *a & 3;
        return 0;
index f87d566..29003bc 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_rwlock_init(pthread_rwlock_t *rw, const pthread_rwlockattr_t *a)
+int pthread_rwlock_init(pthread_rwlock_t *restrict rw, const pthread_rwlockattr_t *restrict a)
 {
        memset(rw, 0, sizeof *rw);
        if (a) {
index b5cb404..c0c94c9 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_rwlock_timedrdlock(pthread_rwlock_t *rw, const struct timespec *at)
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
 {
        int r, t;
        while ((r=pthread_rwlock_tryrdlock(rw))==EBUSY) {
index aa2fd19..339a167 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_rwlock_timedwrlock(pthread_rwlock_t *rw, const struct timespec *at)
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct timespec *restrict at)
 {
        int r, t;
        while ((r=pthread_rwlock_trywrlock(rw))==EBUSY) {
index 0217bf4..02fd8c8 100644 (file)
@@ -1,6 +1,6 @@
 #include "pthread_impl.h"
 
-int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *a, int *pshared)
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared)
 {
        *pshared = *(int *)a;
        return 0;
index cddc2bc..f6102ad 100644 (file)
@@ -3,7 +3,7 @@
 #include <pthread.h>
 #include "syscall.h"
 
-int pthread_sigmask(int how, const sigset_t *set, sigset_t *old)
+int pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
 {
        int ret;
        if ((unsigned)how - SIG_BLOCK > 2U) return EINVAL;
index 643c096..d9d8307 100644 (file)
@@ -1,6 +1,6 @@
 #include <semaphore.h>
 
-int sem_getvalue(sem_t *sem, int *valp)
+int sem_getvalue(sem_t *restrict sem, int *restrict valp)
 {
        int val = sem->__val[0];
        *valp = val < 0 ? 0 : val;
index 64b4342..6d0d011 100644 (file)
@@ -6,7 +6,7 @@ static void cleanup(void *p)
        a_dec(p);
 }
 
-int sem_timedwait(sem_t *sem, const struct timespec *at)
+int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)
 {
        while (sem_trywait(sem)) {
                int r;
index 7cc4f50..5362f0d 100644 (file)
@@ -5,7 +5,7 @@
 
 const char *__langinfo(nl_item);
 
-char *__asctime(const struct tm *tm, char *buf)
+char *__asctime(const struct tm *restrict tm, char *restrict buf)
 {
        /* FIXME: change __langinfo to __C_langinfo once we have locales */
        if (snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
index e51b880..7dfbb12 100644 (file)
@@ -1,8 +1,8 @@
 #include <time.h>
 
-char *__asctime(const struct tm *, char *);
+char *__asctime(const struct tm *restrict, char *restrict);
 
-char *asctime_r(const struct tm *tm, char *buf)
+char *asctime_r(const struct tm *restrict tm, char *restrict buf)
 {
        return __asctime(tm, buf);
 }
index 09afb70..691f8e9 100644 (file)
@@ -2,7 +2,7 @@
 #include <sys/time.h>
 #include "syscall.h"
 
-int gettimeofday(struct timeval *tv, void *tz)
+int gettimeofday(struct timeval *restrict tv, void *restrict tz)
 {
        struct timespec ts;
        if (!tv) return 0;
index 5b565a6..13a2548 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "__time.h"
 
-struct tm *gmtime_r(const time_t *t, struct tm *result)
+struct tm *gmtime_r(const time_t *restrict t, struct tm *restrict result)
 {
        __time_to_tm(*t, result);
        result->tm_isdst = 0;
index 2bf1037..389a591 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "__time.h"
 
-struct tm *localtime_r(const time_t *t, struct tm *result)
+struct tm *localtime_r(const time_t *restrict t, struct tm *restrict result)
 {
        __tzset();
        __time_to_tm(*t - __timezone, result);
index f1b9463..b69a83a 100644 (file)
@@ -8,7 +8,7 @@
 
 const char *__langinfo(nl_item);
 
-size_t strftime(char *s, size_t n, const char *f, const struct tm *tm)
+size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
 {
        nl_item item;
        int val;
index 4c0bb26..0f66e6c 100644 (file)
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <strings.h>
 
-char *strptime(const char *s, const char *f, struct tm *tm)
+char *strptime(const char *restrict s, const char *restrict f, struct tm *restrict tm)
 {
        int i, w, neg, adj, min, range, *dest;
        const char *ex;
index 813678a..560f1a8 100644 (file)
@@ -76,7 +76,7 @@ static void *start(void *arg)
        return 0;
 }
 
-int timer_create(clockid_t clk, struct sigevent *evp, timer_t *res)
+int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict res)
 {
        static pthread_once_t once = PTHREAD_ONCE_INIT;
        pthread_t td;
index c400d45..baf5076 100644 (file)
@@ -1,7 +1,7 @@
 #include <time.h>
 #include "pthread_impl.h"
 
-int timer_settime(timer_t t, int flags, const struct itimerspec *val, struct itimerspec *old)
+int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, struct itimerspec *restrict old)
 {
        if ((uintptr_t)t >= 0x100000) t = ((pthread_t)t)->result;
        return syscall(SYS_timer_settime, (long)t, flags, val, old);
index 7db7692..da6c1f8 100644 (file)
@@ -2,7 +2,7 @@
 #include <time.h>
 #include <string.h>
 
-size_t wcsftime(wchar_t *wcs, size_t n, const wchar_t *f, const struct tm *tm)
+size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
 {
        size_t k, n0=n;
        char out[100], in[4];
index 0c6d386..ec291e3 100644 (file)
@@ -1,7 +1,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-ssize_t readlink(const char *path, char *buf, size_t bufsize)
+ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize)
 {
        return syscall(SYS_readlink, path, buf, bufsize);
 }
index e949865..9af45cd 100644 (file)
@@ -1,7 +1,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-ssize_t readlinkat(int fd, const char *path, char *buf, size_t bufsize)
+ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize)
 {
        return syscall(SYS_readlinkat, fd, path, buf, bufsize);
 }