1 : /* ***** BEGIN LICENSE BLOCK *****
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License. You may obtain a copy of the License at
7 : * http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * The Original Code is a hack to avoid dependencies on recent libstdc++.
15 : *
16 : * The Initial Developer of the Original Code is
17 : * Mozilla Foundation.
18 : * Portions created by the Initial Developer are Copyright (C) 2011
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Mike Hommey <mh@glandium.org>
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #include <ostream>
39 : #include <istream>
40 : #include <string>
41 :
42 : /* GLIBCXX_3.4.8 is from gcc 4.1.1 (111691)
43 : GLIBCXX_3.4.9 is from gcc 4.2.0 (111690)
44 : GLIBCXX_3.4.10 is from gcc 4.3.0 (126287)
45 : GLIBCXX_3.4.11 is from gcc 4.4.0 (133006)
46 : GLIBCXX_3.4.12 is from gcc 4.4.1 (147138)
47 : GLIBCXX_3.4.13 is from gcc 4.4.2 (151127)
48 : GLIBCXX_3.4.14 is from gcc 4.5.0 (151126)
49 : GLIBCXX_3.4.15 is from gcc 4.6.0 (160071)
50 : GLIBCXX_3.4.16 is form gcc 4.6.1 (172240) */
51 :
52 : #define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))
53 :
54 : namespace std {
55 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9)
56 : /* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */
57 : template ostream& ostream::_M_insert(double);
58 : template ostream& ostream::_M_insert(long);
59 : template ostream& ostream::_M_insert(unsigned long);
60 : template ostream& ostream::_M_insert(long long);
61 : template ostream& ostream::_M_insert(unsigned long long);
62 : #ifdef DEBUG
63 : template ostream& ostream::_M_insert(const void*);
64 : #endif
65 : template ostream& __ostream_insert(ostream&, const char*, streamsize);
66 : template istream& istream::_M_extract(double&);
67 : #endif
68 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
69 : /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
70 : * depending on optimization level */
71 : template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
72 : #ifdef _GLIBCXX_USE_WCHAR_T
73 : template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
74 : #endif /* _GLIBCXX_USE_WCHAR_T */
75 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
76 : template string::basic_string(string&&);
77 : template string& string::operator=(string&&);
78 : template wstring::basic_string(wstring&&);
79 : template wstring& wstring::operator=(wstring&&);
80 : template wstring& wstring::assign(wstring&&);
81 : #endif /* __GXX_EXPERIMENTAL_CXX0X__ */
82 : #endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
83 : }
84 :
85 : namespace std __attribute__((visibility("default"))) {
86 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
87 : /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
88 : struct _List_node_base
89 : {
90 : void hook(_List_node_base * const __position) throw ();
91 :
92 : void unhook() throw ();
93 :
94 : void transfer(_List_node_base * const __first,
95 : _List_node_base * const __last) throw();
96 :
97 : /* Hack to avoid GLIBCXX_3.4.15 symbol versions */
98 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
99 : static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
100 : };
101 :
102 : namespace __detail {
103 :
104 : struct _List_node_base
105 : {
106 : #endif
107 : void _M_hook(_List_node_base * const __position) throw ();
108 :
109 : void _M_unhook() throw ();
110 :
111 : void _M_transfer(_List_node_base * const __first,
112 : _List_node_base * const __last) throw();
113 :
114 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
115 : static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
116 : #endif
117 : };
118 :
119 : /* The functions actually have the same implementation */
120 : void
121 1987 : _List_node_base::_M_hook(_List_node_base * const __position) throw ()
122 : {
123 1987 : ((std::_List_node_base *)this)->hook((std::_List_node_base * const) __position);
124 1987 : }
125 :
126 : void
127 1446 : _List_node_base::_M_unhook() throw ()
128 : {
129 1446 : ((std::_List_node_base *)this)->unhook();
130 1446 : }
131 :
132 : void
133 0 : _List_node_base::_M_transfer(_List_node_base * const __first,
134 : _List_node_base * const __last) throw ()
135 : {
136 : ((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first,
137 0 : (std::_List_node_base * const)__last);
138 0 : }
139 :
140 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
141 : void
142 : _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
143 : {
144 : std::_List_node_base::swap(*((std::_List_node_base *) &__x),
145 : *((std::_List_node_base *) &__y));
146 : }
147 : }
148 : #endif
149 :
150 : #endif /*MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)*/
151 :
152 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 11)
153 : /* Hack to avoid GLIBCXX_3.4.11 symbol versions
154 : An inline definition of ctype<char>::_M_widen_init() used to be in
155 : locale_facets.h before GCC 4.4, but moved out of headers in more
156 : recent versions.
157 : It is actually safe to make it do nothing. */
158 0 : void ctype<char>::_M_widen_init() const {}
159 : #endif
160 :
161 : }
|