Bug 650480 - Add libstdc++ 4.6 support to the libstdc++ compatibility hack. r=tglek
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 21 Apr 2011 08:53:19 +0200
changeset 68383 bf99d8e0734e28ff197ad964f263697fdc673308
parent 68382 a7ef81a75db73e12849afae4b797e1cd9baea868
child 68388 7cdcae5dee49246208c753e46bd4a66831aee1d6
push idunknown
push userunknown
push dateunknown
reviewerstglek
bugs650480
milestone6.0a1
Bug 650480 - Add libstdc++ 4.6 support to the libstdc++ compatibility hack. r=tglek
build/stdc++compat.cpp
--- a/build/stdc++compat.cpp
+++ b/build/stdc++compat.cpp
@@ -56,57 +56,82 @@ namespace std {
      * in debug builds */
     template char *basic_string<char, char_traits<char>, allocator<char> >::_S_construct_aux_2(size_type, char, allocator<char> const&);
     template wchar_t *basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
 #endif
 #endif
 }
 
 namespace std __attribute__((visibility("default"))) {
-
 #if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)
     /* Hack to avoid GLIBCXX_3.4.14 symbol versions */
     struct _List_node_base
     {
         void hook(_List_node_base * const __position) throw ();
 
         void unhook() throw ();
 
         void transfer(_List_node_base * const __first,
                       _List_node_base * const __last) throw();
 
+/* Hack to avoid GLIBCXX_3.4.15 symbol versions */
+#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+        static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
+    };
+
+    namespace __detail {
+
+    struct _List_node_base
+    {
+#endif
         void _M_hook(_List_node_base * const __position) throw ();
 
         void _M_unhook() throw ();
 
         void _M_transfer(_List_node_base * const __first,
                          _List_node_base * const __last) throw();
+
+#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+        static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
+#endif
     };
 
     /* The functions actually have the same implementation */
     void
     _List_node_base::_M_hook(_List_node_base * const __position) throw ()
     {
-        hook(__position);
+        ((std::_List_node_base *)this)->hook((std::_List_node_base * const) __position);
     }
 
     void
     _List_node_base::_M_unhook() throw ()
     {
-        unhook();
+        ((std::_List_node_base *)this)->unhook();
     }
 
     void
     _List_node_base::_M_transfer(_List_node_base * const __first,
                                  _List_node_base * const __last) throw ()
     {
-        transfer(__first, __last);
+        ((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first,
+                                                 (std::_List_node_base * const)__last);
     }
+
+#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+    void
+    _List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
+    {
+        std::_List_node_base::swap(*((std::_List_node_base *) &__x),
+                                   *((std::_List_node_base *) &__y));
+    }
+}
 #endif
 
+#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
+
 #if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)
     /* Hack to avoid GLIBCXX_3.4.11 symbol versions
        An inline definition of ctype<char>::_M_widen_init() used to be in
        locale_facets.h before GCC 4.4, but moved out of headers in more
        recent versions.
        It is actually safe to make it do nothing. */
     void ctype<char>::_M_widen_init() const {}
 #endif