mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 01:23:03 +01:00
Apply Alex/Bill/Jerry/me patch re. portability in redefinition of operator new
This commit is contained in:
parent
67fed74a0f
commit
cb40c9f8ba
@ -49,13 +49,14 @@
|
||||
stdlib.h (EKU) */
|
||||
#endif
|
||||
|
||||
#include <new>
|
||||
|
||||
#if defined (_MSC_VER) || defined (__SUNPRO_CC) || defined(__xlC__)
|
||||
#define THROW_BAD_ALLOC
|
||||
#else
|
||||
#define THROW_BAD_ALLOC throw (Firebird::BadAlloc)
|
||||
#endif
|
||||
// MSVC does not support exception specification, so it's unknown if that will be correct or not
|
||||
// from its POV. For now, use it and disable the C4290 warning.
|
||||
//
|
||||
//#if defined (_MSC_VER)
|
||||
//#define THROW_BAD_ALLOC
|
||||
//#else
|
||||
#define THROW_BAD_ALLOC throw (std::bad_alloc)
|
||||
//#endif
|
||||
|
||||
#ifdef USE_VALGRIND
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
#include "fb_types.h"
|
||||
#include "../common/StatusArg.h"
|
||||
|
||||
@ -112,13 +113,13 @@ public:
|
||||
};
|
||||
|
||||
// Used in MemoryPool
|
||||
class BadAlloc : public Exception
|
||||
class BadAlloc : public std::bad_alloc, public Exception
|
||||
{
|
||||
public:
|
||||
virtual ISC_STATUS stuff_exception(ISC_STATUS* const status_vector, StringsBuffer* sb = NULL) const throw();
|
||||
virtual const char* what() const throw() { return "Firebird::BadAlloc"; }
|
||||
static void raise();
|
||||
BadAlloc() throw() : Exception() { }
|
||||
BadAlloc() throw() : std::bad_alloc(), Exception() { }
|
||||
};
|
||||
|
||||
// Main exception class in firebird
|
||||
|
@ -41,6 +41,7 @@
|
||||
#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int
|
||||
#pragma warning(disable:4244) // conversion from '.......' to '......', possible loss of data
|
||||
#pragma warning(disable:4245) // conversion from '.......' to '......', signed/unsigned mismatch
|
||||
#pragma warning(disable:4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#pragma warning(disable:4291) // no matching operator delete found; memory will not be freed if initialization throws an exception
|
||||
#pragma warning(disable:4309) // truncation of constant value
|
||||
#pragma warning(disable:4310) // cast truncates constant value
|
||||
|
Loading…
Reference in New Issue
Block a user