(svn r18045) -Fix: GCC 4.5@HEAD not compiling OpenTTD anymore because of a "non-placement deallocation function [is] selected for placement delete", or in other words delete(void *, size_t) is 'magic'.
We implemented these delete(void *, size_t) operator functions because MSVC warned that "no matching operator delete found; memory will not be freed if initialization throws an exception" for new(size_t, size_t). This disables MSVC warning about this because we do not use exceptions in the (constructors that use the) overridden allocation functions, as such they will never be called; delete(void *) remains necessary though.
This commit is contained in:
@@ -345,11 +345,26 @@ public:
|
||||
Window();
|
||||
|
||||
virtual ~Window();
|
||||
/* Don't allow arrays; arrays of Windows are pointless as you need
|
||||
* to destruct them all at the same time too, which is kinda hard. */
|
||||
FORCEINLINE void *operator new[](size_t size) { NOT_REACHED(); }
|
||||
/* Don't free the window directly; it corrupts the linked list when iterating */
|
||||
FORCEINLINE void operator delete(void *ptr) {}
|
||||
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
* Don't allow arrays; arrays of Windows are pointless as you need
|
||||
* to destruct them all at the same time too, which is kinda hard.
|
||||
* @param size the amount of space not to allocate
|
||||
*/
|
||||
FORCEINLINE void *operator new[](size_t size)
|
||||
{
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
* Don't free the window directly; it corrupts the linked list when iterating
|
||||
* @param ptr the pointer not to free
|
||||
*/
|
||||
FORCEINLINE void operator delete(void *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
uint16 flags4; ///< Window flags, @see WindowFlags
|
||||
WindowClass window_class; ///< Window class
|
||||
|
Reference in New Issue
Block a user