cannelloni: needs dynamic library
[buildroot-gz.git] / package / gcc / 4.8.5 / 850-libstdcxx-uclibc-c99.patch
blob792976fd51f2fb9b55a075451fbf46181ede153c
1 Allow C99-depending features of libstdc++ with uClibc
3 The libstdc++ code is fairly restrictive on how it checks for C99
4 compatibility: it requires *complete* C99 support to enable certain
5 features. For example, uClibc provides a good number of C99 features,
6 but not C99 complex number support. For this reason, libstdc++
7 completely disables many the standard C++ methods that can in fact
8 work because uClibc provides the necessary functions.
10 This patch is similar and highly inspired from
11 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in
12 a way that doesn't involve changing the configure.ac script, as
13 autoreconfiguring gcc is complicated. It simply relies on the fact
14 that uClibc defines the __UCLIBC__ definition.
16 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18 Index: b/libstdc++-v3/config/locale/generic/c_locale.h
19 ===================================================================
20 --- a/libstdc++-v3/config/locale/generic/c_locale.h
21 +++ b/libstdc++-v3/config/locale/generic/c_locale.h
22 @@ -70,7 +70,7 @@
23 __builtin_va_list __args;
24 __builtin_va_start(__args, __fmt);
26 -#ifdef _GLIBCXX_USE_C99
27 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
28 const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
29 #else
30 const int __ret = __builtin_vsprintf(__out, __fmt, __args);
31 Index: b/libstdc++-v3/config/locale/gnu/c_locale.h
32 ===================================================================
33 --- a/libstdc++-v3/config/locale/gnu/c_locale.h
34 +++ b/libstdc++-v3/config/locale/gnu/c_locale.h
35 @@ -88,7 +88,7 @@
36 __builtin_va_list __args;
37 __builtin_va_start(__args, __fmt);
39 -#ifdef _GLIBCXX_USE_C99
40 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
41 const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
42 #else
43 const int __ret = __builtin_vsprintf(__out, __fmt, __args);
44 Index: b/libstdc++-v3/include/bits/basic_string.h
45 ===================================================================
46 --- a/libstdc++-v3/include/bits/basic_string.h
47 +++ b/libstdc++-v3/include/bits/basic_string.h
48 @@ -2809,7 +2809,7 @@
49 _GLIBCXX_END_NAMESPACE_VERSION
50 } // namespace
52 -#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
53 +#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) \
54 && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
56 #include <ext/string_conversions.h>
57 Index: b/libstdc++-v3/include/bits/locale_facets.tcc
58 ===================================================================
59 --- a/libstdc++-v3/include/bits/locale_facets.tcc
60 +++ b/libstdc++-v3/include/bits/locale_facets.tcc
61 @@ -987,7 +987,7 @@
62 char __fbuf[16];
63 __num_base::_S_format_float(__io, __fbuf, __mod);
65 -#ifdef _GLIBCXX_USE_C99
66 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
67 // First try a buffer perhaps big enough (most probably sufficient
68 // for non-ios_base::fixed outputs)
69 int __cs_size = __max_digits * 3;
70 Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
71 ===================================================================
72 --- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
73 +++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
74 @@ -572,7 +572,7 @@
76 const locale __loc = __io.getloc();
77 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
78 -#ifdef _GLIBCXX_USE_C99
79 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
80 // First try a buffer perhaps big enough.
81 int __cs_size = 64;
82 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
83 Index: b/libstdc++-v3/include/c_compatibility/math.h
84 ===================================================================
85 --- a/libstdc++-v3/include/c_compatibility/math.h
86 +++ b/libstdc++-v3/include/c_compatibility/math.h
87 @@ -56,7 +56,7 @@
88 using std::floor;
89 using std::fmod;
91 -#if _GLIBCXX_USE_C99
92 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
93 using std::fpclassify;
94 using std::isfinite;
95 using std::isinf;
96 Index: b/libstdc++-v3/include/c_compatibility/wchar.h
97 ===================================================================
98 --- a/libstdc++-v3/include/c_compatibility/wchar.h
99 +++ b/libstdc++-v3/include/c_compatibility/wchar.h
100 @@ -103,7 +103,7 @@
101 using std::wmemset;
102 using std::wcsftime;
104 -#if _GLIBCXX_USE_C99
105 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
106 using std::wcstold;
107 using std::wcstoll;
108 using std::wcstoull;
109 Index: b/libstdc++-v3/include/c_global/cstdlib
110 ===================================================================
111 --- a/libstdc++-v3/include/c_global/cstdlib
112 +++ b/libstdc++-v3/include/c_global/cstdlib
113 @@ -182,7 +182,7 @@
114 _GLIBCXX_END_NAMESPACE_VERSION
115 } // namespace
117 -#if _GLIBCXX_USE_C99
118 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
120 #undef _Exit
121 #undef llabs
122 Index: b/libstdc++-v3/include/c_global/cwchar
123 ===================================================================
124 --- a/libstdc++-v3/include/c_global/cwchar
125 +++ b/libstdc++-v3/include/c_global/cwchar
126 @@ -232,7 +232,7 @@
127 _GLIBCXX_END_NAMESPACE_VERSION
128 } // namespace
130 -#if _GLIBCXX_USE_C99
131 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
133 #undef wcstold
134 #undef wcstoll
135 @@ -289,7 +289,7 @@
136 using std::vwscanf;
137 #endif
139 -#if _GLIBCXX_USE_C99
140 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
141 using std::wcstold;
142 using std::wcstoll;
143 using std::wcstoull;
144 Index: b/libstdc++-v3/include/c_std/cstdio
145 ===================================================================
146 --- a/libstdc++-v3/include/c_std/cstdio
147 +++ b/libstdc++-v3/include/c_std/cstdio
148 @@ -139,7 +139,7 @@
149 using ::vsprintf;
150 } // namespace std
152 -#if _GLIBCXX_USE_C99
153 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
155 #undef snprintf
156 #undef vfscanf
157 Index: b/libstdc++-v3/include/c_std/cstdlib
158 ===================================================================
159 --- a/libstdc++-v3/include/c_std/cstdlib
160 +++ b/libstdc++-v3/include/c_std/cstdlib
161 @@ -180,7 +180,7 @@
162 _GLIBCXX_END_NAMESPACE_VERSION
163 } // namespace
165 -#if _GLIBCXX_USE_C99
166 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
168 #undef _Exit
169 #undef llabs
170 Index: b/libstdc++-v3/include/c_std/cwchar
171 ===================================================================
172 --- a/libstdc++-v3/include/c_std/cwchar
173 +++ b/libstdc++-v3/include/c_std/cwchar
174 @@ -228,7 +228,7 @@
175 _GLIBCXX_END_NAMESPACE_VERSION
176 } // namespace
178 -#if _GLIBCXX_USE_C99
179 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
181 #undef wcstold
182 #undef wcstoll
183 Index: b/libstdc++-v3/include/ext/vstring.h
184 ===================================================================
185 --- a/libstdc++-v3/include/ext/vstring.h
186 +++ b/libstdc++-v3/include/ext/vstring.h
187 @@ -2571,7 +2571,7 @@
188 _GLIBCXX_END_NAMESPACE_VERSION
189 } // namespace
191 -#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
192 +#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)))
194 #include <ext/string_conversions.h>
196 Index: b/libstdc++-v3/include/tr1/cstdio
197 ===================================================================
198 --- a/libstdc++-v3/include/tr1/cstdio
199 +++ b/libstdc++-v3/include/tr1/cstdio
200 @@ -33,7 +33,7 @@
202 #include <cstdio>
204 -#if _GLIBCXX_USE_C99
205 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
207 namespace std _GLIBCXX_VISIBILITY(default)
209 Index: b/libstdc++-v3/include/tr1/cstdlib
210 ===================================================================
211 --- a/libstdc++-v3/include/tr1/cstdlib
212 +++ b/libstdc++-v3/include/tr1/cstdlib
213 @@ -35,7 +35,7 @@
215 #if _GLIBCXX_HOSTED
217 -#if _GLIBCXX_USE_C99
218 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
220 namespace std _GLIBCXX_VISIBILITY(default)
222 Index: b/libstdc++-v3/include/tr1/cwchar
223 ===================================================================
224 --- a/libstdc++-v3/include/tr1/cwchar
225 +++ b/libstdc++-v3/include/tr1/cwchar
226 @@ -52,7 +52,7 @@
227 using std::vwscanf;
228 #endif
230 -#if _GLIBCXX_USE_C99
231 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
232 using std::wcstold;
233 using std::wcstoll;
234 using std::wcstoull;
235 Index: b/libstdc++-v3/include/tr1/stdlib.h
236 ===================================================================
237 --- a/libstdc++-v3/include/tr1/stdlib.h
238 +++ b/libstdc++-v3/include/tr1/stdlib.h
239 @@ -33,7 +33,7 @@
241 #if _GLIBCXX_HOSTED
243 -#if _GLIBCXX_USE_C99
244 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
246 using std::tr1::atoll;
247 using std::tr1::strtoll;
248 Index: b/libstdc++-v3/src/c++11/debug.cc
249 ===================================================================
250 --- a/libstdc++-v3/src/c++11/debug.cc
251 +++ b/libstdc++-v3/src/c++11/debug.cc
252 @@ -787,7 +787,7 @@
253 int __n __attribute__ ((__unused__)),
254 const char* __fmt, _Tp __s) const throw ()
256 -#ifdef _GLIBCXX_USE_C99
257 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
258 std::snprintf(__buf, __n, __fmt, __s);
259 #else
260 std::sprintf(__buf, __fmt, __s);
261 Index: b/libstdc++-v3/include/c_global/cstdio
262 ===================================================================
263 --- a/libstdc++-v3/include/c_global/cstdio
264 +++ b/libstdc++-v3/include/c_global/cstdio
265 @@ -139,7 +139,7 @@
266 using ::vsprintf;
267 } // namespace
269 -#if _GLIBCXX_USE_C99
270 +#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
272 #undef snprintf
273 #undef vfscanf