Bug 8708 - __USE_MALLOC doesn't work
Summary: __USE_MALLOC doesn't work
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Benjamin Kosnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-25 21:16 UTC by Benjamin Kosnik
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kosnik 2002-11-25 21:16:00 UTC
Cannot __USE_MALLOC to get a malloc allocator.This is a regression from 2.95 and 2.96 based compilers.

This is fixed in mainline with the use of GLIBCPP_FORCE_NEW.

2002-10-18  Loren J. Rittle  <ljrittle@acm.org>
	    Brad Spencer  <spencer@infointeractive.com> 
	    (provided alternate patch and improvements)

	* docs/html/23_containers/howto.html (GLIBCPP_FORCE_NEW): Document
	new environment variable which replaces all uses of __USE_MALLOC
	macro.
	* docs/html/ext/howto.html (GLIBCPP_FORCE_NEW): Likewise.
	(__mem_interface): Remove all references to old internal typedef.
	* include/backward/alloc.h (__USE_MALLOC): Remove it and all
	guarded code.
	* include/bits/c++config (__USE_MALLOC): Update related error
	message and comment.
	* include/bits/stl_alloc.h (__USE_MALLOC): Remove it and all
	guarded code.  Update all related comments.
	(__mem_interface): Unconditionally replace it with __new_alloc.
	However, leave the typedef around in case anyone used it.
	(__default_alloc_template<>::_S_force_new): New class static.
	(__default_alloc_template<>::allocate, deallocate): Add
	run-time controlled feature similar to what __USE_MALLOC code
	path had provided.
	* src/stl-inst.cc (__USE_MALLOC): Remove it and all
	guarded code.
	* testsuite/21_strings/capacity.cc: Remove reference to __USE_MALLOC.
	Add documentation on GLIBCPP_FORCE_NEW environment variable.
	* testsuite/ext/allocators.cc: Likewise.

Release:
gcc-3.2.1 on x86/linux

Environment:
RH 8
Comment 1 Benjamin Kosnik 2002-12-05 23:48:57 UTC
From: bkoz@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libstdc++/8708
Date: 5 Dec 2002 23:48:57 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	bkoz@gcc.gnu.org	2002-12-05 15:48:57
 
 Modified files:
 	libstdc++-v3   : ChangeLog 
 	libstdc++-v3/config: linker-map.gnu 
 	libstdc++-v3/docs/html/23_containers: howto.html 
 	libstdc++-v3/docs/html/ext: howto.html 
 	libstdc++-v3/include/backward: alloc.h 
 	libstdc++-v3/include/bits: c++config stl_alloc.h 
 	libstdc++-v3/src: stl-inst.cc 
 	libstdc++-v3/testsuite: abi_check.cc 
 	libstdc++-v3/testsuite/20_util: allocator_members.cc 
 	libstdc++-v3/testsuite/21_strings: capacity.cc 
 	libstdc++-v3/testsuite/23_containers: vector_capacity.cc 
 	libstdc++-v3/testsuite/ext: allocators.cc 
 
 Log message:
 	2002-12-05  Benjamin Kosnik  <bkoz@redhat.com>
 	
 	* config/linker-map.gnu: Put _S_force_new into GLIBCPP_3.2.2.
 	* testsuite/abi_check.cc: Add GLIBCPP_3.2.2.
 	
 	2002-12-05  Benjamin Kosnik  <bkoz@redhat.com>
 	Gabriel Dos Reis  <gdr@integrable-solutions.net>
 	
 	PR libstdc++/8230
 	* include/bits/stl_alloc.h: Use builtin_expect for the most
 	obvious limit checks.
 	(__default_alloc_template::allocate): Check for null, throw
 	bad_alloc.
 	* testsuite/20_util/allocator_members.cc (test02): Add.
 	* testsuite/23_containers/vector_capacity.cc (test03): Add.
 	
 	2002-12-05  Loren J. Rittle  <ljrittle@acm.org>
 	Brad Spencer  <spencer@infointeractive.com>
 	(provided alternate patch and improvements)
 	
 	PR libstdc++/8708
 	* docs/html/23_containers/howto.html (GLIBCPP_FORCE_NEW): Document
 	new environment variable which replaces all uses of __USE_MALLOC
 	macro.
 	* docs/html/ext/howto.html (GLIBCPP_FORCE_NEW): Likewise.
 	(__mem_interface): Remove all references to old internal typedef.
 	* include/backward/alloc.h (__USE_MALLOC): Remove it and all
 	guarded code.
 	* include/bits/c++config (__USE_MALLOC): Update related error
 	message and comment.
 	* include/bits/stl_alloc.h (__USE_MALLOC): Remove it and all
 	guarded code.  Update all related comments.
 	(__mem_interface): Unconditionally replace it with __new_alloc.
 	However, leave the typedef around in case anyone used it.
 	(__default_alloc_template<>::_S_force_new): New class static.
 	(__default_alloc_template<>::allocate, deallocate): Add
 	run-time controlled feature similar to what __USE_MALLOC code
 	path had provided.
 	* src/stl-inst.cc (__USE_MALLOC): Remove it and all
 	guarded code.
 	* testsuite/21_strings/capacity.cc: Remove reference to __USE_MALLOC.
 	Add documentation on GLIBCPP_FORCE_NEW environment variable.
 	* testsuite/ext/allocators.cc: Likewise.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1057.2.159.2.64&r2=1.1057.2.159.2.65
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/config/linker-map.gnu.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.5.2.6.4.5&r2=1.5.2.6.4.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/23_containers/howto.html.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.20.2.1.2.1&r2=1.20.2.1.2.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/ext/howto.html.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.18.8.2.2.1&r2=1.18.8.2.2.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/backward/alloc.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.11&r2=1.11.14.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/c++config.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.278.2.155.2.133&r2=1.278.2.155.2.134
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_alloc.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.16.2.3&r2=1.16.2.3.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/stl-inst.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.11.2.2&r2=1.11.2.2.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/abi_check.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2.2.9&r2=1.2.2.10
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/20_util/allocator_members.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2&r2=1.2.22.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/21_strings/capacity.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.6.2.1.4.1&r2=1.6.2.1.4.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/23_containers/vector_capacity.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.3.20.1&r2=1.3.20.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/ext/allocators.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1&r2=1.1.22.1
 
Comment 2 Benjamin Kosnik 2002-12-11 08:59:10 UTC
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-Why: Mine.
Comment 3 Benjamin Kosnik 2002-12-11 08:59:10 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Patch moved.