* config/os/bsd/darwin/os_defines.h

(_GLIBCXX_WEAK_DEFINITION): Define.
	* include/bits/c++config (_GLIBCXX_WEAK_DEFINITION): Define.
	* libsupc++/del_op.cc (operator delete(void *)): Use
	_GLIBCXX_WEAK_DEFINITION.
	* libsupc++/del_opnt.cc
	(operator delete(void *, const std::nothrow_t&)): Same.
	* libsupc++/del_opv.cc (operator delete[](void *)): Same.
	* libsupc++/del_opvnt.cc
	(operator delete[](void *, const std::nothrow_t&)): Same.
	* libsupc++/new_op.cc (operator new(std::size_t)): Same.
	* libsupc++/new_opnt.cc
	(operator new(std::size_t, const std::nothrow_t&)): Same
	* libsupc++/new_opv.cc (operator new[](std::size_t)): Same.
	* libsupc++/new_opvnt.cc
	(operator new[](std::size_t, const std::nothrow_t&)): Same.

From-SVN: r90017
This commit is contained in:
Aaron W. LaFramboise 2004-11-02 21:00:00 -06:00 committed by Aaron W. LaFramboise
parent 71bd71860a
commit 5cc781508e
11 changed files with 40 additions and 8 deletions

View File

@ -1,3 +1,22 @@
2004-11-03 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* config/os/bsd/darwin/os_defines.h
(_GLIBCXX_WEAK_DEFINITION): Define.
* include/bits/c++config (_GLIBCXX_WEAK_DEFINITION): Define.
* libsupc++/del_op.cc (operator delete(void *)): Use
_GLIBCXX_WEAK_DEFINITION.
* libsupc++/del_opnt.cc
(operator delete(void *, const std::nothrow_t&)): Same.
* libsupc++/del_opv.cc (operator delete[](void *)): Same.
* libsupc++/del_opvnt.cc
(operator delete[](void *, const std::nothrow_t&)): Same.
* libsupc++/new_op.cc (operator new(std::size_t)): Same.
* libsupc++/new_opnt.cc
(operator new(std::size_t, const std::nothrow_t&)): Same
* libsupc++/new_opv.cc (operator new[](std::size_t)): Same.
* libsupc++/new_opvnt.cc
(operator new[](std::size_t, const std::nothrow_t&)): Same.
2004-11-02 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int):

View File

@ -38,4 +38,10 @@
links to, so there's no need for weak-ness for that. */
#define _GLIBCXX_GTHREAD_USE_WEAK 0
// On Darwin, in order to enable overriding of operator new and delete,
// GCC makes the definition of these functions weak, relies on the
// loader to implement weak semantics properly, and uses
// -flat_namespace to work around the way that it doesn't.
#define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
#endif

View File

@ -51,6 +51,13 @@
# define _GLIBCXX_EXTERN_TEMPLATE 1
#endif
// Certain function definitions that are meant to be overridable
// from user code are decorated with this macro. For some targets,
// this macro causes these definitions to be weak.
#ifndef _GLIBCXX_WEAK_DEFINITION
#define _GLIBCXX_WEAK_DEFINITION
#endif
// Debug mode support. Debug mode basic_string is not allowed to be
// associated with std, because of locale and exception link
// dependence.

View File

@ -39,7 +39,7 @@ using std::free;
extern "C" void free(void *);
#endif
__attribute__((weak)) void
_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr) throw ()
{
if (ptr)

View File

@ -32,7 +32,7 @@
extern "C" void free (void *);
__attribute__((weak)) void
_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr, const std::nothrow_t&) throw ()
{
if (ptr)

View File

@ -30,7 +30,7 @@
#include "new"
__attribute__((weak)) void
_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr) throw ()
{
::operator delete (ptr);

View File

@ -30,7 +30,7 @@
#include "new"
__attribute__((weak)) void
_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr, const std::nothrow_t&) throw ()
{
::operator delete (ptr);

View File

@ -43,7 +43,7 @@ extern "C" void *malloc (std::size_t);
extern new_handler __new_handler;
__attribute__((weak)) void *
_GLIBCXX_WEAK_DEFINITION void *
operator new (std::size_t sz) throw (std::bad_alloc)
{
void *p;

View File

@ -36,7 +36,7 @@ using std::bad_alloc;
extern "C" void *malloc (std::size_t);
extern new_handler __new_handler;
__attribute__((weak)) void *
_GLIBCXX_WEAK_DEFINITION void *
operator new (std::size_t sz, const std::nothrow_t&) throw()
{
void *p;

View File

@ -30,7 +30,7 @@
#include "new"
__attribute__((weak)) void *
_GLIBCXX_WEAK_DEFINITION void *
operator new[] (std::size_t sz) throw (std::bad_alloc)
{
return ::operator new(sz);

View File

@ -30,7 +30,7 @@
#include "new"
__attribute__((weak)) void *
_GLIBCXX_WEAK_DEFINITION void *
operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
{
return ::operator new(sz, nothrow);