blob: dcd1f494b13ee7d337f15385f521bf53ad25530e [file] [log] [blame]
diff -Naur a/gcc-4.6/libstdc++-v3/include/bits/compatibility-list.h b/gcc-4.6/libstdc++-v3/include/bits/compatibility-list.h
--- a/gcc-4.6/libstdc++-v3/include/bits/compatibility-list.h 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc-4.6/libstdc++-v3/include/bits/compatibility-list.h 2012-03-09 13:29:59.666688001 -0800
@@ -0,0 +1,59 @@
+// Compatibility symbols for previous versions, list bits -*- C++ -*-
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+# define _GLIBCXX_BEGIN_NAMESPACE_COMPAT
+#endif
+#ifndef _GLIBCXX_END_NAMESPACE_COMPAT
+# define _GLIBCXX_END_NAMESPACE_COMPAT
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_COMPAT
+
+ struct _List_node_base
+ {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+
+ static void
+ swap(_List_node_base& __x, _List_node_base& __y) throw ();
+ void
+ transfer(_List_node_base * const __first,
+ _List_node_base * const __last) throw ();
+
+ void
+ reverse() throw ();
+
+ void
+ hook(_List_node_base * const __position) throw ();
+
+ void
+ unhook() throw ();
+ };
+
+_GLIBCXX_END_NAMESPACE_COMPAT
+
+} // namespace std
diff -Naur a/gcc-4.6/libstdc++-v3/include/bits/stl_list.h b/gcc-4.6/libstdc++-v3/include/bits/stl_list.h
--- a/gcc-4.6/libstdc++-v3/include/bits/stl_list.h 2012-03-07 13:20:10.432803430 -0800
+++ b/gcc-4.6/libstdc++-v3/include/bits/stl_list.h 2012-03-09 13:50:16.494258161 -0800
@@ -59,6 +59,7 @@
#include <bits/concept_check.h>
#include <initializer_list>
+#include <bits/compatibility-list.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -79,20 +80,39 @@
_List_node_base* _M_prev;
static void
- swap(_List_node_base& __x, _List_node_base& __y) throw ();
-
+ swap(_List_node_base& __x, _List_node_base& __y) throw ()
+ {
+ std::_List_node_base::swap(reinterpret_cast<std::_List_node_base &>(__x),
+ reinterpret_cast<std::_List_node_base &>(__y));
+ }
+
void
_M_transfer(_List_node_base* const __first,
- _List_node_base* const __last) throw ();
+ _List_node_base* const __last) throw ()
+ {
+ (reinterpret_cast<std::_List_node_base *>(this))->transfer(
+ reinterpret_cast<std::_List_node_base * const>(__first),
+ reinterpret_cast<std::_List_node_base * const>(__last));
+ }
void
- _M_reverse() throw ();
+ _M_reverse() throw ()
+ {
+ (reinterpret_cast<std::_List_node_base *>(this))->reverse();
+ }
void
- _M_hook(_List_node_base* const __position) throw ();
+ _M_hook(_List_node_base* const __position) throw ()
+ {
+ (reinterpret_cast<std::_List_node_base *>(this))->hook(
+ reinterpret_cast<std::_List_node_base * const>(__position));
+ }
void
- _M_unhook() throw ();
+ _M_unhook() throw ()
+ {
+ (reinterpret_cast<std::_List_node_base *>(this))->unhook();
+ }
};
_GLIBCXX_END_NAMESPACE_VERSION
diff -Naur a/gcc-4.6/libstdc++-v3/include/Makefile.am b/gcc-4.6/libstdc++-v3/include/Makefile.am
--- a/gcc-4.6/libstdc++-v3/include/Makefile.am 2012-03-07 13:20:10.412803182 -0800
+++ b/gcc-4.6/libstdc++-v3/include/Makefile.am 2012-03-09 14:40:07.649674476 -0800
@@ -148,6 +148,7 @@
${bits_srcdir}/stl_iterator_base_funcs.h \
${bits_srcdir}/stl_iterator_base_types.h \
${bits_srcdir}/stl_list.h \
+ ${bits_srcdir}/compatibility-list.h \
${bits_srcdir}/stl_map.h \
${bits_srcdir}/stl_multimap.h \
${bits_srcdir}/stl_multiset.h \
diff -Naur a/gcc-4.6/libstdc++-v3/include/Makefile.in b/gcc-4.6/libstdc++-v3/include/Makefile.in
--- a/gcc-4.6/libstdc++-v3/include/Makefile.in 2012-03-07 13:20:10.412803182 -0800
+++ b/gcc-4.6/libstdc++-v3/include/Makefile.in 2012-03-09 14:40:50.000312583 -0800
@@ -399,6 +399,7 @@
${bits_srcdir}/stl_iterator_base_funcs.h \
${bits_srcdir}/stl_iterator_base_types.h \
${bits_srcdir}/stl_list.h \
+ ${bits_srcdir}/compatibility-list.h \
${bits_srcdir}/stl_map.h \
${bits_srcdir}/stl_multimap.h \
${bits_srcdir}/stl_multiset.h \
diff -Naur a/gcc-4.6/libstdc++-v3/src/compatibility-list.cc b/gcc-4.6/libstdc++-v3/src/compatibility-list.cc
--- a/gcc-4.6/libstdc++-v3/src/compatibility-list.cc 2012-03-07 13:20:10.502804305 -0800
+++ b/gcc-4.6/libstdc++-v3/src/compatibility-list.cc 2012-03-09 13:43:00.967952552 -0800
@@ -23,41 +23,12 @@
// <http://www.gnu.org/licenses/>.
#include <bits/move.h>
-
-#ifndef _GLIBCXX_BEGIN_NAMESPACE_COMPAT
-# define _GLIBCXX_BEGIN_NAMESPACE_COMPAT
-#endif
-
-#ifndef _GLIBCXX_END_NAMESPACE_COMPAT
-# define _GLIBCXX_END_NAMESPACE_COMPAT
-#endif
+#include <bits/compatibility-list.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_COMPAT
- struct _List_node_base
- {
- _List_node_base* _M_next;
- _List_node_base* _M_prev;
-
- static void
- swap(_List_node_base& __x, _List_node_base& __y) throw ();
-
- void
- transfer(_List_node_base * const __first,
- _List_node_base * const __last) throw ();
-
- void
- reverse() throw ();
-
- void
- hook(_List_node_base * const __position) throw ();
-
- void
- unhook() throw ();
- };
-
void
_List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw()
{
diff -Naur a/gcc-4.6/libstdc++-v3/src/list.cc b/gcc-4.6/libstdc++-v3/src/list.cc
--- a/gcc-4.6/libstdc++-v3/src/list.cc 2012-03-07 13:20:10.512804430 -0800
+++ b/gcc-4.6/libstdc++-v3/src/list.cc 2012-03-09 13:57:58.141224520 -0800
@@ -56,6 +56,50 @@
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if 0
+
+/*
+ The following member functions are removed to avoid dependencies on more
+ recent libstdc++.
+
+ See http://glandium.org/blog/?p=1901 for similiar situation in GCC 4.5.
+
+ In short, executable compiled by GCC 4.6 may not run on system with
+ libstdc++ comes with GCC 4.4. For example,
+
+ #include <list>
+ int main()
+ {
+ std::list<int> l;
+ l.push_back(42);
+ return 0;
+ }
+
+ The above code compiled by GCC 4.6 may run into error message reads
+
+ ./a.out: /usr/lib32/libstdc++.so.6: version GLIBCXX_3.4.15' not found (required by ./a.out)
+
+ The reason is that std::list<init>::push_back(int &) calls _M_insert()
+ which in turns calls _M_hook() in the gcc-4.6/libstdc++-v3/include/bits/stl_list.h
+ instead of _hook() in gcc-4.4.3's counterpart. _M_hook() is annotated
+ with version GLIBCXX_3.4.15, and that's why running the above a.out on
+ system with libstdc++ built from <= GCC 4.4 will fail.
+
+ It's not practical to ask all customers to update their libstdc++.
+ t's not easy to compile old 4.4.3 libstd++ with GCC 4.6, either.
+ (NOTE: libstdc++ is released as part of GCC, so there may be strong tie
+ in between)
+
+ Luckily (and couriously), the implementation of _List_node_base doesn't
+ change (except for adding "throw()" hint for compiler optimization) in
+ despite of the name changes (with new prefix _M_ in GCC 4.5 and GCC 4.6,
+ see gcc-4.6/libstdc++-v3/src/list.cc). So, here goes the workaround:
+
+ 1. Remove the following member functions implementations.
+ 2. In bits/stl_list.h, these functions call to their counterparts in
+ old implementations (ie. old functions w/o _M_ prefix)
+*/
+
void
_List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw()
{
@@ -139,6 +183,8 @@
__next_node->_M_prev = __prev_node;
}
+#endif // 0
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
} // namespace std