diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-09-06 22:44:55 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-09-06 22:44:55 -0400 |
commit | 400c5e5c8307a2ebe44ef1f203f5a15669f20347 (patch) | |
tree | 087a48dc8251fa05f6866af8ebf96b69450b15ab /include | |
parent | bac03cdde1137c16b4c194e137310e2748661dcc (diff) | |
download | musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.tar.gz musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.tar.bz2 musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.tar.xz musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.zip |
use restrict everywhere it's required by c99 and/or posix 2008
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/aio.h | 8 | ||||
-rw-r--r-- | include/arpa/inet.h | 10 | ||||
-rw-r--r-- | include/dirent.h | 8 | ||||
-rw-r--r-- | include/dlfcn.h | 8 | ||||
-rw-r--r-- | include/glob.h | 8 | ||||
-rw-r--r-- | include/iconv.h | 8 | ||||
-rw-r--r-- | include/inttypes.h | 14 | ||||
-rw-r--r-- | include/monetary.h | 10 | ||||
-rw-r--r-- | include/mqueue.h | 10 | ||||
-rw-r--r-- | include/netdb.h | 10 | ||||
-rw-r--r-- | include/pthread.h | 60 | ||||
-rw-r--r-- | include/regex.h | 12 | ||||
-rw-r--r-- | include/search.h | 9 | ||||
-rw-r--r-- | include/semaphore.h | 10 | ||||
-rw-r--r-- | include/signal.h | 20 | ||||
-rw-r--r-- | include/spawn.h | 28 | ||||
-rw-r--r-- | include/stdio.h | 62 | ||||
-rw-r--r-- | include/stdlib.h | 28 | ||||
-rw-r--r-- | include/string.h | 30 | ||||
-rw-r--r-- | include/sys/select.h | 10 | ||||
-rw-r--r-- | include/sys/socket.h | 16 | ||||
-rw-r--r-- | include/sys/stat.h | 12 | ||||
-rw-r--r-- | include/sys/statvfs.h | 8 | ||||
-rw-r--r-- | include/sys/time.h | 10 | ||||
-rw-r--r-- | include/time.h | 22 | ||||
-rw-r--r-- | include/unistd.h | 12 | ||||
-rw-r--r-- | include/wchar.h | 86 | ||||
-rw-r--r-- | include/wordexp.h | 8 |
28 files changed, 353 insertions, 184 deletions
diff --git a/include/aio.h b/include/aio.h index 2edd5a2e..3e351348 100644 --- a/include/aio.h +++ b/include/aio.h @@ -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 diff --git a/include/arpa/inet.h b/include/arpa/inet.h index b604f60b..82e2ac1b 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -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 */ diff --git a/include/dirent.h b/include/dirent.h index c19f7d58..b6261595 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -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 *); diff --git a/include/dlfcn.h b/include/dlfcn.h index e98c8ca6..2e7d0283 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -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 { diff --git a/include/glob.h b/include/glob.h index 376baa71..c49a2dea 100644 --- a/include/glob.h +++ b/include/glob.h @@ -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 diff --git a/include/iconv.h b/include/iconv.h index f2ccaf8c..cef06f60 100644 --- a/include/iconv.h +++ b/include/iconv.h @@ -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 diff --git a/include/inttypes.h b/include/inttypes.h index 13ba6e0f..23acc5be 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -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 diff --git a/include/monetary.h b/include/monetary.h index df904eb0..11dabb23 100644 --- a/include/monetary.h +++ b/include/monetary.h @@ -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 } diff --git a/include/mqueue.h b/include/mqueue.h index 92e6ae5e..bd35842c 100644 --- a/include/mqueue.h +++ b/include/mqueue.h @@ -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 *); diff --git a/include/netdb.h b/include/netdb.h index 42a4b682..d915d9d5 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -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); diff --git a/include/pthread.h b/include/pthread.h index d4ffb9ab..417156c8 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -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); diff --git a/include/regex.h b/include/regex.h index d57208a5..b7167b87 100644 --- a/include/regex.h +++ b/include/regex.h @@ -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 } diff --git a/include/search.h b/include/search.h index 7c4fc583..680eee75 100644 --- a/include/search.h +++ b/include/search.h @@ -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)); diff --git a/include/semaphore.h b/include/semaphore.h index 2e9b8100..724957fb 100644 --- a/include/semaphore.h +++ b/include/semaphore.h @@ -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 *); diff --git a/include/signal.h b/include/signal.h index d4856a89..e0dae192 100644 --- a/include/signal.h +++ b/include/signal.h @@ -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); diff --git a/include/spawn.h b/include/spawn.h index 99ec6f1d..c934d423 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -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); diff --git a/include/stdio.h b/include/stdio.h index 9aa2f782..7d3130e2 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -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 diff --git a/include/stdlib.h b/include/stdlib.h index 1749cb3b..14cc71bb 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -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); diff --git a/include/string.h b/include/string.h index 24cb1ca3..f96f71ee 100644 --- a/include/string.h +++ b/include/string.h @@ -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 diff --git a/include/sys/select.h b/include/sys/select.h index 47d195f4..dd4176dd 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -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 diff --git a/include/sys/socket.h b/include/sys/socket.h index a384ca12..7024d232 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -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); diff --git a/include/sys/stat.h b/include/sys/stat.h index 2a7ce233..e16a9682 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -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); diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h index 0a3ac9e0..be41c287 100644 --- a/include/sys/statvfs.h +++ b/include/sys/statvfs.h @@ -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 diff --git a/include/sys/time.h b/include/sys/time.h index 144dd230..bf026432 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -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 diff --git a/include/time.h b/include/time.h index 3cc0d28a..f24789e4 100644 --- a/include/time.h +++ b/include/time.h @@ -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]; diff --git a/include/unistd.h b/include/unistd.h index 12d153b8..ecb23f81 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -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) \ diff --git a/include/wchar.h b/include/wchar.h index 12ddd4f4..b1c6b7fa 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -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) diff --git a/include/wordexp.h b/include/wordexp.h index 0691c8ea..e7eb3255 100644 --- a/include/wordexp.h +++ b/include/wordexp.h @@ -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 |