re PR libstdc++/9582 (ODR violation in std::allocator)

2003-02-19  Phil Edwards  <pme@gcc.gnu.org>

	PR libstdc++/9582
	* include/bits/stl_alloc.h:  Remove all traces of assert().

From-SVN: r63136
This commit is contained in:
Phil Edwards 2003-02-20 00:11:43 +00:00
parent 274aef32d9
commit 41662dbb4e
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2003-02-19 Phil Edwards <pme@gcc.gnu.org>
PR libstdc++/9582
* include/bits/stl_alloc.h: Remove all traces of assert().
2003-02-18 Paolo Carlini <pcarlini@unitus.it> 2003-02-18 Paolo Carlini <pcarlini@unitus.it>
* include/std/std_sstream.h (str()): the size of the * include/std/std_sstream.h (str()): the size of the

View File

@ -81,7 +81,6 @@
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <cassert>
#include <bits/functexcept.h> // For __throw_bad_alloc #include <bits/functexcept.h> // For __throw_bad_alloc
#include <bits/stl_threads.h> #include <bits/stl_threads.h>
@ -217,10 +216,7 @@ namespace std
/** /**
* @if maint * @if maint
* An adaptor for an underlying allocator (_Alloc) to check the size * An adaptor for an underlying allocator (_Alloc) to check the size
* arguments for debugging. Errors are reported using assert; these * arguments for debugging.
* checks can be disabled via NDEBUG, but the space penalty is still
* paid, therefore it is far better to just use the underlying allocator
* by itelf when no checking is desired.
* *
* "There is some evidence that this can confuse Purify." - SGI comment * "There is some evidence that this can confuse Purify." - SGI comment
* *
@ -249,7 +245,8 @@ namespace std
deallocate(void* __p, size_t __n) deallocate(void* __p, size_t __n)
{ {
char* __real_p = (char*)__p - (int) _S_extra; char* __real_p = (char*)__p - (int) _S_extra;
assert(*(size_t*)__real_p == __n); if (*(size_t*)__real_p != __n)
abort();
_Alloc::deallocate(__real_p, __n + (int) _S_extra); _Alloc::deallocate(__real_p, __n + (int) _S_extra);
} }
}; };