PATCH 16844

Matt Austern austern@apple.com
Mon Aug 2 01:28:00 GMT 2004


This is the fix I described in the bugzilla report.  Test cases that  
explicitly instantiate containers are included.  (Which is a good  
thing, since one of those test cases revealed a similar bug in another  
container.)

OK to commit to mainline?

			--Matt

? .DS_Store
? fastjar/fastjar.info
? gcc/.gdb_history
? libffi/.DS_Store
? libffi/src/.DS_Store
? libffi/src/powerpc/.DS_Store
Index: libstdc++-v3/include/bits/stl_list.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_list.h,v
retrieving revision 1.42
diff -p -r1.42 stl_list.h
*** libstdc++-v3/include/bits/stl_list.h	28 Jul 2004 16:37:17 -0000	1.42
--- libstdc++-v3/include/bits/stl_list.h	2 Aug 2004 01:26:46 -0000
*************** namespace _GLIBCXX_STD
*** 445,472 ****
   	return __p;
         }

-       /**
-        *  @if maint
-        *  Allocates space for a new node and default-constructs a new
-        *  instance of @c value_type in it.
-        *  @endif
-        */
-       _Node*
-       _M_create_node()
-       {
- 	_Node* __p = this->_M_get_node();
- 	try
- 	  {
- 	    this->get_allocator().construct(&__p->_M_data);
- 	  }
- 	catch(...)
- 	  {
- 	    _M_put_node(__p);
- 	    __throw_exception_again;
- 	  }
- 	return __p;
-       }
-
       public:
         // [23.2.2.1] construct/copy/destroy
         // (assign() and get_allocator() are also listed in this  
section)
--- 445,450 ----
Index: libstdc++-v3/include/ext/slist
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/slist,v
retrieving revision 1.23
diff -p -r1.23 slist
*** libstdc++-v3/include/ext/slist	28 Jul 2004 16:37:18 -0000	1.23
--- libstdc++-v3/include/ext/slist	2 Aug 2004 01:26:46 -0000
*************** namespace __gnu_cxx
*** 344,350 ****
   	_Node* __node = this->_M_get_node();
   	try
   	  {
! 	    get_allocator().construct(&__node->_M_data);
   	    __node->_M_next = 0;
   	  }
   	catch(...)
--- 344,350 ----
   	_Node* __node = this->_M_get_node();
   	try
   	  {
! 	    get_allocator().construct(&__node->_M_data, value_type());
   	    __node->_M_next = 0;
   	  }
   	catch(...)
Index:  
libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/deque/explicit_instantiation.cc	2  
Aug 2004 01:26:46 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <deque>
+
+ // { dg-do compile }
+
+ template class std::deque<int>;
Index:  
libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/list/explicit_instantiation.cc	2  
Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <list>
+
+ // { dg-do compile }
+
+ template class std::list<int>;
Index:  
libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/map/explicit_instantiation.cc	2  
Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <map>
+
+ // { dg-do compile }
+
+ template class std::map<int, double>;
Index:  
libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/multimap/explicit_instantiation.cc 
	2 Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <map>
+
+ // { dg-do compile }
+
+ template class std::multimap<int, double>;
Index:  
libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/multiset/explicit_instantiation.cc 
	2 Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <set>
+
+ // { dg-do compile }
+
+ template class std::multiset<int>;
Index:  
libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/set/explicit_instantiation.cc	2  
Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <set>
+
+ // { dg-do compile }
+
+ template class std::set<int>;
Index:  
libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc
===================================================================
RCS file:  
libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc
diff -N  
libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
---  
libstdc++-v3/testsuite/23_containers/vector/explicit_instantiation.cc	2  
Aug 2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <vector>
+
+ // { dg-do compile }
+
+ template class std::vector<int>;
Index: libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc
===================================================================
RCS file: libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc
diff -N libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- libstdc++-v3/testsuite/ext/hash_set_explicit_instantiation.cc	2 Aug  
2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <ext/hash_set>
+
+ // { dg-do compile }
+
+ template class __gnu_cxx::hash_set<int>;
Index: libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc
===================================================================
RCS file: libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc
diff -N libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- libstdc++-v3/testsuite/ext/slist_explicit_instantiation.cc	2 Aug  
2004 01:26:49 -0000
***************
*** 0 ****
--- 1,34 ----
+ // Copyright (C) 2004 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 2, 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.
+
+ // You should have received a copy of the GNU General Public License  
along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free  
software
+ // library without restriction.  Specifically, if other files  
instantiate
+ // templates or use macros or inline functions from this file, or you  
compile
+ // this file and link it with other files to produce an executable,  
this
+ // file does not by itself cause the resulting executable to be  
covered by
+ // the GNU General Public License.  This exception does not however
+ // invalidate any other reasons why the executable file might be  
covered by
+ // the GNU General Public License.
+
+ // This file tests explicit instantiation of library containers
+
+ #include <ext/slist>
+
+ // { dg-do compile }
+
+ template class __gnu_cxx::slist<int>;



More information about the Libstdc++ mailing list