diff options
author | Kai Köhne <kai.koehne@qt.io> | 2022-06-21 16:20:08 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-23 06:18:37 +0000 |
commit | 4c74314b6bcb742fd868fbe3a6b94a0d7bb01d3c (patch) | |
tree | c6b5ae4fdd175bef70aabc956a9744158f797f2a /src/corelib | |
parent | e2ff48441b2f9f4930a95ecaae14a5d8562f89e1 (diff) |
Use [[noreturn]] attribute
Use __has_cpp_attribute mechanism to check availability of
[[noreturn]]. For MSVC 2019 and 2022, this is always
the case, so we can also remove the (now dead)
__declpsec(noreturn) definition.
Change-Id: Ie7b39bd93bc5e1a173e245a3a5d5ff7e9067a59f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bc06e345fe6e284e4dc72f3e02662641dcb9ed71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index dc366421a3..c3b0611018 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -60,7 +60,6 @@ # define Q_FUNC_INFO __FUNCSIG__ # define Q_ASSUME_IMPL(expr) __assume(expr) # define Q_UNREACHABLE_IMPL() __assume(0) -# define Q_NORETURN __declspec(noreturn) # define Q_DECL_EXPORT __declspec(dllexport) # define Q_DECL_IMPORT __declspec(dllimport) # define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) stdext::make_unchecked_array_iterator(x) // Since _MSC_VER >= 1800 @@ -928,6 +927,11 @@ # define Q_DECL_UNUSED [[maybe_unused]] #endif +#if __has_cpp_attribute(noreturn) +# undef Q_NORETURN +# define Q_NORETURN [[noreturn]] +#endif + #if __has_cpp_attribute(deprecated) # ifdef Q_DECL_DEPRECATED # undef Q_DECL_DEPRECATED |