For gcc >= 2.95, add empty throw() function to remove warnings about returning null from operator new

This commit is contained in:
cls%seawood.org 1999-09-15 22:00:12 +00:00
parent c00a954c6f
commit 1699d31f60
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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*/) {}