diff options
-rw-r--r-- | newlib/ChangeLog | 11 | ||||
-rw-r--r-- | newlib/libc/include/stdlib.h | 36 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbstowcs.c | 6 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbstowcs_r.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbtowc.c | 6 | ||||
-rw-r--r-- | newlib/libc/stdlib/mbtowc_r.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtod.c | 16 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtol.c | 12 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtold.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoll.c | 8 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoll_r.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoul.c | 14 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoull.c | 10 | ||||
-rw-r--r-- | newlib/libc/stdlib/strtoull_r.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/wcstombs.c | 6 | ||||
-rw-r--r-- | newlib/libc/stdlib/wcstombs_r.c | 4 |
16 files changed, 79 insertions, 68 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 989e7fb4d..1b8fa7385 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,14 @@ +2013-11-18 Sahil Patnayakuni <sahilp@oarcorp.com> + + * libc/include/stdlib.h, libc/stdlib/mbstowcs.c, + libc/stdlib/mbstowcs_r.c, libc/stdlib/mbtowc.c, + libc/stdlib/mbtowc_r.c, libc/stdlib/strtod.c, + libc/stdlib/strtol.c, libc/stdlib/strtold.c, + libc/stdlib/strtoll.c, libc/stdlib/strtoll_r.c, + libc/stdlib/strtoul.c, libc/stdlib/strtoull.c, + libc/stdlib/strtoull_r.c, libc/stdlib/wcstombs.c, + libc/stdlib/wcstombs_r.c: Add restrict keyword. + 2013-11-18 Marcus Shawcroft <marcus.shawcroft@arm.com> * libc/include/sys/unistd.h (ftruncate, truncate): Define diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index fc15a3cce..4afc3f967 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -94,14 +94,14 @@ ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); _PTR _EXFUN_NOTHROW(malloc,(size_t __size)); int _EXFUN(mblen,(const char *, size_t)); int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *)); -int _EXFUN(mbtowc,(wchar_t *, const char *, size_t)); -int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *)); +int _EXFUN(mbtowc,(wchar_t *__restrict, const char *__restrict, size_t)); +int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); int _EXFUN(wctomb,(char *, wchar_t)); int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *)); -size_t _EXFUN(mbstowcs,(wchar_t *, const char *, size_t)); -size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *)); -size_t _EXFUN(wcstombs,(char *, const wchar_t *, size_t)); -size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, _mbstate_t *)); +size_t _EXFUN(mbstowcs,(wchar_t *__restrict, const char *__restrict, size_t)); +size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); +size_t _EXFUN(wcstombs,(char *__restrict, const wchar_t *__restrict, size_t)); +size_t _EXFUN(_wcstombs_r,(struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *)); #ifndef __STRICT_ANSI__ #ifndef _REENT_ONLY char * _EXFUN(mkdtemp,(char *)); @@ -125,10 +125,10 @@ _PTR _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size)); _PTR _EXFUN(reallocf,(_PTR __r, size_t __size)); #endif _VOID _EXFUN(srand,(unsigned __seed)); -double _EXFUN(strtod,(const char *__n, char **__end_PTR)); -double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR)); +double _EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR)); +double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR)); #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) -float _EXFUN(strtof,(const char *__n, char **__end_PTR)); +float _EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR)); #endif #ifndef __STRICT_ANSI__ /* the following strtodf interface is deprecated...use strtof instead */ @@ -136,10 +136,10 @@ float _EXFUN(strtof,(const char *__n, char **__end_PTR)); # define strtodf strtof # endif #endif -long _EXFUN(strtol,(const char *__n, char **__end_PTR, int __base)); -long _EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base)); -unsigned long _EXFUN(strtoul,(const char *__n, char **__end_PTR, int __base)); -unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *__n, char **__end_PTR, int __base)); +long _EXFUN(strtol,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); +long _EXFUN(_strtol_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); +unsigned long _EXFUN(strtoul,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); +unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); int _EXFUN(system,(const char *__string)); @@ -192,16 +192,16 @@ long long _EXFUN(llabs,(long long)); lldiv_t _EXFUN(lldiv,(long long __numer, long long __denom)); #endif /* ! __STRICT_ANSI__ */ #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) -long long _EXFUN(strtoll,(const char *__n, char **__end_PTR, int __base)); +long long _EXFUN(strtoll,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); #endif #ifndef __STRICT_ANSI__ -long long _EXFUN(_strtoll_r,(struct _reent *, const char *__n, char **__end_PTR, int __base)); +long long _EXFUN(_strtoll_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); #endif /* ! __STRICT_ANSI__ */ #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) -unsigned long long _EXFUN(strtoull,(const char *__n, char **__end_PTR, int __base)); +unsigned long long _EXFUN(strtoull,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); #endif #ifndef __STRICT_ANSI__ -unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__n, char **__end_PTR, int __base)); +unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); #ifndef __CYGWIN__ _VOID _EXFUN(cfree,(_PTR)); @@ -230,7 +230,7 @@ _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)) /* On platforms where long double equals double. */ #ifdef _LDBL_EQ_DBL #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) -extern long double strtold (const char *, char **); +extern long double strtold (const char *__restrict, char **__restrict); #endif extern long double wcstold (const wchar_t *, wchar_t **); #endif /* _LDBL_EQ_DBL */ diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c index 334b5f54d..09543451c 100644 --- a/newlib/libc/stdlib/mbstowcs.c +++ b/newlib/libc/stdlib/mbstowcs.c @@ -7,7 +7,7 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - int mbstowcs(wchar_t *<[pwc]>, const char *<[s]>, size_t <[n]>); + int mbstowcs(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -55,8 +55,8 @@ effects vary with the locale. size_t _DEFUN (mbstowcs, (pwcs, s, n), - wchar_t *pwcs _AND - const char *s _AND + wchar_t *__restrict pwcs _AND + const char *__restrict s _AND size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mbstowcs_r.c b/newlib/libc/stdlib/mbstowcs_r.c index 3ba867711..cae1f0693 100644 --- a/newlib/libc/stdlib/mbstowcs_r.c +++ b/newlib/libc/stdlib/mbstowcs_r.c @@ -5,8 +5,8 @@ size_t _DEFUN (_mbstowcs_r, (reent, pwcs, s, n, state), struct _reent *r _AND - wchar_t *pwcs _AND - const char *s _AND + wchar_t *__restrict pwcs _AND + const char *__restrict s _AND size_t n _AND mbstate_t *state) { diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c index 8da309e2d..3c7f84b9e 100644 --- a/newlib/libc/stdlib/mbtowc.c +++ b/newlib/libc/stdlib/mbtowc.c @@ -7,7 +7,7 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - int mbtowc(wchar_t *<[pwc]>, const char *<[s]>, size_t <[n]>); + int mbtowc(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -58,8 +58,8 @@ effects vary with the locale. int _DEFUN (mbtowc, (pwc, s, n), - wchar_t *pwc _AND - const char *s _AND + wchar_t *__restrict pwc _AND + const char *__restrict s _AND size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index d84fef5a2..986595cfd 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -19,8 +19,8 @@ int (*__mbtowc) (struct _reent *, wchar_t *, const char *, size_t, int _DEFUN (_mbtowc_r, (r, pwc, s, n, state), struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND + wchar_t *__restrict pwc _AND + const char *__restrict s _AND size_t n _AND mbstate_t *state) { diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index ee33960e3..f7cae78f7 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -11,11 +11,11 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - double strtod(const char *<[str]>, char **<[tail]>); - float strtof(const char *<[str]>, char **<[tail]>); + double strtod(const char *restrict <[str]>, char **restrict <[tail]>); + float strtof(const char *restrict <[str]>, char **restrict <[tail]>); double _strtod_r(void *<[reent]>, - const char *<[str]>, char **<[tail]>); + const char *restrict <[str]>, char **restrict <[tail]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -236,8 +236,8 @@ _DEFUN (match, (sp, t), double _DEFUN (_strtod_r, (ptr, s00, se), struct _reent *ptr _AND - _CONST char *s00 _AND - char **se) + _CONST char *__restrict s00 _AND + char **__restrict se) { #ifdef Avoid_Underflow int scale; @@ -1255,15 +1255,15 @@ _DEFUN (_strtod_r, (ptr, s00, se), double _DEFUN (strtod, (s00, se), - _CONST char *s00 _AND char **se) + _CONST char *__restrict s00 _AND char **__restrict se) { return _strtod_r (_REENT, s00, se); } float _DEFUN (strtof, (s00, se), - _CONST char *s00 _AND - char **se) + _CONST char *__restrict s00 _AND + char **__restrict se) { double retval = _strtod_r (_REENT, s00, se); if (isnan (retval)) diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c index 4fcce958f..7273c7d4b 100644 --- a/newlib/libc/stdlib/strtol.c +++ b/newlib/libc/stdlib/strtol.c @@ -9,10 +9,10 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - long strtol(const char *<[s]>, char **<[ptr]>,int <[base]>); + long strtol(const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); long _strtol_r(void *<[reent]>, - const char *<[s]>, char **<[ptr]>,int <[base]>); + const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -133,8 +133,8 @@ No supporting OS subroutines are required. long _DEFUN (_strtol_r, (rptr, nptr, endptr, base), struct _reent *rptr _AND - _CONST char *nptr _AND - char **endptr _AND + _CONST char *__restrict nptr _AND + char **__restrict endptr _AND int base) { register const unsigned char *s = (const unsigned char *)nptr; @@ -216,8 +216,8 @@ _DEFUN (_strtol_r, (rptr, nptr, endptr, base), long _DEFUN (strtol, (s, ptr, base), - _CONST char *s _AND - char **ptr _AND + _CONST char *__restrict s _AND + char **__restrict ptr _AND int base) { return _strtol_r (_REENT, s, ptr, base); diff --git a/newlib/libc/stdlib/strtold.c b/newlib/libc/stdlib/strtold.c index 94f9613d2..390ec735b 100644 --- a/newlib/libc/stdlib/strtold.c +++ b/newlib/libc/stdlib/strtold.c @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. /* On platforms where long double is as wide as double. */ #ifdef _LDBL_EQ_DBL long double -strtold (const char *s00, char **se) +strtold (const char *__restrict s00, char **__restrict se) { return strtod(s00, se); } diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c index 47558a8fd..3ad8199a0 100644 --- a/newlib/libc/stdlib/strtoll.c +++ b/newlib/libc/stdlib/strtoll.c @@ -9,10 +9,10 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - long long strtoll(const char *<[s]>, char **<[ptr]>,int <[base]>); + long long strtoll(const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); long long _strtoll_r(void *<[reent]>, - const char *<[s]>, char **<[ptr]>,int <[base]>); + const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -128,8 +128,8 @@ No supporting OS subroutines are required. long long _DEFUN (strtoll, (s, ptr, base), - _CONST char *s _AND - char **ptr _AND + _CONST char *__restrict s _AND + char **__restrict ptr _AND int base) { return _strtoll_r (_REENT, s, ptr, base); diff --git a/newlib/libc/stdlib/strtoll_r.c b/newlib/libc/stdlib/strtoll_r.c index e88fbba3c..515464db1 100644 --- a/newlib/libc/stdlib/strtoll_r.c +++ b/newlib/libc/stdlib/strtoll_r.c @@ -58,8 +58,8 @@ long long _DEFUN (_strtoll_r, (rptr, nptr, endptr, base), struct _reent *rptr _AND - _CONST char *nptr _AND - char **endptr _AND + _CONST char *__restrict nptr _AND + char **__restrict endptr _AND int base) { register const unsigned char *s = (const unsigned char *)nptr; diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c index 7fa3a82cf..12c6834dc 100644 --- a/newlib/libc/stdlib/strtoul.c +++ b/newlib/libc/stdlib/strtoul.c @@ -9,11 +9,11 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - unsigned long strtoul(const char *<[s]>, char **<[ptr]>, + unsigned long strtoul(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); - unsigned long _strtoul_r(void *<[reent]>, const char *<[s]>, - char **<[ptr]>, int <[base]>); + unsigned long _strtoul_r(void *<[reent]>, const char *restrict <[s]>, + char **restrict <[ptr]>, int <[base]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -134,8 +134,8 @@ PORTABILITY unsigned long _DEFUN (_strtoul_r, (rptr, nptr, endptr, base), struct _reent *rptr _AND - _CONST char *nptr _AND - char **endptr _AND + _CONST char *__restrict nptr _AND + char **__restrict endptr _AND int base) { register const unsigned char *s = (const unsigned char *)nptr; @@ -196,8 +196,8 @@ _DEFUN (_strtoul_r, (rptr, nptr, endptr, base), unsigned long _DEFUN (strtoul, (s, ptr, base), - _CONST char *s _AND - char **ptr _AND + _CONST char *__restrict s _AND + char **__restrict ptr _AND int base) { return _strtoul_r (_REENT, s, ptr, base); diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c index ec168b7f9..13a54dbb4 100644 --- a/newlib/libc/stdlib/strtoull.c +++ b/newlib/libc/stdlib/strtoull.c @@ -9,11 +9,11 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - unsigned long long strtoull(const char *<[s]>, char **<[ptr]>, + unsigned long long strtoull(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); - unsigned long long _strtoull_r(void *<[reent]>, const char *<[s]>, - char **<[ptr]>, int <[base]>); + unsigned long long _strtoull_r(void *<[reent]>, const char *restrict <[s]>, + char **restrict <[ptr]>, int <[base]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -129,8 +129,8 @@ PORTABILITY unsigned long long _DEFUN (strtoull, (s, ptr, base), - _CONST char *s _AND - char **ptr _AND + _CONST char *__restrict s _AND + char **__restrict ptr _AND int base) { return _strtoull_r (_REENT, s, ptr, base); diff --git a/newlib/libc/stdlib/strtoull_r.c b/newlib/libc/stdlib/strtoull_r.c index da7f7f51a..d0868adf2 100644 --- a/newlib/libc/stdlib/strtoull_r.c +++ b/newlib/libc/stdlib/strtoull_r.c @@ -59,8 +59,8 @@ unsigned long long _DEFUN (_strtoull_r, (rptr, nptr, endptr, base), struct _reent *rptr _AND - _CONST char *nptr _AND - char **endptr _AND + _CONST char *__restrict nptr _AND + char **__restrict endptr _AND int base) { register const unsigned char *s = (const unsigned char *)nptr; diff --git a/newlib/libc/stdlib/wcstombs.c b/newlib/libc/stdlib/wcstombs.c index d0ef26e53..b0123a313 100644 --- a/newlib/libc/stdlib/wcstombs.c +++ b/newlib/libc/stdlib/wcstombs.c @@ -7,7 +7,7 @@ INDEX ANSI_SYNOPSIS #include <stdlib.h> - size_t wcstombs(char *<[s]>, const wchar_t *<[pwc]>, size_t <[n]>); + size_t wcstombs(char *restrict <[s]>, const wchar_t *restrict <[pwc]>, size_t <[n]>); TRAD_SYNOPSIS #include <stdlib.h> @@ -56,8 +56,8 @@ effects vary with the locale. size_t _DEFUN (wcstombs, (s, pwcs, n), - char *s _AND - const wchar_t *pwcs _AND + char *__restrict s _AND + const wchar_t *__restrict pwcs _AND size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/wcstombs_r.c b/newlib/libc/stdlib/wcstombs_r.c index e74502f46..3bac8a337 100644 --- a/newlib/libc/stdlib/wcstombs_r.c +++ b/newlib/libc/stdlib/wcstombs_r.c @@ -5,8 +5,8 @@ size_t _DEFUN (_wcstombs_r, (reent, s, pwcs, n, state), struct _reent *r _AND - char *s _AND - const wchar_t *pwcs _AND + char *__restrict s _AND + const wchar_t *__restrict pwcs _AND size_t n _AND mbstate_t *state) { |