Tell the compiler that QArrayData::allocate allocates memory
ICC, GCC and Clang support __attribute__((malloc)) that tells them that the function returns newly allocated memory which doesn't alias anything else. Though technically we may return memory that has already been used (the shared null or such), that should not be a problem. Change-Id: Id3d5c7bf4d4c45069621ffff13f7f81f8b08ea3d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>bb10
parent
d7e7befe50
commit
329ec3a268
|
|
@ -109,7 +109,11 @@ struct Q_CORE_EXPORT QArrayData
|
|||
return result;
|
||||
}
|
||||
|
||||
Q_REQUIRED_RESULT static QArrayData *allocate(size_t objectSize, size_t alignment,
|
||||
Q_REQUIRED_RESULT
|
||||
#if defined(Q_CC_GNU)
|
||||
__attribute__((__malloc__))
|
||||
#endif
|
||||
static QArrayData *allocate(size_t objectSize, size_t alignment,
|
||||
size_t capacity, AllocationOptions options = Default) noexcept;
|
||||
Q_REQUIRED_RESULT static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize,
|
||||
size_t newCapacity, AllocationOptions newOptions = Default) noexcept;
|
||||
|
|
|
|||
Loading…
Reference in New Issue