build/unix/stdc++compat/stdc++compat.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/unix/stdc++compat/stdc++compat.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,143 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include <ostream>
     1.9 +#include <istream>
    1.10 +#include <string>
    1.11 +
    1.12 +/* GLIBCXX_3.4.8  is from gcc 4.1.1 (111691)
    1.13 +   GLIBCXX_3.4.9  is from gcc 4.2.0 (111690)
    1.14 +   GLIBCXX_3.4.10 is from gcc 4.3.0 (126287)
    1.15 +   GLIBCXX_3.4.11 is from gcc 4.4.0 (133006)
    1.16 +   GLIBCXX_3.4.12 is from gcc 4.4.1 (147138)
    1.17 +   GLIBCXX_3.4.13 is from gcc 4.4.2 (151127)
    1.18 +   GLIBCXX_3.4.14 is from gcc 4.5.0 (151126)
    1.19 +   GLIBCXX_3.4.15 is from gcc 4.6.0 (160071)
    1.20 +   GLIBCXX_3.4.16 is form gcc 4.6.1 (172240) */
    1.21 +
    1.22 +#define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))
    1.23 +
    1.24 +namespace std {
    1.25 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9)
    1.26 +    /* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */
    1.27 +    template ostream& ostream::_M_insert(double);
    1.28 +    template ostream& ostream::_M_insert(long);
    1.29 +    template ostream& ostream::_M_insert(unsigned long);
    1.30 +    template ostream& ostream::_M_insert(long long);
    1.31 +    template ostream& ostream::_M_insert(unsigned long long);
    1.32 +    template ostream& ostream::_M_insert(bool);
    1.33 +    template ostream& ostream::_M_insert(const void*);
    1.34 +    template ostream& __ostream_insert(ostream&, const char*, streamsize);
    1.35 +    template istream& istream::_M_extract(double&);
    1.36 +    template istream& istream::_M_extract(float&);
    1.37 +    template istream& istream::_M_extract(unsigned int&);
    1.38 +    template istream& istream::_M_extract(unsigned long&);
    1.39 +    template istream& istream::_M_extract(unsigned short&);
    1.40 +    template istream& istream::_M_extract(unsigned long long&);
    1.41 +#endif
    1.42 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
    1.43 +    /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
    1.44 +     * depending on optimization level */
    1.45 +    template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
    1.46 +#ifdef _GLIBCXX_USE_WCHAR_T
    1.47 +    template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
    1.48 +#endif /* _GLIBCXX_USE_WCHAR_T */
    1.49 +#ifdef __GXX_EXPERIMENTAL_CXX0X__
    1.50 +    template string::basic_string(string&&);
    1.51 +    template string& string::operator=(string&&);
    1.52 +    template wstring::basic_string(wstring&&);
    1.53 +    template wstring& wstring::operator=(wstring&&);
    1.54 +    template string& string::assign(string&&);
    1.55 +    template wstring& wstring::assign(wstring&&);
    1.56 +#endif /* __GXX_EXPERIMENTAL_CXX0X__ */
    1.57 +#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
    1.58 +}
    1.59 +
    1.60 +namespace std __attribute__((visibility("default"))) {
    1.61 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
    1.62 +    /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
    1.63 +    struct _List_node_base
    1.64 +    {
    1.65 +        void hook(_List_node_base * const __position) throw ();
    1.66 +
    1.67 +        void unhook() throw ();
    1.68 +
    1.69 +        void transfer(_List_node_base * const __first,
    1.70 +                      _List_node_base * const __last) throw();
    1.71 +
    1.72 +        void reverse() throw();
    1.73 +
    1.74 +/* Hack to avoid GLIBCXX_3.4.15 symbol versions */
    1.75 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
    1.76 +        static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
    1.77 +    };
    1.78 +
    1.79 +    namespace __detail {
    1.80 +
    1.81 +    struct _List_node_base
    1.82 +    {
    1.83 +#endif
    1.84 +        void _M_hook(_List_node_base * const __position) throw ();
    1.85 +
    1.86 +        void _M_unhook() throw ();
    1.87 +
    1.88 +        void _M_transfer(_List_node_base * const __first,
    1.89 +                         _List_node_base * const __last) throw();
    1.90 +
    1.91 +        void _M_reverse() throw();
    1.92 +
    1.93 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
    1.94 +        static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
    1.95 +#endif
    1.96 +    };
    1.97 +
    1.98 +    /* The functions actually have the same implementation */
    1.99 +    void
   1.100 +    _List_node_base::_M_hook(_List_node_base * const __position) throw ()
   1.101 +    {
   1.102 +        ((std::_List_node_base *)this)->hook((std::_List_node_base * const) __position);
   1.103 +    }
   1.104 +
   1.105 +    void
   1.106 +    _List_node_base::_M_unhook() throw ()
   1.107 +    {
   1.108 +        ((std::_List_node_base *)this)->unhook();
   1.109 +    }
   1.110 +
   1.111 +    void
   1.112 +    _List_node_base::_M_transfer(_List_node_base * const __first,
   1.113 +                                 _List_node_base * const __last) throw ()
   1.114 +    {
   1.115 +        ((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first,
   1.116 +                                                 (std::_List_node_base * const)__last);
   1.117 +    }
   1.118 +
   1.119 +    void
   1.120 +    _List_node_base::_M_reverse() throw ()
   1.121 +    {
   1.122 +        ((std::_List_node_base *)this)->reverse();
   1.123 +    }
   1.124 +
   1.125 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
   1.126 +    void
   1.127 +    _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
   1.128 +    {
   1.129 +        std::_List_node_base::swap(*((std::_List_node_base *) &__x),
   1.130 +                                   *((std::_List_node_base *) &__y));
   1.131 +    }
   1.132 +}
   1.133 +#endif
   1.134 +
   1.135 +#endif /*MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)*/
   1.136 +
   1.137 +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 11)
   1.138 +    /* Hack to avoid GLIBCXX_3.4.11 symbol versions
   1.139 +       An inline definition of ctype<char>::_M_widen_init() used to be in
   1.140 +       locale_facets.h before GCC 4.4, but moved out of headers in more
   1.141 +       recent versions.
   1.142 +       It is actually safe to make it do nothing. */
   1.143 +    void ctype<char>::_M_widen_init() const {}
   1.144 +#endif
   1.145 +
   1.146 +}

mercurial