diff options
Diffstat (limited to 'src/corelib/global/qassert.h')
-rw-r--r-- | src/corelib/global/qassert.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/global/qassert.h b/src/corelib/global/qassert.h index a3cd60b06a..388932a8f7 100644 --- a/src/corelib/global/qassert.h +++ b/src/corelib/global/qassert.h @@ -18,7 +18,7 @@ QT_BEGIN_NAMESPACE #if defined(__cplusplus) -#ifndef Q_CC_MSVC +#if !defined(Q_CC_MSVC_ONLY) Q_NORETURN #endif Q_DECL_COLD_FUNCTION @@ -32,7 +32,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) # endif #endif -#ifndef Q_CC_MSVC +#if !defined(Q_CC_MSVC_ONLY) Q_NORETURN #endif Q_DECL_COLD_FUNCTION @@ -79,11 +79,14 @@ inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } # endif #endif +Q_DECL_DEPRECATED_X("Q_ASSUME() is deprecated because it can produce worse code than when it's absent; " + "use C++23 [[assume]] instead") +inline bool qt_assume_is_deprecated(bool cond) noexcept { return cond; } #define Q_ASSUME(Expr) \ [] (bool valueOfExpression) {\ Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ Q_ASSUME_IMPL(valueOfExpression);\ - }(Expr) + }(qt_assume_is_deprecated(Expr)) // Don't use these in C++ mode, use static_assert directly. // These are here only to keep old code compiling. |