Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include <ostream> |
michael@0 | 6 | #include <istream> |
michael@0 | 7 | #include <string> |
michael@0 | 8 | |
michael@0 | 9 | /* GLIBCXX_3.4.8 is from gcc 4.1.1 (111691) |
michael@0 | 10 | GLIBCXX_3.4.9 is from gcc 4.2.0 (111690) |
michael@0 | 11 | GLIBCXX_3.4.10 is from gcc 4.3.0 (126287) |
michael@0 | 12 | GLIBCXX_3.4.11 is from gcc 4.4.0 (133006) |
michael@0 | 13 | GLIBCXX_3.4.12 is from gcc 4.4.1 (147138) |
michael@0 | 14 | GLIBCXX_3.4.13 is from gcc 4.4.2 (151127) |
michael@0 | 15 | GLIBCXX_3.4.14 is from gcc 4.5.0 (151126) |
michael@0 | 16 | GLIBCXX_3.4.15 is from gcc 4.6.0 (160071) |
michael@0 | 17 | GLIBCXX_3.4.16 is form gcc 4.6.1 (172240) */ |
michael@0 | 18 | |
michael@0 | 19 | #define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) |
michael@0 | 20 | |
michael@0 | 21 | namespace std { |
michael@0 | 22 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9) |
michael@0 | 23 | /* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */ |
michael@0 | 24 | template ostream& ostream::_M_insert(double); |
michael@0 | 25 | template ostream& ostream::_M_insert(long); |
michael@0 | 26 | template ostream& ostream::_M_insert(unsigned long); |
michael@0 | 27 | template ostream& ostream::_M_insert(long long); |
michael@0 | 28 | template ostream& ostream::_M_insert(unsigned long long); |
michael@0 | 29 | template ostream& ostream::_M_insert(bool); |
michael@0 | 30 | template ostream& ostream::_M_insert(const void*); |
michael@0 | 31 | template ostream& __ostream_insert(ostream&, const char*, streamsize); |
michael@0 | 32 | template istream& istream::_M_extract(double&); |
michael@0 | 33 | template istream& istream::_M_extract(float&); |
michael@0 | 34 | template istream& istream::_M_extract(unsigned int&); |
michael@0 | 35 | template istream& istream::_M_extract(unsigned long&); |
michael@0 | 36 | template istream& istream::_M_extract(unsigned short&); |
michael@0 | 37 | template istream& istream::_M_extract(unsigned long long&); |
michael@0 | 38 | #endif |
michael@0 | 39 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14) |
michael@0 | 40 | /* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions |
michael@0 | 41 | * depending on optimization level */ |
michael@0 | 42 | template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&); |
michael@0 | 43 | #ifdef _GLIBCXX_USE_WCHAR_T |
michael@0 | 44 | template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&); |
michael@0 | 45 | #endif /* _GLIBCXX_USE_WCHAR_T */ |
michael@0 | 46 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
michael@0 | 47 | template string::basic_string(string&&); |
michael@0 | 48 | template string& string::operator=(string&&); |
michael@0 | 49 | template wstring::basic_string(wstring&&); |
michael@0 | 50 | template wstring& wstring::operator=(wstring&&); |
michael@0 | 51 | template string& string::assign(string&&); |
michael@0 | 52 | template wstring& wstring::assign(wstring&&); |
michael@0 | 53 | #endif /* __GXX_EXPERIMENTAL_CXX0X__ */ |
michael@0 | 54 | #endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */ |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | namespace std __attribute__((visibility("default"))) { |
michael@0 | 58 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14) |
michael@0 | 59 | /* Hack to avoid GLIBCXX_3.4.14 symbol versions */ |
michael@0 | 60 | struct _List_node_base |
michael@0 | 61 | { |
michael@0 | 62 | void hook(_List_node_base * const __position) throw (); |
michael@0 | 63 | |
michael@0 | 64 | void unhook() throw (); |
michael@0 | 65 | |
michael@0 | 66 | void transfer(_List_node_base * const __first, |
michael@0 | 67 | _List_node_base * const __last) throw(); |
michael@0 | 68 | |
michael@0 | 69 | void reverse() throw(); |
michael@0 | 70 | |
michael@0 | 71 | /* Hack to avoid GLIBCXX_3.4.15 symbol versions */ |
michael@0 | 72 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15) |
michael@0 | 73 | static void swap(_List_node_base& __x, _List_node_base& __y) throw (); |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | namespace __detail { |
michael@0 | 77 | |
michael@0 | 78 | struct _List_node_base |
michael@0 | 79 | { |
michael@0 | 80 | #endif |
michael@0 | 81 | void _M_hook(_List_node_base * const __position) throw (); |
michael@0 | 82 | |
michael@0 | 83 | void _M_unhook() throw (); |
michael@0 | 84 | |
michael@0 | 85 | void _M_transfer(_List_node_base * const __first, |
michael@0 | 86 | _List_node_base * const __last) throw(); |
michael@0 | 87 | |
michael@0 | 88 | void _M_reverse() throw(); |
michael@0 | 89 | |
michael@0 | 90 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15) |
michael@0 | 91 | static void swap(_List_node_base& __x, _List_node_base& __y) throw (); |
michael@0 | 92 | #endif |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | /* The functions actually have the same implementation */ |
michael@0 | 96 | void |
michael@0 | 97 | _List_node_base::_M_hook(_List_node_base * const __position) throw () |
michael@0 | 98 | { |
michael@0 | 99 | ((std::_List_node_base *)this)->hook((std::_List_node_base * const) __position); |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | void |
michael@0 | 103 | _List_node_base::_M_unhook() throw () |
michael@0 | 104 | { |
michael@0 | 105 | ((std::_List_node_base *)this)->unhook(); |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | void |
michael@0 | 109 | _List_node_base::_M_transfer(_List_node_base * const __first, |
michael@0 | 110 | _List_node_base * const __last) throw () |
michael@0 | 111 | { |
michael@0 | 112 | ((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first, |
michael@0 | 113 | (std::_List_node_base * const)__last); |
michael@0 | 114 | } |
michael@0 | 115 | |
michael@0 | 116 | void |
michael@0 | 117 | _List_node_base::_M_reverse() throw () |
michael@0 | 118 | { |
michael@0 | 119 | ((std::_List_node_base *)this)->reverse(); |
michael@0 | 120 | } |
michael@0 | 121 | |
michael@0 | 122 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15) |
michael@0 | 123 | void |
michael@0 | 124 | _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw () |
michael@0 | 125 | { |
michael@0 | 126 | std::_List_node_base::swap(*((std::_List_node_base *) &__x), |
michael@0 | 127 | *((std::_List_node_base *) &__y)); |
michael@0 | 128 | } |
michael@0 | 129 | } |
michael@0 | 130 | #endif |
michael@0 | 131 | |
michael@0 | 132 | #endif /*MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)*/ |
michael@0 | 133 | |
michael@0 | 134 | #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 11) |
michael@0 | 135 | /* Hack to avoid GLIBCXX_3.4.11 symbol versions |
michael@0 | 136 | An inline definition of ctype<char>::_M_widen_init() used to be in |
michael@0 | 137 | locale_facets.h before GCC 4.4, but moved out of headers in more |
michael@0 | 138 | recent versions. |
michael@0 | 139 | It is actually safe to make it do nothing. */ |
michael@0 | 140 | void ctype<char>::_M_widen_init() const {} |
michael@0 | 141 | #endif |
michael@0 | 142 | |
michael@0 | 143 | } |