VirtualBox

Changeset 103638 in vbox


Ignore:
Timestamp:
Mar 1, 2024 6:17:37 PM (9 months ago)
Author:
vboxsync
Message:

include/iprt/assert.h: Add AssertReleaseStmt() and AssertReleaseFailedStmt(), bugref:10373

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/assert.h

    r103446 r103638  
    16541654#endif
    16551655
     1656/** @def AssertReleaseStmt
     1657 * Assert that an expression is true. If false, hit breakpoint and execute the
     1658 * statement.
     1659 * @param   expr    Expression which should be true.
     1660 * @param   stmt    Statement to execute on failure.
     1661 */
     1662#if defined(RT_STRICT) || !defined(RTASSERT_NO_RELEASE_ASSERTIONS)
     1663# define AssertReleaseStmt(expr, stmt)  \
     1664    do { \
     1665        if (RT_LIKELY(!!(expr))) \
     1666        { /* likely */ } \
     1667        else \
     1668        { \
     1669            RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
     1670            RTAssertReleasePanic(); \
     1671            stmt; \
     1672        } \
     1673    } while (0)
     1674#else
     1675# define AssertReleaseStmt(expr, stmt)  \
     1676    do { \
     1677        if (RT_LIKELY(!!(expr))) \
     1678        { /* likely */ } \
     1679        else \
     1680        { \
     1681            stmt; \
     1682        } \
     1683    } while (0)
     1684#endif
    16561685
    16571686/** @def AssertReleaseReturn
     
    19221951#endif
    19231952
     1953/** @def AssertReleaseFailedStmt
     1954 * An assertion failed, hit breakpoint and execute statement.
     1955 */
     1956#if defined(RT_STRICT) || !defined(RTASSERT_NO_RELEASE_ASSERTIONS)
     1957# define AssertReleaseFailedStmt(stmt) \
     1958    do { \
     1959        RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
     1960        RTAssertReleasePanic(); \
     1961        stmt; \
     1962    } while (0)
     1963#else
     1964# define AssertReleaseFailedStmt(stmt)     do { stmt; } while (0)
     1965#endif
     1966
    19241967/** @def AssertReleaseFailedReturn
    19251968 * An assertion failed, hit a breakpoint and return.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette