Add Q_DECL_NOTHROW to QRefCount.
For the same reason as the previous commit (about the atomic classes), mark these functions as never throwing an exception. Change-Id: Idf46e41b226f54cb8658416efdf985ca40dd2952 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
6bf4e448fe
commit
44e638f069
@ -55,7 +55,7 @@ namespace QtPrivate
|
||||
class RefCount
|
||||
{
|
||||
public:
|
||||
inline bool ref() {
|
||||
inline bool ref() Q_DECL_NOTHROW {
|
||||
int count = atomic.load();
|
||||
if (count == 0) // !isSharable
|
||||
return false;
|
||||
@ -64,7 +64,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool deref() {
|
||||
inline bool deref() Q_DECL_NOTHROW {
|
||||
int count = atomic.load();
|
||||
if (count == 0) // !isSharable
|
||||
return false;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
return atomic.deref();
|
||||
}
|
||||
|
||||
bool setSharable(bool sharable)
|
||||
bool setSharable(bool sharable) Q_DECL_NOTHROW
|
||||
{
|
||||
Q_ASSERT(!isShared());
|
||||
if (sharable)
|
||||
@ -82,26 +82,26 @@ public:
|
||||
return atomic.testAndSetRelaxed(1, 0);
|
||||
}
|
||||
|
||||
bool isStatic() const
|
||||
bool isStatic() const Q_DECL_NOTHROW
|
||||
{
|
||||
// Persistent object, never deleted
|
||||
return atomic.load() == -1;
|
||||
}
|
||||
|
||||
bool isSharable() const
|
||||
bool isSharable() const Q_DECL_NOTHROW
|
||||
{
|
||||
// Sharable === Shared ownership.
|
||||
return atomic.load() != 0;
|
||||
}
|
||||
|
||||
bool isShared() const
|
||||
bool isShared() const Q_DECL_NOTHROW
|
||||
{
|
||||
int count = atomic.load();
|
||||
return (count != 1) && (count != 0);
|
||||
}
|
||||
|
||||
void initializeOwned() { atomic.store(1); }
|
||||
void initializeUnsharable() { atomic.store(0); }
|
||||
void initializeOwned() Q_DECL_NOTHROW { atomic.store(1); }
|
||||
void initializeUnsharable() Q_DECL_NOTHROW { atomic.store(0); }
|
||||
|
||||
QBasicAtomicInt atomic;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user