From 400c5e5c8307a2ebe44ef1f203f5a15669f20347 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 6 Sep 2012 22:44:55 -0400 Subject: 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. --- include/signal.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'include/signal.h') 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); -- cgit v1.2.1