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