Add missing noexcept specifiers for QUniqueHandle handle traits
Handle traits should be simple, and not require exceptions. Note that we should not make calls to fclose() or close() noexcept, because these are POSIX cancellation points. Pick-to: 6.8 6.9 Change-Id: I8bbf573b1346eafd52c6080dbb024f8b3bc89359 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
652250295c
commit
a80d1bf271
@ -19,12 +19,12 @@ namespace QtUniqueHandleTraits {
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
bool InvalidHandleTraits::close(Type handle)
|
||||
bool InvalidHandleTraits::close(Type handle) noexcept
|
||||
{
|
||||
return ::CloseHandle(handle);
|
||||
}
|
||||
|
||||
bool NullHandleTraits::close(Type handle)
|
||||
bool NullHandleTraits::close(Type handle) noexcept
|
||||
{
|
||||
return ::CloseHandle(handle);
|
||||
}
|
||||
@ -33,11 +33,13 @@ bool NullHandleTraits::close(Type handle)
|
||||
|
||||
bool FileDescriptorHandleTraits::close(Type handle)
|
||||
{
|
||||
// not noexcept because close() is a POSIX cancellation point
|
||||
return QT_CLOSE(handle) == 0;
|
||||
}
|
||||
|
||||
bool FILEHandleTraits::close(Type handle)
|
||||
{
|
||||
// not noexcept because fclose() is a POSIX cancellation point
|
||||
return ::fclose(handle);
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ struct InvalidHandleTraits
|
||||
{
|
||||
return Qt::HANDLE(-1); // AKA INVALID_HANDLE_VALUE
|
||||
}
|
||||
Q_CORE_EXPORT static bool close(Type handle);
|
||||
Q_CORE_EXPORT static bool close(Type handle) noexcept;
|
||||
};
|
||||
|
||||
struct NullHandleTraits
|
||||
{
|
||||
using Type = Qt::HANDLE;
|
||||
static Type invalidValue() noexcept { return nullptr; }
|
||||
Q_CORE_EXPORT static bool close(Type handle);
|
||||
Q_CORE_EXPORT static bool close(Type handle) noexcept;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user