Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 3aee58ad043af33ab00c9cd7bc88f0cade83f236 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 29 Mar 2013 08:40:12 +0400 |
| 4 | Subject: [PATCH 03/35] gcc-uclibc-locale-ctype_touplow_t |
| 5 | |
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | --- |
| 10 | libstdc++-v3/config/locale/generic/c_locale.cc | 5 +++++ |
| 11 | libstdc++-v3/config/locale/generic/c_locale.h | 9 +++++++++ |
| 12 | libstdc++-v3/config/os/gnu-linux/ctype_base.h | 9 +++++++++ |
| 13 | 3 files changed, 23 insertions(+) |
| 14 | |
| 15 | diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc |
| 16 | index 6da5f22..2f85c2f 100644 |
| 17 | --- a/libstdc++-v3/config/locale/generic/c_locale.cc |
| 18 | +++ b/libstdc++-v3/config/locale/generic/c_locale.cc |
| 19 | @@ -263,5 +263,10 @@ _GLIBCXX_END_NAMESPACE_VERSION |
| 20 | #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
| 21 | #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
| 22 | extern "C" void ldbl (void) __attribute__ ((alias (#dbl))) |
| 23 | +#ifdef __UCLIBC__ |
| 24 | +// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int* |
| 25 | +_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs); |
| 26 | +#else |
| 27 | _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi); |
| 28 | +#endif |
| 29 | #endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
| 30 | diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h |
| 31 | index ee3ef86..7fd5485 100644 |
| 32 | --- a/libstdc++-v3/config/locale/generic/c_locale.h |
| 33 | +++ b/libstdc++-v3/config/locale/generic/c_locale.h |
| 34 | @@ -40,13 +40,22 @@ |
| 35 | |
| 36 | #include <clocale> |
| 37 | |
| 38 | +#ifdef __UCLIBC__ |
| 39 | +#include <features.h> |
| 40 | +#include <ctype.h> |
| 41 | +#endif |
| 42 | + |
| 43 | #define _GLIBCXX_NUM_CATEGORIES 0 |
| 44 | |
| 45 | namespace std _GLIBCXX_VISIBILITY(default) |
| 46 | { |
| 47 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 48 | |
| 49 | +#ifdef __UCLIBC__ |
| 50 | + typedef __ctype_touplow_t* __c_locale; |
| 51 | +#else |
| 52 | typedef int* __c_locale; |
| 53 | +#endif |
| 54 | |
| 55 | // Convert numeric value of type double and long double to string and |
| 56 | // return length of string. If vsnprintf is available use it, otherwise |
| 57 | diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_base.h b/libstdc++-v3/config/os/gnu-linux/ctype_base.h |
| 58 | index fd52b73..2627cf3 100644 |
| 59 | --- a/libstdc++-v3/config/os/gnu-linux/ctype_base.h |
| 60 | +++ b/libstdc++-v3/config/os/gnu-linux/ctype_base.h |
| 61 | @@ -33,6 +33,11 @@ |
| 62 | |
| 63 | // Information as gleaned from /usr/include/ctype.h |
| 64 | |
| 65 | +#ifdef __UCLIBC__ |
| 66 | +#include <features.h> |
| 67 | +#include <ctype.h> |
| 68 | +#endif |
| 69 | + |
| 70 | namespace std _GLIBCXX_VISIBILITY(default) |
| 71 | { |
| 72 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 73 | @@ -41,7 +46,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 74 | struct ctype_base |
| 75 | { |
| 76 | // Non-standard typedefs. |
| 77 | +#ifdef __UCLIBC__ |
| 78 | + typedef const __ctype_touplow_t* __to_type; |
| 79 | +#else |
| 80 | typedef const int* __to_type; |
| 81 | +#endif |
| 82 | |
| 83 | // NB: Offsets into ctype<char>::_M_table force a particular size |
| 84 | // on the mask type. Because of this, we don't use an enum. |
| 85 | -- |
| 86 | 2.1.4 |
| 87 | |