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 : template ostream& ostream::_M_insert(const void*);
63 : template ostream& __ostream_insert(ostream&, const char*, streamsize);
64 : template istream& istream::_M_extract(double&);
65 : #endif
66 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
67 : /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
68 : * depending on optimization level */
69 : template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
70 : #ifdef _GLIBCXX_USE_WCHAR_T
71 : template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
72 : #endif /* _GLIBCXX_USE_WCHAR_T */
73 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
74 : template string::basic_string(string&&);
75 : template string& string::operator=(string&&);
76 : template wstring::basic_string(wstring&&);
77 : template wstring& wstring::operator=(wstring&&);
78 : template wstring& wstring::assign(wstring&&);
79 : #endif /* __GXX_EXPERIMENTAL_CXX0X__ */
80 : #endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
81 : }
82 :
83 : namespace std __attribute__((visibility("default"))) {
84 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
85 : /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
86 : struct _List_node_base
87 : {
88 : void hook(_List_node_base * const __position) throw ();
89 :
90 : void unhook() throw ();
91 :
92 : void transfer(_List_node_base * const __first,
93 : _List_node_base * const __last) throw();
94 :
95 : /* Hack to avoid GLIBCXX_3.4.15 symbol versions */
96 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
97 : static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
98 : };
99 :
100 : namespace __detail {
101 :
102 : struct _List_node_base
103 : {
104 : #endif
105 : void _M_hook(_List_node_base * const __position) throw ();
106 :
107 : void _M_unhook() throw ();
108 :
109 : void _M_transfer(_List_node_base * const __first,
110 : _List_node_base * const __last) throw();
111 :
112 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
113 : static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
114 : #endif
115 : };
116 :
117 : /* The functions actually have the same implementation */
118 : void
119 569 : _List_node_base::_M_hook(_List_node_base * const __position) throw ()
120 : {
121 569 : ((std::_List_node_base *)this)->hook((std::_List_node_base * const) __position);
122 569 : }
123 :
124 : void
125 28 : _List_node_base::_M_unhook() throw ()
126 : {
127 28 : ((std::_List_node_base *)this)->unhook();
128 28 : }
129 :
130 : void
131 0 : _List_node_base::_M_transfer(_List_node_base * const __first,
132 : _List_node_base * const __last) throw ()
133 : {
134 : ((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first,
135 0 : (std::_List_node_base * const)__last);
136 0 : }
137 :
138 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
139 : void
140 : _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
141 : {
142 : std::_List_node_base::swap(*((std::_List_node_base *) &__x),
143 : *((std::_List_node_base *) &__y));
144 : }
145 : }
146 : #endif
147 :
148 : #endif /*MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)*/
149 :
150 : #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 11)
151 : /* Hack to avoid GLIBCXX_3.4.11 symbol versions
152 : An inline definition of ctype<char>::_M_widen_init() used to be in
153 : locale_facets.h before GCC 4.4, but moved out of headers in more
154 : recent versions.
155 : It is actually safe to make it do nothing. */
156 0 : void ctype<char>::_M_widen_init() const {}
157 : #endif
158 :
159 : }
|