(_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
+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):
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
# 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.
extern "C" void free(void *);
#endif
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr) throw ()
{
if (ptr)
extern "C" void free (void *);
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr, const std::nothrow_t&) throw ()
{
if (ptr)
#include "new"
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr) throw ()
{
::operator delete (ptr);
#include "new"
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr, const std::nothrow_t&) throw ()
{
::operator delete (ptr);
extern new_handler __new_handler;
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new (std::size_t sz) throw (std::bad_alloc)
{
void *p;
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;
#include "new"
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new[] (std::size_t sz) throw (std::bad_alloc)
{
return ::operator new(sz);
#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);