]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/libstdc++-v3/contrib/libstdc++-v3-4.8/src/c++98/compatibility.cc
Update
[l4.git] / l4 / pkg / l4re-core / libstdc++-v3 / contrib / libstdc++-v3-4.8 / src / c++98 / compatibility.cc
1 // Compatibility symbols for previous versions -*- C++ -*-
2
3 // Copyright (C) 2005-2013 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23 // <http://www.gnu.org/licenses/>.
24
25 #include <bits/c++config.h>
26
27 #if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
28     && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE)\
29     && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
30 #define istreambuf_iterator istreambuf_iteratorXX
31 #define basic_fstream basic_fstreamXX
32 #define basic_ifstream basic_ifstreamXX
33 #define basic_ofstream basic_ofstreamXX
34 #define _M_copy(a, b, c) _M_copyXX(a, b, c)
35 #define _M_move(a, b, c) _M_moveXX(a, b, c)
36 #define _M_assign(a, b, c) _M_assignXX(a, b, c)
37 #define _M_disjunct(a) _M_disjunctXX(a)
38 #define _M_check_length(a, b, c) _M_check_lengthXX(a, b, c)
39 #define _M_set_length_and_sharable(a) _M_set_length_and_sharableXX(a)
40 #define ignore ignoreXX
41 #define eq eqXX
42 #define _List_node_base _List_node_baseXX
43 #endif
44
45 #include <string>
46 #include <istream>
47 #include <fstream>
48 #include <sstream>
49 #include <cmath>
50 #include <ext/numeric_traits.h>
51
52 namespace std _GLIBCXX_VISIBILITY(default)
53 {
54 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55
56   // std::istream ignore explicit specializations.
57   template<>
58     basic_istream<char>&
59     basic_istream<char>::
60     ignore(streamsize __n)
61     {
62       if (__n == 1)
63         return ignore();
64       
65       _M_gcount = 0;
66       sentry __cerb(*this, true);
67       if ( __n > 0 && __cerb)
68         {
69           ios_base::iostate __err = ios_base::goodbit;
70           __try
71             {
72               const int_type __eof = traits_type::eof();
73               __streambuf_type* __sb = this->rdbuf();
74               int_type __c = __sb->sgetc();
75
76               // See comment in istream.tcc.
77               bool __large_ignore = false;
78               while (true)
79                 {
80                   while (_M_gcount < __n
81                          && !traits_type::eq_int_type(__c, __eof))
82                     {
83                       streamsize __size = std::min(streamsize(__sb->egptr()
84                                                               - __sb->gptr()),
85                                                   streamsize(__n - _M_gcount));
86                       if (__size > 1)
87                         {
88                           __sb->__safe_gbump(__size);
89                           _M_gcount += __size;
90                           __c = __sb->sgetc();
91                         }
92                       else
93                         {
94                           ++_M_gcount;
95                           __c = __sb->snextc();
96                         } 
97                     }
98                   if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
99                       && !traits_type::eq_int_type(__c, __eof))
100                     {
101                       _M_gcount =
102                         __gnu_cxx::__numeric_traits<streamsize>::__min;
103                       __large_ignore = true;
104                     }
105                   else
106                     break;
107                 }
108
109               if (__large_ignore)
110                 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
111
112               if (traits_type::eq_int_type(__c, __eof))
113                 __err |= ios_base::eofbit;
114             }
115           __catch(__cxxabiv1::__forced_unwind&)
116             {
117               this->_M_setstate(ios_base::badbit);
118               __throw_exception_again;
119             }
120           __catch(...)
121             { this->_M_setstate(ios_base::badbit); }
122           if (__err)
123             this->setstate(__err);
124         }
125       return *this;
126     } 
127
128 #ifdef _GLIBCXX_USE_WCHAR_T
129   template<>
130     basic_istream<wchar_t>&
131     basic_istream<wchar_t>::
132     ignore(streamsize __n)
133     {
134       if (__n == 1)
135         return ignore();
136       
137       _M_gcount = 0;
138       sentry __cerb(*this, true);
139       if (__n > 0 && __cerb)
140         {
141           ios_base::iostate __err = ios_base::goodbit;
142           __try
143             {
144               const int_type __eof = traits_type::eof();
145               __streambuf_type* __sb = this->rdbuf();
146               int_type __c = __sb->sgetc();
147
148               bool __large_ignore = false;
149               while (true)
150                 {
151                   while (_M_gcount < __n
152                          && !traits_type::eq_int_type(__c, __eof))
153                     {
154                       streamsize __size = std::min(streamsize(__sb->egptr()
155                                                               - __sb->gptr()),
156                                                   streamsize(__n - _M_gcount));
157                       if (__size > 1)
158                         {
159                           __sb->__safe_gbump(__size);
160                           _M_gcount += __size;
161                           __c = __sb->sgetc();
162                         }
163                       else
164                         {
165                           ++_M_gcount;
166                           __c = __sb->snextc();
167                         }
168                     }
169                   if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
170                       && !traits_type::eq_int_type(__c, __eof))
171                     {
172                       _M_gcount =
173                         __gnu_cxx::__numeric_traits<streamsize>::__min;
174                       __large_ignore = true;
175                     }
176                   else
177                     break;
178                 }
179
180               if (__large_ignore)
181                 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
182
183               if (traits_type::eq_int_type(__c, __eof))
184                 __err |= ios_base::eofbit;
185             }
186           __catch(__cxxabiv1::__forced_unwind&)
187             {
188               this->_M_setstate(ios_base::badbit);
189               __throw_exception_again;
190             }
191           __catch(...)
192             { this->_M_setstate(ios_base::badbit); }
193           if (__err)
194             this->setstate(__err);
195         }
196       return *this;
197     }
198 #endif
199
200 _GLIBCXX_END_NAMESPACE_VERSION
201 } // namespace std
202
203
204 // NB: These symbols renames should go into the shared library only,
205 // and only those shared libraries that support versioning.
206 #if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
207     && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
208     && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
209
210 /* gcc-3.4.4
211 _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv
212 _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv
213  */
214
215 namespace std _GLIBCXX_VISIBILITY(default)
216 {
217 _GLIBCXX_BEGIN_NAMESPACE_VERSION
218
219   template
220     istreambuf_iterator<char>&
221     istreambuf_iterator<char>::operator++();
222
223 #ifdef _GLIBCXX_USE_WCHAR_T
224   template
225     istreambuf_iterator<wchar_t>&
226     istreambuf_iterator<wchar_t>::operator++();
227 #endif
228
229 _GLIBCXX_END_NAMESPACE_VERSION
230 } // namespace std
231
232
233 /* gcc-4.0.0
234 _ZNSs4_Rep26_M_set_length_and_sharableEj
235 _ZNSs7_M_copyEPcPKcj
236 _ZNSs7_M_moveEPcPKcj
237 _ZNSs9_M_assignEPcjc
238 _ZNKSs11_M_disjunctEPKc
239 _ZNKSs15_M_check_lengthEjjPKc
240 _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj
241 _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj
242 _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj
243 _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw
244 _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw
245 _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc
246
247 _ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv
248 _ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv
249 _ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv
250 _ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv
251 _ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv
252 _ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv
253
254 _ZNSi6ignoreEi
255 _ZNSi6ignoreEv
256 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi
257 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv
258
259 _ZNSt11char_traitsIcE2eqERKcS2_
260 _ZNSt11char_traitsIwE2eqERKwS2_
261  */
262 namespace std _GLIBCXX_VISIBILITY(default)
263 {
264 _GLIBCXX_BEGIN_NAMESPACE_VERSION
265
266   // std::char_traits is explicitly specialized
267   bool (* __p1)(const char&, const char&) = &char_traits<char>::eq;
268
269   // std::string
270   template
271     void
272     basic_string<char>::_M_copy(char*, const char*, size_t);
273
274   template
275     void
276     basic_string<char>::_M_move(char*, const char*, size_t);
277
278   template
279     void
280     basic_string<char>::_M_assign(char*, size_t, char);
281
282   template
283     bool
284     basic_string<char>::_M_disjunct(const char*) const;
285
286   template
287     void
288     basic_string<char>::_M_check_length(size_t, size_t, const char*) const;
289
290   template
291     void
292     basic_string<char>::_Rep::_M_set_length_and_sharable(size_t);
293
294
295   // std::istream
296   template
297     basic_istream<char>&
298     basic_istream<char>::ignore(); 
299
300   template
301     bool
302     basic_fstream<char>::is_open() const;
303
304   template
305     bool
306     basic_ifstream<char>::is_open() const;
307
308   template
309     bool
310     basic_ofstream<char>::is_open() const;
311
312 #ifdef _GLIBCXX_USE_WCHAR_T
313   bool (* __p2)(const wchar_t&, const wchar_t&) = &char_traits<wchar_t>::eq;
314
315   // std::wstring
316   template
317     void
318     basic_string<wchar_t>::_M_copy(wchar_t*, const wchar_t*, size_t);
319
320   template
321     void
322     basic_string<wchar_t>::_M_move(wchar_t*, const wchar_t*, size_t);
323
324   template
325     void
326     basic_string<wchar_t>::_M_assign(wchar_t*, size_t, wchar_t);
327
328   template
329     bool
330     basic_string<wchar_t>::_M_disjunct(const wchar_t*) const;
331
332   template
333     void
334     basic_string<wchar_t>::_M_check_length(size_t, size_t, 
335                                            const char*) const;
336
337   template
338     void
339     basic_string<wchar_t>::_Rep::_M_set_length_and_sharable(size_t);
340
341   template
342     basic_istream<wchar_t>&
343     basic_istream<wchar_t>::ignore(); 
344
345   template
346     bool
347     basic_fstream<wchar_t>::is_open() const;
348
349   template
350     bool
351     basic_ifstream<wchar_t>::is_open() const;
352
353   template
354     bool
355     basic_ofstream<wchar_t>::is_open() const;
356 #endif
357
358 _GLIBCXX_END_NAMESPACE_VERSION
359 } // namespace std
360
361 // The rename syntax for default exported names is
362 //   asm (".symver name1,exportedname@GLIBCXX_3.4")
363 //   asm (".symver name2,exportedname@@GLIBCXX_3.4.5")
364 // In the future, GLIBCXX_ABI > 6 should remove all uses of
365 // _GLIBCXX_*_SYMVER macros in this file.
366
367 #define _GLIBCXX_3_4_SYMVER(XXname, name) \
368    extern "C" void \
369    _X##name() \
370    __attribute__ ((alias(#XXname))); \
371    asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4");
372
373 #define _GLIBCXX_3_4_5_SYMVER(XXname, name) \
374    extern "C" void \
375    _Y##name() \
376    __attribute__ ((alias(#XXname))); \
377    asm (".symver " "_Y" #name  "," #name "@@GLIBCXX_3.4.5");
378
379 #define _GLIBCXX_ASM_SYMVER(cur, old, version) \
380    asm (".symver " #cur "," #old "@@" #version);
381
382 #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER
383 #include <bits/compatibility.h>
384 #undef _GLIBCXX_APPLY_SYMVER
385
386 #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER
387 #include <bits/compatibility.h>
388 #undef _GLIBCXX_APPLY_SYMVER
389
390
391 /* gcc-3.4.0
392 _ZN10__gnu_norm15_List_node_base4hookEPS0_;
393 _ZN10__gnu_norm15_List_node_base4swapERS0_S1_;
394 _ZN10__gnu_norm15_List_node_base6unhookEv;
395 _ZN10__gnu_norm15_List_node_base7reverseEv;
396 _ZN10__gnu_norm15_List_node_base8transferEPS0_S1_;
397 */
398 #include "list.cc"  
399 _GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX7_M_hookEPS0_, \
400 _ZN10__gnu_norm15_List_node_base4hookEPS0_, \
401 GLIBCXX_3.4)
402
403 _GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX4swapERS0_S1_, \
404 _ZN10__gnu_norm15_List_node_base4swapERS0_S1_, \
405 GLIBCXX_3.4)
406
407 _GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX9_M_unhookEv, \
408 _ZN10__gnu_norm15_List_node_base6unhookEv, \
409 GLIBCXX_3.4)
410
411 _GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX10_M_reverseEv, \
412 _ZN10__gnu_norm15_List_node_base7reverseEv, \
413 GLIBCXX_3.4)
414
415 _GLIBCXX_ASM_SYMVER(_ZNSt8__detail17_List_node_baseXX11_M_transferEPS0_S1_, \
416 _ZN10__gnu_norm15_List_node_base8transferEPS0_S1_, \
417 GLIBCXX_3.4)
418 #undef _List_node_base
419
420 // gcc-4.1.0
421 // Long double versions of "C" math functions. 
422 #if defined (_GLIBCXX_LONG_DOUBLE_COMPAT) \
423     || (defined (__arm__) && defined (__linux__) && defined (__ARM_EABI__)) \
424     || (defined (__hppa__) && defined (__linux__)) \
425     || (defined (__m68k__) && defined (__mcoldfire__) && defined (__linux__)) \
426     || (defined (__mips__) && defined (_ABIO32) && defined (__linux__)) \
427     || (defined (__sh__) && defined (__linux__) && __SIZEOF_SIZE_T__ == 4) \
428
429 #define _GLIBCXX_MATHL_WRAPPER(name, argdecl, args, ver) \
430 extern "C" double                                               \
431 __ ## name ## l_wrapper argdecl                                 \
432 {                                                               \
433   return name args;                                             \
434 }                                                               \
435 asm (".symver __" #name "l_wrapper, " #name "l@" #ver)
436
437 #define _GLIBCXX_MATHL_WRAPPER1(name, ver) \
438   _GLIBCXX_MATHL_WRAPPER (name, (double x), (x), ver)
439
440 #define _GLIBCXX_MATHL_WRAPPER2(name, ver) \
441   _GLIBCXX_MATHL_WRAPPER (name, (double x, double y), (x, y), ver)
442
443 #ifdef _GLIBCXX_HAVE_ACOSL
444 _GLIBCXX_MATHL_WRAPPER1 (acos, GLIBCXX_3.4.3);
445 #endif
446 #ifdef _GLIBCXX_HAVE_ASINL
447 _GLIBCXX_MATHL_WRAPPER1 (asin, GLIBCXX_3.4.3);
448 #endif
449 #ifdef _GLIBCXX_HAVE_ATAN2L
450 _GLIBCXX_MATHL_WRAPPER2 (atan2, GLIBCXX_3.4);
451 #endif
452 #ifdef _GLIBCXX_HAVE_ATANL
453 _GLIBCXX_MATHL_WRAPPER1 (atan, GLIBCXX_3.4.3);
454 #endif
455 #ifdef _GLIBCXX_HAVE_CEILL
456 _GLIBCXX_MATHL_WRAPPER1 (ceil, GLIBCXX_3.4.3);
457 #endif
458 #ifdef _GLIBCXX_HAVE_COSHL
459 _GLIBCXX_MATHL_WRAPPER1 (cosh, GLIBCXX_3.4);
460 #endif
461 #ifdef _GLIBCXX_HAVE_COSL
462 _GLIBCXX_MATHL_WRAPPER1 (cos, GLIBCXX_3.4);
463 #endif
464 #ifdef _GLIBCXX_HAVE_EXPL
465 _GLIBCXX_MATHL_WRAPPER1 (exp, GLIBCXX_3.4);
466 #endif
467 #ifdef _GLIBCXX_HAVE_FLOORL
468 _GLIBCXX_MATHL_WRAPPER1 (floor, GLIBCXX_3.4.3);
469 #endif
470 #ifdef _GLIBCXX_HAVE_FMODL
471 _GLIBCXX_MATHL_WRAPPER2 (fmod, GLIBCXX_3.4.3);
472 #endif
473 #ifdef _GLIBCXX_HAVE_FREXPL
474 _GLIBCXX_MATHL_WRAPPER (frexp, (double x, int *y), (x, y), GLIBCXX_3.4.3);
475 #endif
476 #ifdef _GLIBCXX_HAVE_HYPOTL
477 _GLIBCXX_MATHL_WRAPPER2 (hypot, GLIBCXX_3.4);
478 #endif
479 #ifdef _GLIBCXX_HAVE_LDEXPL
480 _GLIBCXX_MATHL_WRAPPER (ldexp, (double x, int y), (x, y), GLIBCXX_3.4.3);
481 #endif
482 #ifdef _GLIBCXX_HAVE_LOG10L
483 _GLIBCXX_MATHL_WRAPPER1 (log10, GLIBCXX_3.4);
484 #endif
485 #ifdef _GLIBCXX_HAVE_LOGL
486 _GLIBCXX_MATHL_WRAPPER1 (log, GLIBCXX_3.4);
487 #endif
488 #ifdef _GLIBCXX_HAVE_MODFL
489 _GLIBCXX_MATHL_WRAPPER (modf, (double x, double *y), (x, y), GLIBCXX_3.4.3);
490 #endif
491 #ifdef _GLIBCXX_HAVE_POWL
492 _GLIBCXX_MATHL_WRAPPER2 (pow, GLIBCXX_3.4);
493 #endif
494 #ifdef _GLIBCXX_HAVE_SINHL
495 _GLIBCXX_MATHL_WRAPPER1 (sinh, GLIBCXX_3.4);
496 #endif
497 #ifdef _GLIBCXX_HAVE_SINL
498 _GLIBCXX_MATHL_WRAPPER1 (sin, GLIBCXX_3.4);
499 #endif
500 #ifdef _GLIBCXX_HAVE_SQRTL
501 _GLIBCXX_MATHL_WRAPPER1 (sqrt, GLIBCXX_3.4);
502 #endif
503 #ifdef _GLIBCXX_HAVE_TANHL
504 _GLIBCXX_MATHL_WRAPPER1 (tanh, GLIBCXX_3.4);
505 #endif
506 #ifdef _GLIBCXX_HAVE_TANL
507 _GLIBCXX_MATHL_WRAPPER1 (tan, GLIBCXX_3.4);
508 #endif
509 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
510
511 #endif
512
513 #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
514 extern void *_ZTVN10__cxxabiv123__fundamental_type_infoE[];
515 extern void *_ZTVN10__cxxabiv119__pointer_type_infoE[];
516 extern __attribute__((used, weak)) const char _ZTSe[2] = "e";
517 extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe";
518 extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe";
519 extern __attribute__((used, weak)) const void * const _ZTIe[2]
520   = { reinterpret_cast<const void *>
521       (&_ZTVN10__cxxabiv123__fundamental_type_infoE[2]),
522       reinterpret_cast<const void *>(_ZTSe) };
523 extern __attribute__((used, weak)) const void * const _ZTIPe[4]
524   = { reinterpret_cast<const void *>
525       (&_ZTVN10__cxxabiv119__pointer_type_infoE[2]),
526       reinterpret_cast<const void *>(_ZTSPe),
527       reinterpret_cast<const void *>(0L),
528       reinterpret_cast<const void *>(_ZTIe) };
529 extern __attribute__((used, weak)) const void * const _ZTIPKe[4]
530   = { reinterpret_cast<const void *>
531       (&_ZTVN10__cxxabiv119__pointer_type_infoE[2]),
532       reinterpret_cast<const void *>(_ZTSPKe),
533       reinterpret_cast<const void *>(1L),
534       reinterpret_cast<const void *>(_ZTIe) };
535 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
536
537 #ifdef _GLIBCXX_SYMVER_DARWIN
538 #if (defined(__ppc__) || defined(__ppc64__)) && defined(_GLIBCXX_SHARED)
539 /* __eprintf shouldn't have been made visible from libstdc++, or
540    anywhere, but on Mac OS X 10.4 it was defined in
541    libstdc++.6.0.3.dylib; so on that platform we have to keep defining
542    it to keep binary compatibility.  We can't just put the libgcc
543    version in the export list, because that doesn't work; once a
544    symbol is marked as hidden, it stays that way.  */
545
546 #include <cstdio>
547 #include <cstdlib>
548
549 using namespace std;
550
551 extern "C" void
552 __eprintf(const char *string, const char *expression,
553           unsigned int line, const char *filename)
554 {
555   fprintf(stderr, string, expression, line, filename);
556   fflush(stderr);
557   abort();
558 }
559 #endif
560 #endif