From 043415ee86aff1dc3c87c3b076a68411b6eca457 Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Wed, 15 Sep 1999 22:00:12 +0000 Subject: [PATCH] For gcc >= 2.95, add empty throw() function to remove warnings about returning null from operator new git-svn-id: svn://10.0.0.236/trunk@47665 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/base/nsIPtr.h | 2 +- mozilla/xpcom/threads/nsAutoLock.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mozilla/xpcom/base/nsIPtr.h b/mozilla/xpcom/base/nsIPtr.h index 3c3dbb46bf8..748af6a88fc 100644 --- a/mozilla/xpcom/base/nsIPtr.h +++ b/mozilla/xpcom/base/nsIPtr.h @@ -131,7 +131,7 @@ public: \ #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) #define NS_DEF_PTR2(cls) \ private: \ - void* operator new(size_t size) {} \ + void* operator new(size_t size) throw () { return 0; } \ void operator delete(void* aPtr) {} \ cls* mPtr; #else diff --git a/mozilla/xpcom/threads/nsAutoLock.h b/mozilla/xpcom/threads/nsAutoLock.h index 86b92e6b7ff..57e26e796d6 100644 --- a/mozilla/xpcom/threads/nsAutoLock.h +++ b/mozilla/xpcom/threads/nsAutoLock.h @@ -109,7 +109,11 @@ private: // Not meant to be implemented. This makes it a compiler error to // attempt to create an nsAutoLock object on the heap. +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) + static void* operator new(size_t /*size*/) throw () { +#else static void* operator new(size_t /*size*/) { +#endif return nsnull; } static void operator delete(void* /*memory*/) {} @@ -197,7 +201,11 @@ private: // Not meant to be implemented. This makes it a compiler error to // attempt to create an nsAutoLock object on the heap. +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) + static void* operator new(size_t /*size*/) throw () { +#else static void* operator new(size_t /*size*/) { +#endif return nsnull; } static void operator delete(void* /*memory*/) {} @@ -257,7 +265,11 @@ private: // Not meant to be implemented. This makes it a compiler error to // attempt to create an nsAutoLock object on the heap. +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) + static void* operator new(size_t /*size*/) throw() { +#else static void* operator new(size_t /*size*/) { +#endif return nsnull; } static void operator delete(void* /*memory*/) {}