fix compile error due to GCC restriction.
thanks to daniel.santos for reporting and alex for creating the ticket/notifying me. fixes #992 [heh, the amount of comments are proportional to the trouble caused by this code :S ran into VC++ compile errors when __declspec came after void* return type *sigh*] This was SVN commit r10385.
This commit is contained in:
parent
8ac994e4e6
commit
0fa54bc56a
@ -81,24 +81,24 @@ public:
|
||||
return &value;
|
||||
}
|
||||
|
||||
AlignedAllocator() NOTHROW
|
||||
NOTHROW_DEFINE AlignedAllocator()
|
||||
{
|
||||
}
|
||||
|
||||
AlignedAllocator(const AlignedAllocator&) NOTHROW
|
||||
NOTHROW_DEFINE AlignedAllocator(const AlignedAllocator&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class U>
|
||||
AlignedAllocator (const AlignedAllocator<U>&) NOTHROW
|
||||
NOTHROW_DEFINE AlignedAllocator (const AlignedAllocator<U>&)
|
||||
{
|
||||
}
|
||||
|
||||
~AlignedAllocator() NOTHROW
|
||||
NOTHROW_DEFINE ~AlignedAllocator()
|
||||
{
|
||||
}
|
||||
|
||||
size_type max_size() const NOTHROW
|
||||
NOTHROW_DEFINE size_type max_size() const
|
||||
{
|
||||
// maximum number of *elements* that can be allocated
|
||||
return std::numeric_limits<std::size_t>::max() / sizeof(T);
|
||||
@ -133,13 +133,13 @@ public:
|
||||
|
||||
// indicate that all specializations of this allocator are interchangeable
|
||||
template <class T1, class T2>
|
||||
bool operator==(const AlignedAllocator<T1>&, const AlignedAllocator<T2>&) NOTHROW
|
||||
NOTHROW_DEFINE bool operator==(const AlignedAllocator<T1>&, const AlignedAllocator<T2>&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
bool operator!=(const AlignedAllocator<T1>&, const AlignedAllocator<T2>&) NOTHROW
|
||||
NOTHROW_DEFINE bool operator!=(const AlignedAllocator<T1>&, const AlignedAllocator<T2>&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ public:
|
||||
Validate();
|
||||
}
|
||||
|
||||
void* Allocate(size_t size) NOTHROW
|
||||
NOTHROW_DEFINE void* Allocate(size_t size)
|
||||
{
|
||||
ENSURE(IsValidSize(size));
|
||||
Validate();
|
||||
@ -754,7 +754,7 @@ void HeaderlessAllocator::Reset()
|
||||
return impl->Reset();
|
||||
}
|
||||
|
||||
void* HeaderlessAllocator::Allocate(size_t size) NOTHROW
|
||||
NOTHROW_DEFINE void* HeaderlessAllocator::Allocate(size_t size)
|
||||
{
|
||||
return impl->Allocate(size);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
* (this allocator is designed for requests on the order of several KiB)
|
||||
* @return allocated memory or 0 if the pool is too fragmented or full.
|
||||
**/
|
||||
void* Allocate(size_t size) NOTHROW;
|
||||
NOTHROW_DECLARE void* Allocate(size_t size);
|
||||
|
||||
/**
|
||||
* deallocate memory.
|
||||
|
@ -50,7 +50,7 @@ void RegisterUniqueRangeDeleter(UniqueRangeDeleter deleter, volatile IdxDeleter*
|
||||
}
|
||||
|
||||
|
||||
void CallUniqueRangeDeleter(void* pointer, size_t size, IdxDeleter idxDeleter) NOTHROW
|
||||
NOTHROW_DEFINE void CallUniqueRangeDeleter(void* pointer, size_t size, IdxDeleter idxDeleter)
|
||||
{
|
||||
ASSERT(idxDeleter < numDeleters);
|
||||
// (some deleters do not tolerate null pointers)
|
||||
|
@ -43,7 +43,7 @@ typedef void (*UniqueRangeDeleter)(void* pointer, size_t size);
|
||||
**/
|
||||
LIB_API void RegisterUniqueRangeDeleter(UniqueRangeDeleter deleter, volatile IdxDeleter* idxDeleter);
|
||||
|
||||
LIB_API void CallUniqueRangeDeleter(void* pointer, size_t size, IdxDeleter idxDeleter) NOTHROW;
|
||||
LIB_API NOTHROW_DECLARE void CallUniqueRangeDeleter(void* pointer, size_t size, IdxDeleter idxDeleter);
|
||||
|
||||
|
||||
// unfortunately, unique_ptr allows constructing without a custom deleter. to ensure callers can
|
||||
|
@ -58,16 +58,32 @@
|
||||
|
||||
|
||||
/**
|
||||
* void function() NOTHROW - indicate the function will not
|
||||
* throw any synchronous exceptions, thus hopefully generating
|
||||
* smaller and more efficient code.
|
||||
* indicate a function will not throw any synchronous exceptions,
|
||||
* thus hopefully generating smaller and more efficient code.
|
||||
*
|
||||
* must be placed BEFORE return types because "The [VC++] compiler
|
||||
* ignores, without warning, any __declspec keywords placed after *".
|
||||
* such syntax is apparently also legal in GCC, per the example
|
||||
* "__attribute__((noreturn)) void d0 (void)".
|
||||
*
|
||||
* example:
|
||||
* NOTHROW_DECLARE void function();
|
||||
* NOTHROW_DEFINE void function() {}
|
||||
**/
|
||||
#if GCC_VERSION >= 303
|
||||
# define NOTHROW __attribute__((nothrow))
|
||||
# define NOTHROW_DECLARE __attribute__((nothrow))
|
||||
# define NOTHROW_DEFINE // not supported for definitions
|
||||
#elif MSC_VERSION
|
||||
# define NOTHROW throw() // special meaning, equivalent to __declspec(nothrow)
|
||||
// Kevin Frei, 2006-03-23: "I work on the Visual C++ compiler team,
|
||||
// and agree completely with Paul Parks: don't use throw(), because
|
||||
// there's a chance that we'll eventually implement it according to the standard".
|
||||
# define NOTHROW_DECLARE __declspec(nothrow)
|
||||
# define NOTHROW_DEFINE __declspec(nothrow)
|
||||
#else
|
||||
# define NOTHROW // throw() might result in ADDITIONAL checks
|
||||
// don't use throw() because it might result in ADDITIONAL checks
|
||||
// (the standard mandates calling unexpected())
|
||||
# define NOTHROW_DECLARE
|
||||
# define NOTHROW_DEFINE
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user