diff options
Diffstat (limited to 'src/corelib/global/qcompilerdetection.qdoc')
-rw-r--r-- | src/corelib/global/qcompilerdetection.qdoc | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/corelib/global/qcompilerdetection.qdoc b/src/corelib/global/qcompilerdetection.qdoc index 05a4b89f1d..191f26cc1f 100644 --- a/src/corelib/global/qcompilerdetection.qdoc +++ b/src/corelib/global/qcompilerdetection.qdoc @@ -175,12 +175,12 @@ \since 5.8 Can be used in switch statements at the end of case block to tell the compiler - and other developers that that the lack of a break statement is intentional. + and other developers that the lack of a break statement is intentional. This is useful since a missing break statement is often a bug, and some compilers can be configured to emit warnings when one is not found. - \sa Q_UNREACHABLE() + \sa Q_UNREACHABLE(), Q_UNREACHABLE_RETURN() */ /*! @@ -197,7 +197,7 @@ \snippet code/src_corelib_global_qglobal.cpp qlikely - \sa Q_UNLIKELY(), Q_ASSUME() + \sa Q_UNLIKELY() */ /*! @@ -392,3 +392,36 @@ If this macro is used outside a function, the behavior is undefined. */ + +/*! + \macro Q_NODISCARD_CTOR + \relates <QtCompilerDetection> + \since 6.6 + + \brief Expands to \c{[[nodiscard]]} on compilers that accept it on constructors. + + Otherwise it expands to nothing. + + Constructors marked as Q_NODISCARD_CTOR cause a compiler warning if a call + site doesn't use the resulting object. + + This macro is exists solely to prevent warnings on compilers that don't + implement the feature. If your supported platforms all allow \c{[[nodiscard]]} + on constructors, we strongly recommend you use the C++ attribute directly instead + of this macro. + + \sa Q_NODISCARD_CTOR_X +*/ + +/*! + \macro Q_NODISCARD_X(message) + \macro Q_NODISCARD_CTOR_X(message) + \relates <QtCompilerDetection> + \since 6.7 + + \brief Expand to \c{[[nodiscard(message)]]} on compilers that support the feature. + + Otherwise they expand to \c {[[nodiscard]]} and Q_NODISCARD_CTOR, respectively. + + \sa Q_NODISCARD_CTOR +*/ |