diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2013-12-23 19:21:07 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2013-12-23 19:21:07 +0000 |
commit | b153931f1833ff80bdd27d9b6ae1dee56d36ed8a (patch) | |
tree | ee1726f7e2363dc34123c26de5922f636a953247 | |
parent | 2d15421aa8f802cd987098fe6d13462c0b383c1a (diff) | |
download | newlib-b153931f1833ff80bdd27d9b6ae1dee56d36ed8a.zip newlib-b153931f1833ff80bdd27d9b6ae1dee56d36ed8a.tar.gz newlib-b153931f1833ff80bdd27d9b6ae1dee56d36ed8a.tar.bz2 |
2013-12-22 JF Bastien <jfb@chromium.org>
* libc/include/limits.h: Define LLONG_MIN, LLONG_MAX and ULLONG_MAX
for C++11 too.
* libc/include/stdlib.h: Define struct lldiv_t, _Exit, atoll, llabs
and lldiv for C99 and C++11. Move wcstold to wchar.h.
* libc/include/wchar.h: Define WCHAR_MIN and WCHAR_MAX according to
__WCHAR_UNSIGNED__ if it is provided, and correct the limit when
unsigned (to 32 all-1 bits, not 31). Define FILE as in stdio.h.
Move wcstold from stdlib.h here.
-rw-r--r-- | newlib/ChangeLog | 11 | ||||
-rw-r--r-- | newlib/libc/include/limits.h | 4 | ||||
-rw-r--r-- | newlib/libc/include/stdlib.h | 5 | ||||
-rw-r--r-- | newlib/libc/include/wchar.h | 19 |
4 files changed, 33 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index a4599e4..90380c9 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,14 @@ +2013-12-22 JF Bastien <jfb@chromium.org> + + * libc/include/limits.h: Define LLONG_MIN, LLONG_MAX and ULLONG_MAX + for C++11 too. + * libc/include/stdlib.h: Define struct lldiv_t, _Exit, atoll, llabs + and lldiv for C99 and C++11. Move wcstold to wchar.h. + * libc/include/wchar.h: Define WCHAR_MIN and WCHAR_MAX according to + __WCHAR_UNSIGNED__ if it is provided, and correct the limit when + unsigned (to 32 all-1 bits, not 31). Define FILE as in stdio.h. + Move wcstold from stdlib.h here. + 2013-12-20 Nick Clifton <nickc@redhat.com> * configure.host (newlib_cflags): Use -Os, -ffunction-sections and diff --git a/newlib/libc/include/limits.h b/newlib/libc/include/limits.h index 19868a6..190f1f7 100644 --- a/newlib/libc/include/limits.h +++ b/newlib/libc/include/limits.h @@ -96,7 +96,8 @@ # define __LONG_LONG_MAX__ 9223372036854775807LL # endif -# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) /* Minimum and maximum values a `signed long long int' can hold. */ # undef LLONG_MIN # define LLONG_MIN (-LLONG_MAX-1) @@ -143,4 +144,3 @@ #ifndef PATH_MAX #define PATH_MAX 4096 #endif - diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index 3b421dd..ef21866 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -39,7 +39,9 @@ typedef struct long rem; /* remainder */ } ldiv_t; -#ifndef __STRICT_ANSI__ +#if !defined(__STRICT_ANSI__) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) typedef struct { long long int quot; /* quotient */ @@ -233,7 +235,6 @@ _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)) #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) extern long double strtold (const char *__restrict, char **__restrict); #endif -extern long double wcstold (const wchar_t *, wchar_t **); #endif /* _LDBL_EQ_DBL */ _END_STD_C diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index 6f72dcf..cdc8571 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -25,19 +25,30 @@ #endif #ifndef WCHAR_MIN -#define WCHAR_MIN 0 +#ifdef __WCHAR_MIN__ +#define WCHAR_MIN __WCHAR_MIN__ +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) +#define WCHAR_MIN (0 + L'\0') +#else +#define WCHAR_MIN (-0x7fffffff - 1 + L'\0') +#endif #endif #ifndef WCHAR_MAX #ifdef __WCHAR_MAX__ #define WCHAR_MAX __WCHAR_MAX__ +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) +#define WCHAR_MAX (0xffffffffu + L'\0') #else -#define WCHAR_MAX 0x7fffffffu +#define WCHAR_MAX (0x7fffffff + L'\0') #endif #endif _BEGIN_STD_C +/* As in stdio.h, <sys/reent.h> defines __FILE. */ +typedef __FILE FILE; + /* As required by POSIX.1-2008, declare tm as incomplete type. The actual definition is in time.h. */ struct tm; @@ -130,6 +141,10 @@ long _EXFUN(_wcstol_r, (struct _reent *, const wchar_t *, wchar_t **, int)); long long _EXFUN(_wcstoll_r, (struct _reent *, const wchar_t *, wchar_t **, int)); unsigned long _EXFUN(_wcstoul_r, (struct _reent *, const wchar_t *, wchar_t **, int)); unsigned long long _EXFUN(_wcstoull_r, (struct _reent *, const wchar_t *, wchar_t **, int)); +/* On platforms where long double equals double. */ +#ifdef _LDBL_EQ_DBL +long double _EXFUN(wcstold, (const wchar_t *, wchar_t **)); +#endif /* _LDBL_EQ_DBL */ wint_t _EXFUN(fgetwc, (__FILE *)); wchar_t *_EXFUN(fgetws, (wchar_t *__restrict, int, __FILE *__restrict)); |