2004-03-13 Benjamin Kosnik
* config/allocator: New.
* config/allocator/bitmap_allocator_base.h: New.
* config/allocator/malloc_allocator_base.h: New.
* config/allocator/mt_allocator_base.h: New.
* config/allocator/new_allocator_base.h: New.
* include/bits/allocator.h: Include c++allocator.h.
* acinclude.m4 (GLIBCXX_ENABLE_ALLOCATOR): New.
* aclocal.m4: Regenerate.
* configure.ac: Use GLIBCXX_ENABLE_ALLOCATOR.
* configure: Regenerate.
* include/Makefile.am (host_headers_extra): Add c++allocator.h.
* include/Makefile.in: Regenerate.
* docs/html/configopts.html: Add enable-libstdcxx-allocator.
Index: include/bits/allocator.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/allocator.h,v
retrieving revision 1.10
diff -c -p -r1.10 allocator.h
*** include/bits/allocator.h 12 Mar 2004 23:52:08 -0000 1.10
--- include/bits/allocator.h 13 Mar 2004 05:14:20 -0000
***************
*** 49,60 ****
#define _ALLOCATOR_H 1
// Define the base class to std::allocator.
!
! #include
! #define __glibcxx_default_allocator __gnu_cxx::new_allocator
!
! //#include
! //#define __glibcxx_default_allocator __gnu_cxx::__mt_alloc
namespace std
{
--- 49,55 ----
#define _ALLOCATOR_H 1
// Define the base class to std::allocator.
! #include
namespace std
{
*************** namespace std
*** 82,88 ****
* (See @link Allocators allocators info @endlink for more.)
*/
template
! class allocator: public __glibcxx_default_allocator<_Tp>
{
public:
typedef size_t size_type;
--- 77,83 ----
* (See @link Allocators allocators info @endlink for more.)
*/
template
! class allocator: public ___glibcxx_base_allocator<_Tp>
{
public:
typedef size_t size_type;
*************** namespace std
*** 100,106 ****
allocator() throw() { }
allocator(const allocator& a) throw()
! : __glibcxx_default_allocator<_Tp>(a) { }
template
allocator(const allocator<_Tp1>&) throw() { }
--- 95,101 ----
allocator() throw() { }
allocator(const allocator& a) throw()
! : ___glibcxx_base_allocator<_Tp>(a) { }
template
allocator(const allocator<_Tp1>&) throw() { }
*************** namespace std
*** 129,135 ****
#endif
// Undefine.
! #undef __glibcxx_default_allocator
} // namespace std
#endif
--- 124,130 ----
#endif
// Undefine.
! #undef ___glibcxx_base_allocator
} // namespace std
#endif
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.283
diff -c -p -r1.283 acinclude.m4
*** acinclude.m4 2 Mar 2004 18:29:57 -0000 1.283
--- acinclude.m4 13 Mar 2004 05:14:20 -0000
*************** AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
*** 1171,1176 ****
--- 1171,1250 ----
dnl
+ dnl Check for which std::allocator base class to use. The choice is
+ dnl mapped from a subdirectory of include/ext.
+ dnl
+ dnl Default is new.
+ dnl
+ AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
+ AC_MSG_CHECKING([for std::allocator base class to use])
+ GLIBCXX_ENABLE(allocator,auto,[@<:@=MODEL@:>@],
+ [use MODEL for target allocator package],
+ [permit new|malloc|mt|bitmap|yes|no|auto])
+
+ # If they didn't use this option switch, or if they specified --enable
+ # with no specific model, we'll have to look for one. If they
+ # specified --disable (???), do likewise.
+ if test $enable_allocator = no || test $enable_allocator = yes; then
+ enable_allocator=auto
+ fi
+
+ # Either a known package, or "auto"
+ enable_allocator_flag=$enable_allocator
+
+ # Probe for host-specific support if no specific model is specified.
+ # Default to "new".
+ if test $enable_allocator_flag = auto; then
+ case x${target_os} in
+ xfreebsd*)
+ enable_allocator_flag=mt
+ ;;
+ xhpux11*)
+ enable_allocator_flag=mt
+ ;;
+ xirix6*)
+ enable_allocator_flag=mt
+ ;;
+ xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
+ enable_allocator_flag=mt
+ ;;
+ xsolaris*)
+ enable_allocator_flag=mt
+ ;;
+ *)
+ enable_allocator_flag=new
+ ;;
+ esac
+ fi
+ AC_MSG_RESULT($enable_allocator_flag)
+
+
+ # Set configure bits for specified locale package
+ case ${enable_allocator_flag} in
+ bitmap)
+ ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
+ ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
+ ;;
+ malloc)
+ ALLOCATOR_H=config/allocator/malloc_allocator_base.h
+ ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
+ ;;
+ mt)
+ ALLOCATOR_H=config/allocator/mt_allocator_base.h
+ ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
+ ;;
+ new)
+ ALLOCATOR_H=config/allocator/new_allocator_base.h
+ ALLOCATOR_NAME=__gnu_cxx::new_allocator
+ ;;
+ esac
+
+ AC_SUBST(ALLOCATOR_H)
+ AC_SUBST(ALLOCATOR_NAME)
+ ])
+
+
+ dnl
dnl Check for whether the Boost-derived checks should be turned on.
dnl
dnl --enable-concept-checks turns them on.
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.ac,v
retrieving revision 1.17
diff -c -p -r1.17 configure.ac
*** configure.ac 11 Mar 2004 00:27:41 -0000 1.17
--- configure.ac 13 Mar 2004 05:14:20 -0000
*************** GLIBCXX_ENABLE_PCH($is_hosted)
*** 84,89 ****
--- 84,90 ----
# NB: C_MBCHAR must come early.
GLIBCXX_ENABLE_CSTDIO
GLIBCXX_ENABLE_CLOCALE
+ GLIBCXX_ENABLE_ALLOCATOR
GLIBCXX_ENABLE_CHEADERS($c_model) dnl c_model from configure.host
GLIBCXX_ENABLE_C_MBCHAR([yes])
GLIBCXX_ENABLE_C99([yes])
Index: include/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.am,v
retrieving revision 1.78
diff -c -p -r1.78 Makefile.am
*** include/Makefile.am 12 Mar 2004 03:28:12 -0000 1.78
--- include/Makefile.am 13 Mar 2004 05:14:21 -0000
*************** host_headers_noinst = \
*** 351,356 ****
--- 351,357 ----
host_headers_extra = \
${host_builddir}/basic_file.h \
${host_builddir}/c++config.h \
+ ${host_builddir}/c++allocator.h \
${host_builddir}/c++io.h \
${host_builddir}/c++locale.h \
${host_builddir}/messages_members.h \
*************** stamp-host: ${host_headers} ${host_heade
*** 480,485 ****
--- 481,487 ----
(cd ${host_builddir} ;\
$(LN_S) ${host_headers} . || true ;\
$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_H) basic_file.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(ALLOCATOR_H) c++allocator.h || true ;\
$(LN_S) ${glibcxx_srcdir}/$(CSTDIO_H) c++io.h || true ;\
$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_H) c++locale.h || true ;\
$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) . || true ;\
Index: config/allocator/bitmap_allocator_base.h
===================================================================
RCS file: config/allocator/bitmap_allocator_base.h
diff -N config/allocator/bitmap_allocator_base.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- config/allocator/bitmap_allocator_base.h 13 Mar 2004 05:14:21 -0000
***************
*** 0 ****
--- 1,37 ----
+ // Base to std::allocator -*- C++ -*-
+
+ // 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.
+
+ #ifndef _CXX_ALLOCATOR_H
+ #define _CXX_ALLOCATOR_H 1
+
+ // Define bitmap_allocator as the base class to std::allocator.
+ #include
+ #define ___glibcxx_base_allocator __gnu_cxx::bitmap_allocator
+
+ #endif
Index: config/allocator/malloc_allocator_base.h
===================================================================
RCS file: config/allocator/malloc_allocator_base.h
diff -N config/allocator/malloc_allocator_base.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- config/allocator/malloc_allocator_base.h 13 Mar 2004 05:14:21 -0000
***************
*** 0 ****
--- 1,37 ----
+ // Base to std::allocator -*- C++ -*-
+
+ // 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.
+
+ #ifndef _CXX_ALLOCATOR_H
+ #define _CXX_ALLOCATOR_H 1
+
+ // Define new_allocator as the base class to std::allocator.
+ #include
+ #define ___glibcxx_base_allocator __gnu_cxx::malloc_allocator
+
+ #endif
Index: config/allocator/mt_allocator_base.h
===================================================================
RCS file: config/allocator/mt_allocator_base.h
diff -N config/allocator/mt_allocator_base.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- config/allocator/mt_allocator_base.h 13 Mar 2004 05:14:21 -0000
***************
*** 0 ****
--- 1,37 ----
+ // Base to std::allocator -*- C++ -*-
+
+ // 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.
+
+ #ifndef _CXX_ALLOCATOR_H
+ #define _CXX_ALLOCATOR_H 1
+
+ // Define mt_allocator as the base class to std::allocator.
+ #include
+ #define ___glibcxx_base_allocator __gnu_cxx::__mt_alloc
+
+ #endif
Index: config/allocator/new_allocator_base.h
===================================================================
RCS file: config/allocator/new_allocator_base.h
diff -N config/allocator/new_allocator_base.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- config/allocator/new_allocator_base.h 13 Mar 2004 05:14:21 -0000
***************
*** 0 ****
--- 1,37 ----
+ // Base to std::allocator -*- C++ -*-
+
+ // 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.
+
+ #ifndef _CXX_ALLOCATOR_H
+ #define _CXX_ALLOCATOR_H 1
+
+ // Define new_allocator as the base class to std::allocator.
+ #include
+ #define ___glibcxx_base_allocator __gnu_cxx::new_allocator
+
+ #endif
Index: docs/html/configopts.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/configopts.html,v
retrieving revision 1.33
diff -c -p -r1.33 configopts.html
*** docs/html/configopts.html 18 Nov 2003 20:56:06 -0000 1.33
--- docs/html/configopts.html 13 Mar 2004 05:14:21 -0000
*************** options
*** 124,129 ****
--- 124,147 ----
+ --enable-libstdcxx-allocator
+ This is an abbreviated form of '--enable-clocale=new'
+ (described next). This option can change the library ABI.
+
+
+
+ --enable-libstdcxx-allocator=OPTION
+
+ Select a target-specific underlying std::allocator. The
+ choices are 'new' to specify a wrapper for new, 'malloc' to
+ specify a wrapper for malloc, 'pool' for the allocator from
+ GCC 3.2.x and 3.3.x, 'mt' for a fixed power of two allocator
+ (More info) or
+ 'bitmap' for a bitmap allocator. This option can change the
+ library ABI.
+
+
+
--enable-cheaders=OPTION
This allows the user to define what kind of C headers are
used. Options are: c, c_std, and c_shadow. These correspond