From: Ben Gras Date: Sun, 25 Mar 2012 18:51:30 +0000 (+0200) Subject: get rid of _RESTRICT X-Git-Tag: v3.2.1~643 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch12.html?a=commitdiff_plain;h=23df780120c874b4b49e3ca8a8e606c4eeaf3481;p=minix.git get rid of _RESTRICT --- diff --git a/include/minix/ansi.h b/include/minix/ansi.h index 153732855..7cb98a622 100644 --- a/include/minix/ansi.h +++ b/include/minix/ansi.h @@ -1,13 +1,3 @@ -/* The header attempts to decide whether the compiler has enough - * conformance to Standard C for Minix to take advantage of. If so, the - * symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined - * here, but it may be defined by applications that want to bend the rules. - * The magic number in the definition is to inhibit unnecessary bending - * of the rules. (For consistency with the new '#ifdef _ANSI" tests in - * the headers, _ANSI should really be defined as nothing, but that would - * break many library routines that use "#if _ANSI".) - */ - #ifndef _MINIX_ANSI_H #define _MINIX_ANSI_H @@ -23,29 +13,8 @@ #define __LONG_LONG_SUPPORTED 1 #endif -/* This should be defined as restrict when a C99 compiler is used. */ -#define _RESTRICT - -#ifdef __NBSD_LIBC /* Setting of _POSIX_SOURCE (or _NETBSD_SOURCE) in NBSD headers is * done in */ #include -/* Also, do not redefine _BSD_VA_LIST */ - -#else /* !__NBSD_LIBC */ - -/* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies - * _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.) - */ -#if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE) -#undef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif - -/* What is a va_list? */ -#include -#define _BSD_VA_LIST_ va_list -#endif /* !__NBSD_LIBC */ - #endif /* _MINIX_ANSI_H */ diff --git a/lib/libc/sys-minix/accept.c b/lib/libc/sys-minix/accept.c index 6f192bd16..390353308 100644 --- a/lib/libc/sys-minix/accept.c +++ b/lib/libc/sys-minix/accept.c @@ -21,14 +21,14 @@ #define DEBUG 0 -static int _tcp_accept(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len); +static int _tcp_accept(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len); -static int _uds_accept(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len); +static int _uds_accept(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len); -int accept(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +int accept(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r; nwio_udpopt_t udpopt; @@ -61,8 +61,8 @@ int accept(int sock, struct sockaddr *_RESTRICT address, return r; } -static int _tcp_accept(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +static int _tcp_accept(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r, s1, t_errno; tcp_cookie_t cookie; @@ -91,8 +91,8 @@ static int _tcp_accept(int sock, struct sockaddr *_RESTRICT address, return s1; } -static int _uds_accept(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +static int _uds_accept(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int s1; int r; diff --git a/lib/libc/sys-minix/getpeername.c b/lib/libc/sys-minix/getpeername.c index 27eb337bd..295c28125 100644 --- a/lib/libc/sys-minix/getpeername.c +++ b/lib/libc/sys-minix/getpeername.c @@ -17,14 +17,14 @@ #define DEBUG 0 -static int _tcp_getpeername(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp); +static int _tcp_getpeername(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconfp); -static int _uds_getpeername(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr); +static int _uds_getpeername(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr); -int getpeername(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +int getpeername(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r; nwio_tcpconf_t tcpconf; @@ -62,8 +62,8 @@ int getpeername(int sock, struct sockaddr *_RESTRICT address, return -1; } -static int _tcp_getpeername(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp) +static int _tcp_getpeername(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconfp) { socklen_t len; struct sockaddr_in sin; @@ -89,8 +89,8 @@ static int _tcp_getpeername(int sock, struct sockaddr *_RESTRICT address, return 0; } -static int _uds_getpeername(int sock, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr) +static int _uds_getpeername(int sock, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr) { socklen_t len; diff --git a/lib/libc/sys-minix/getsockname.c b/lib/libc/sys-minix/getsockname.c index 899d095e2..cbc0574bd 100644 --- a/lib/libc/sys-minix/getsockname.c +++ b/lib/libc/sys-minix/getsockname.c @@ -26,14 +26,14 @@ #define DEBUG 0 */ -static int _tcp_getsockname(int fd, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp); +static int _tcp_getsockname(int fd, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconfp); -static int _uds_getsockname(int fd, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr); +static int _uds_getsockname(int fd, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr); -int getsockname(int fd, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +int getsockname(int fd, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r; nwio_tcpconf_t tcpconf; @@ -76,8 +76,8 @@ int getsockname(int fd, struct sockaddr *_RESTRICT address, } -static int _tcp_getsockname(int fd, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconf) +static int _tcp_getsockname(int fd, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconf) { socklen_t len; struct sockaddr_in sin; @@ -105,8 +105,8 @@ static int _tcp_getsockname(int fd, struct sockaddr *_RESTRICT address, return 0; } -static int _uds_getsockname(int fd, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr) +static int _uds_getsockname(int fd, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr) { socklen_t len; diff --git a/lib/libc/sys-minix/getsockopt.c b/lib/libc/sys-minix/getsockopt.c index 28aa4d754..e57d34233 100644 --- a/lib/libc/sys-minix/getsockopt.c +++ b/lib/libc/sys-minix/getsockopt.c @@ -23,16 +23,16 @@ #define DEBUG 0 static int _tcp_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len); + void *restrict option_value, socklen_t *restrict option_len); static int _udp_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len); + void *restrict option_value, socklen_t *restrict option_len); static int _uds_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len); + void *restrict option_value, socklen_t *restrict option_len); static void getsockopt_copy(void *return_value, size_t return_len, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len); + void *restrict option_value, socklen_t *restrict option_len); int getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) + void *restrict option_value, socklen_t *restrict option_len) { int r; nwio_tcpopt_t tcpopt; @@ -84,7 +84,7 @@ int getsockopt(int sock, int level, int option_name, } static void getsockopt_copy(void *return_value, size_t return_len, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) + void *restrict option_value, socklen_t *restrict option_len) { /* copy as much data as possible */ if (*option_len < return_len) @@ -97,7 +97,7 @@ static void getsockopt_copy(void *return_value, size_t return_len, } static int _tcp_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) + void *restrict option_value, socklen_t *restrict option_len) { int i, r, err; @@ -158,7 +158,7 @@ static int _tcp_getsockopt(int sock, int level, int option_name, } static int _udp_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) + void *restrict option_value, socklen_t *restrict option_len) { int i; @@ -178,7 +178,7 @@ static int _udp_getsockopt(int sock, int level, int option_name, } static int _uds_getsockopt(int sock, int level, int option_name, - void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) + void *restrict option_value, socklen_t *restrict option_len) { int i, r; size_t size; diff --git a/lib/libc/sys-minix/gettimeofday.c b/lib/libc/sys-minix/gettimeofday.c index 10e51a263..1532ef302 100644 --- a/lib/libc/sys-minix/gettimeofday.c +++ b/lib/libc/sys-minix/gettimeofday.c @@ -12,7 +12,7 @@ gettimeofday.c __weak_alias(gettimeofday, _gettimeofday) #endif -int gettimeofday(struct timeval *_RESTRICT tp, void *_RESTRICT tzp) +int gettimeofday(struct timeval *restrict tp, void *restrict tzp) { message m; diff --git a/lib/libc/sys-minix/recvfrom.c b/lib/libc/sys-minix/recvfrom.c index 9327e7a93..393372b81 100644 --- a/lib/libc/sys-minix/recvfrom.c +++ b/lib/libc/sys-minix/recvfrom.c @@ -23,22 +23,22 @@ #define DEBUG 0 -static ssize_t _tcp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, - int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp); -static ssize_t _udp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, - int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_udpopt_t *udpoptp); -static ssize_t _uds_recvfrom_conn(int sock, void *_RESTRICT buffer, - size_t length, int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr); -static ssize_t _uds_recvfrom_dgram(int sock, void *_RESTRICT buffer, - size_t length, int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len); - -ssize_t recvfrom(int sock, void *_RESTRICT buffer, size_t length, - int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +static ssize_t _tcp_recvfrom(int sock, void *restrict buffer, size_t length, + int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconfp); +static ssize_t _udp_recvfrom(int sock, void *restrict buffer, size_t length, + int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_udpopt_t *udpoptp); +static ssize_t _uds_recvfrom_conn(int sock, void *restrict buffer, + size_t length, int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr); +static ssize_t _uds_recvfrom_dgram(int sock, void *restrict buffer, + size_t length, int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len); + +ssize_t recvfrom(int sock, void *restrict buffer, size_t length, + int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r; nwio_tcpconf_t tcpconf; @@ -94,9 +94,9 @@ ssize_t recvfrom(int sock, void *_RESTRICT buffer, size_t length, return -1; } -static ssize_t _tcp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, - int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp) +static ssize_t _tcp_recvfrom(int sock, void *restrict buffer, size_t length, + int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_tcpconf_t *tcpconfp) { int r; size_t len; @@ -128,9 +128,9 @@ static ssize_t _tcp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, return r; } -static ssize_t _udp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, - int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, nwio_udpopt_t *udpoptp) +static ssize_t _udp_recvfrom(int sock, void *restrict buffer, size_t length, + int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, nwio_udpopt_t *udpoptp) { int r, t_errno; size_t buflen, len; @@ -227,9 +227,9 @@ static ssize_t _udp_recvfrom(int sock, void *_RESTRICT buffer, size_t length, return length; } -static ssize_t _uds_recvfrom_conn(int sock, void *_RESTRICT buffer, - size_t length, int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr) +static ssize_t _uds_recvfrom_conn(int sock, void *restrict buffer, + size_t length, int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len, struct sockaddr_un *uds_addr) { int r; size_t len; @@ -262,9 +262,9 @@ static ssize_t _uds_recvfrom_conn(int sock, void *_RESTRICT buffer, return r; } -static ssize_t _uds_recvfrom_dgram(int sock, void *_RESTRICT buffer, - size_t length, int flags, struct sockaddr *_RESTRICT address, - socklen_t *_RESTRICT address_len) +static ssize_t _uds_recvfrom_dgram(int sock, void *restrict buffer, + size_t length, int flags, struct sockaddr *restrict address, + socklen_t *restrict address_len) { int r; size_t len; diff --git a/lib/libc/sys-minix/setitimer.c b/lib/libc/sys-minix/setitimer.c index d69740cab..7a01b1d14 100644 --- a/lib/libc/sys-minix/setitimer.c +++ b/lib/libc/sys-minix/setitimer.c @@ -8,8 +8,8 @@ * This is the implementation of the function to * invoke the interval timer setting system call. */ -int setitimer(int which, const struct itimerval *_RESTRICT value, - struct itimerval *_RESTRICT ovalue) +int setitimer(int which, const struct itimerval *restrict value, + struct itimerval *restrict ovalue) { message m;