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.
This commit is contained in:
Jeff Johnston 2013-12-23 19:21:07 +00:00
parent 2d15421aa8
commit b153931f18
4 changed files with 33 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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));