* libc/sys/linux/include/netdb.h, libc/sys/linux/net/getaddrinfo.c,

libc/sys/linux/net/getnameinfo.c: Add restrict keyword to getnameinfo()
	and getaddrinfo() to increase standards compliance and match glibc.

	* libc/include/string.h, libc/string/memccpy.c, libc/string/memcpy.c,
	libc/string/stpcpy.c, libc/string/stpncpy.c, libc/string/strcat.c,
	libc/string/strncat.c, libc/string/strncpy.c, libc/string/strtok.c,
	libc/string/strtok_r.c, libc/string/strxfrm.c
	libc/machine/microblaze/strcpy.c, libc/machine/xscale/memcpy.c,
	libc/machine/cris/memcpy.c: Add __restrict to prototype to
	increase standards compliance.
This commit is contained in:
Corinna Vinschen 2013-07-23 07:05:31 +00:00
parent 9cb407b524
commit b143d094ee
18 changed files with 83 additions and 57 deletions

View File

@ -1,3 +1,19 @@
2013-07-23 Sahil Patnayakuni <sahilp@rtems.org>
* libc/sys/linux/include/netdb.h, libc/sys/linux/net/getaddrinfo.c,
libc/sys/linux/net/getnameinfo.c: Add restrict keyword to getnameinfo()
and getaddrinfo() to increase standards compliance and match glibc.
2013-07-23 Sahil Patnayakuni <sahilp@rtems.org>
* libc/include/string.h, libc/string/memccpy.c, libc/string/memcpy.c,
libc/string/stpcpy.c, libc/string/stpncpy.c, libc/string/strcat.c,
libc/string/strncat.c, libc/string/strncpy.c, libc/string/strtok.c,
libc/string/strtok_r.c, libc/string/strxfrm.c
libc/machine/microblaze/strcpy.c, libc/machine/xscale/memcpy.c,
libc/machine/cris/memcpy.c: Add __restrict to prototype to
increase standards compliance.
2013-07-18 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2013-07-18 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* libc/sys/arm/syscalls.c (do_AngelSWI): Delete. * libc/sys/arm/syscalls.c (do_AngelSWI): Delete.

View File

@ -20,47 +20,47 @@ _BEGIN_STD_C
_PTR _EXFUN(memchr,(const _PTR, int, size_t)); _PTR _EXFUN(memchr,(const _PTR, int, size_t));
int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); int _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); _PTR _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t));
_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); _PTR _EXFUN(memmove,(_PTR, const _PTR, size_t));
_PTR _EXFUN(memset,(_PTR, int, size_t)); _PTR _EXFUN(memset,(_PTR, int, size_t));
char *_EXFUN(strcat,(char *, const char *)); char *_EXFUN(strcat,(char *__restrict, const char *__restrict));
char *_EXFUN(strchr,(const char *, int)); char *_EXFUN(strchr,(const char *, int));
int _EXFUN(strcmp,(const char *, const char *)); int _EXFUN(strcmp,(const char *, const char *));
int _EXFUN(strcoll,(const char *, const char *)); int _EXFUN(strcoll,(const char *, const char *));
char *_EXFUN(strcpy,(char *, const char *)); char *_EXFUN(strcpy,(char *__restrict, const char *__restrict));
size_t _EXFUN(strcspn,(const char *, const char *)); size_t _EXFUN(strcspn,(const char *, const char *));
char *_EXFUN(strerror,(int)); char *_EXFUN(strerror,(int));
size_t _EXFUN(strlen,(const char *)); size_t _EXFUN(strlen,(const char *));
char *_EXFUN(strncat,(char *, const char *, size_t)); char *_EXFUN(strncat,(char *__restrict, const char *__restrict, size_t));
int _EXFUN(strncmp,(const char *, const char *, size_t)); int _EXFUN(strncmp,(const char *, const char *, size_t));
char *_EXFUN(strncpy,(char *, const char *, size_t)); char *_EXFUN(strncpy,(char *__restrict, const char *__restrict, size_t));
char *_EXFUN(strpbrk,(const char *, const char *)); char *_EXFUN(strpbrk,(const char *, const char *));
char *_EXFUN(strrchr,(const char *, int)); char *_EXFUN(strrchr,(const char *, int));
size_t _EXFUN(strspn,(const char *, const char *)); size_t _EXFUN(strspn,(const char *, const char *));
char *_EXFUN(strstr,(const char *, const char *)); char *_EXFUN(strstr,(const char *, const char *));
#ifndef _REENT_ONLY #ifndef _REENT_ONLY
char *_EXFUN(strtok,(char *, const char *)); char *_EXFUN(strtok,(char *__restrict, const char *__restrict));
#endif #endif
size_t _EXFUN(strxfrm,(char *, const char *, size_t)); size_t _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t));
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
char *_EXFUN(strtok_r,(char *, const char *, char **)); char *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict));
int _EXFUN(bcmp,(const void *, const void *, size_t)); int _EXFUN(bcmp,(const void *, const void *, size_t));
void _EXFUN(bcopy,(const void *, void *, size_t)); void _EXFUN(bcopy,(const void *, void *, size_t));
void _EXFUN(bzero,(void *, size_t)); void _EXFUN(bzero,(void *, size_t));
int _EXFUN(ffs,(int)); int _EXFUN(ffs,(int));
char *_EXFUN(index,(const char *, int)); char *_EXFUN(index,(const char *, int));
_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); _PTR _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t));
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t)); _PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t)); _PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
_PTR _EXFUN(memrchr,(const _PTR, int, size_t)); _PTR _EXFUN(memrchr,(const _PTR, int, size_t));
_PTR _EXFUN(rawmemchr,(const _PTR, int)); _PTR _EXFUN(rawmemchr,(const _PTR, int));
char *_EXFUN(rindex,(const char *, int)); char *_EXFUN(rindex,(const char *, int));
char *_EXFUN(stpcpy,(char *, const char *)); char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict));
char *_EXFUN(stpncpy,(char *, const char *, size_t)); char *_EXFUN(stpncpy,(char *__restrict, const char *__restrict, size_t));
int _EXFUN(strcasecmp,(const char *, const char *)); int _EXFUN(strcasecmp,(const char *, const char *));
char *_EXFUN(strcasestr,(const char *, const char *)); char *_EXFUN(strcasestr,(const char *, const char *));
char *_EXFUN(strchrnul,(const char *, int)); char *_EXFUN(strchrnul,(const char *, int));

View File

@ -40,7 +40,7 @@
__asm__ (".syntax no_register_prefix"); __asm__ (".syntax no_register_prefix");
void * void *
memcpy(void *pdst, const void *psrc, size_t pn) memcpy(void *__restrict pdst, const void *__restrict psrc, size_t pn)
{ {
/* Now we want the parameters put in special registers. /* Now we want the parameters put in special registers.
Make sure the compiler is able to make something useful of this. Make sure the compiler is able to make something useful of this.

View File

@ -36,7 +36,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *strcpy(char *<[dst]>, const char *<[src]>); char *strcpy(char *restrict <[dst]>, const char *restrict <[src]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -88,8 +88,8 @@ QUICKREF
char* char*
_DEFUN (strcpy, (dst0, src0), _DEFUN (strcpy, (dst0, src0),
char *dst0 _AND char *__restrict dst0 _AND
_CONST char *src0) _CONST char *__restrict src0)
{ {
#ifndef HAVE_HW_PCMP #ifndef HAVE_HW_PCMP

View File

@ -8,7 +8,7 @@
#include "xscale.h" #include "xscale.h"
void * void *
memcpy (void *dst0, const void *src0, size_t len) memcpy (void *__restrict dst0, const void *__restrict src0, size_t len)
{ {
int dummy; int dummy;
asm volatile ( asm volatile (

View File

@ -4,7 +4,7 @@ FUNCTION
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
void* memccpy(void *<[out]>, const void *<[in]>, void* memccpy(void *restrict <[out]>, const void *restrict <[in]>,
int <[endchar]>, size_t <[n]>); int <[endchar]>, size_t <[n]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -64,8 +64,8 @@ PORTABILITY
_PTR _PTR
_DEFUN (memccpy, (dst0, src0, endchar, len0), _DEFUN (memccpy, (dst0, src0, endchar, len0),
_PTR dst0 _AND _PTR __restrict dst0 _AND
_CONST _PTR src0 _AND _CONST _PTR __restrict src0 _AND
int endchar0 _AND int endchar0 _AND
size_t len0) size_t len0)
{ {

View File

@ -4,7 +4,8 @@ FUNCTION
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
void* memcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); void* memcpy(void *restrict <[out]>, const void *restrict <[in]>,
size_t <[n]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -51,8 +52,8 @@ QUICKREF
_PTR _PTR
_DEFUN (memcpy, (dst0, src0, len0), _DEFUN (memcpy, (dst0, src0, len0),
_PTR dst0 _AND _PTR __restrict dst0 _AND
_CONST _PTR src0 _AND _CONST _PTR __restrict src0 _AND
size_t len0) size_t len0)
{ {
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)

View File

@ -7,7 +7,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *stpcpy(char *<[dst]>, const char *<[src]>); char *stpcpy(char *restrict <[dst]>, const char *restrict <[src]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -60,8 +60,8 @@ QUICKREF
char* char*
_DEFUN (stpcpy, (dst, src), _DEFUN (stpcpy, (dst, src),
char *dst _AND char *__restrict dst _AND
_CONST char *src) _CONST char *__restrict src)
{ {
#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
long *aligned_dst; long *aligned_dst;

View File

@ -7,7 +7,8 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *stpncpy(char *<[dst]>, const char *<[src]>, size_t <[length]>); char *stpncpy(char *restrict <[dst]>, const char *restrict <[src]>,
size_t <[length]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -68,8 +69,8 @@ QUICKREF
char * char *
_DEFUN (stpncpy, (dst, src), _DEFUN (stpncpy, (dst, src),
char *dst _AND char *__restrict dst _AND
_CONST char *src _AND _CONST char *__restrict src _AND
size_t count) size_t count)
{ {
char *ret = NULL; char *ret = NULL;

View File

@ -7,7 +7,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *strcat(char *<[dst]>, const char *<[src]>); char *strcat(char *restrict <[dst]>, const char *restrict <[src]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -61,8 +61,8 @@ QUICKREF
char * char *
_DEFUN (strcat, (s1, s2), _DEFUN (strcat, (s1, s2),
char *s1 _AND char *__restrict s1 _AND
_CONST char *s2) _CONST char *__restrict s2)
{ {
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = s1; char *s = s1;

View File

@ -7,7 +7,8 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *strncat(char *<[dst]>, const char *<[src]>, size_t <[length]>); char *strncat(char *<restrict [dst]>, const char *<restrict [src]>,
size_t <[length]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -65,8 +66,8 @@ QUICKREF
char * char *
_DEFUN (strncat, (s1, s2, n), _DEFUN (strncat, (s1, s2, n),
char *s1 _AND char *__restrict s1 _AND
_CONST char *s2 _AND _CONST char *__restrict s2 _AND
size_t n) size_t n)
{ {
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)

View File

@ -7,7 +7,8 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *strncpy(char *<[dst]>, const char *<[src]>, size_t <[length]>); char *strncpy(char *restrict <[dst]>, const char *restrict <[src]>,
size_t <[length]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -66,8 +67,8 @@ QUICKREF
char * char *
_DEFUN (strncpy, (dst0, src0), _DEFUN (strncpy, (dst0, src0),
char *dst0 _AND char *__restrict dst0 _AND
_CONST char *src0 _AND _CONST char *__restrict src0 _AND
size_t count) size_t count)
{ {
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)

View File

@ -13,8 +13,10 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
char *strtok(char *<[source]>, const char *<[delimiters]>) char *strtok(char *restrict <[source]>,
char *strtok_r(char *<[source]>, const char *<[delimiters]>, const char *restrict <[delimiters]>)
char *strtok_r(char *restrict <[source]>,
const char *restrict <[delimiters]>,
char **<[lasts]>) char **<[lasts]>)
char *strsep(char **<[source_ptr]>, const char *<[delimiters]>) char *strsep(char **<[source_ptr]>, const char *<[delimiters]>)
@ -92,8 +94,8 @@ extern char *__strtok_r (char *, const char *, char **, int);
char * char *
_DEFUN (strtok, (s, delim), _DEFUN (strtok, (s, delim),
register char *s _AND register char *__restrict s _AND
register const char *delim) register const char *__restrict delim)
{ {
struct _reent *reent = _REENT; struct _reent *reent = _REENT;

View File

@ -91,9 +91,9 @@ cont:
char * char *
_DEFUN (strtok_r, (s, delim, lasts), _DEFUN (strtok_r, (s, delim, lasts),
register char *s _AND register char *__restrict s _AND
register const char *delim _AND register const char *__restrict delim _AND
char **lasts) char **__restrict lasts)
{ {
return __strtok_r (s, delim, lasts, 1); return __strtok_r (s, delim, lasts, 1);
} }

View File

@ -7,7 +7,8 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <string.h> #include <string.h>
size_t strxfrm(char *<[s1]>, const char *<[s2]>, size_t <[n]>); size_t strxfrm(char *restrict <[s1]>, const char *restrict <[s2]>,
size_t <[n]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <string.h> #include <string.h>
@ -52,8 +53,8 @@ QUICKREF
size_t size_t
_DEFUN (strxfrm, (s1, s2, n), _DEFUN (strxfrm, (s1, s2, n),
char *s1 _AND char *__restrict s1 _AND
_CONST char *s2 _AND _CONST char *__restrict s2 _AND
size_t n) size_t n)
{ {
size_t res; size_t res;

View File

@ -256,10 +256,12 @@ void sethostent_r(int, FILE **, int *);
/* void sethostfile(const char *); */ /* void sethostfile(const char *); */
void setnetent(int); void setnetent(int);
void setprotoent(int); void setprotoent(int);
int getaddrinfo(const char *, const char *, int getaddrinfo(const char *__restrict, const char *__restrict,
const struct addrinfo *, struct addrinfo **); const struct addrinfo *__restrict,
int getnameinfo(const struct sockaddr *, socklen_t, char *, struct addrinfo **__restrict);
socklen_t, char *, socklen_t, unsigned int); int getnameinfo(const struct sockaddr *__restrict, socklen_t,
char *__restrict, socklen_t, char *__restrict,
socklen_t, unsigned int);
void freeaddrinfo(struct addrinfo *); void freeaddrinfo(struct addrinfo *);
char *gai_strerror(int); char *gai_strerror(int);
int setnetgrent(const char *); int setnetgrent(const char *);

View File

@ -1473,8 +1473,9 @@ rfc3484_sort (const void *p1, const void *p2)
int int
getaddrinfo (const char *name, const char *service, getaddrinfo (const char *__restrict name, const char *__restrict service,
const struct addrinfo *hints, struct addrinfo **pai) const struct addrinfo *__restrict hints,
struct addrinfo **__restrict pai)
{ {
int i = 0, j = 0, last_i = 0; int i = 0, j = 0, last_i = 0;
int nresults = 0; int nresults = 0;

View File

@ -160,9 +160,9 @@ nrl_domainname (void)
int int
getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, getnameinfo (const struct sockaddr *__restrict sa, socklen_t addrlen,
socklen_t hostlen, char *serv, socklen_t servlen, char *__restrict host, socklen_t hostlen, char *__restrict serv,
unsigned int flags) socklen_t servlen, unsigned int flags)
{ {
int serrno = errno; int serrno = errno;
int tmpbuflen = 1024; int tmpbuflen = 1024;