VirtualBox

Changeset 103372 in vbox


Ignore:
Timestamp:
Feb 14, 2024 10:06:58 PM (12 months ago)
Author:
vboxsync
Message:

iprt/assert.h: Added AssertContinueStmt.

File:
1 edited

Legend:

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

    r98103 r103372  
    531531#endif
    532532
     533/** @def AssertBreakStmt
     534 * Assert that an expression is true and breaks if it isn't.
     535 * In RT_STRICT mode it will hit a breakpoint before doing break.
     536 *
     537 * @param   expr    Expression which should be true.
     538 * @param   stmt    Statement to execute before break in case of a failed assertion.
     539 */
     540#ifdef RT_STRICT
     541# define AssertBreakStmt(expr, stmt) \
     542    if (RT_LIKELY(!!(expr))) \
     543    { /* likely */ } \
     544    else if (1) \
     545    { \
     546        RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
     547        RTAssertPanic(); \
     548        stmt; \
     549        break; \
     550    } else do {} while (0)
     551#else
     552# define AssertBreakStmt(expr, stmt) \
     553    if (RT_LIKELY(!!(expr))) \
     554    { /* likely */ } \
     555    else if (1) \
     556    { \
     557        stmt; \
     558        break; \
     559    } else do {} while (0)
     560#endif
     561
    533562/** @def AssertContinue
    534563 * Assert that an expression is true and continue if it isn't.
     
    555584#endif
    556585
    557 /** @def AssertBreakStmt
    558  * Assert that an expression is true and breaks if it isn't.
    559  * In RT_STRICT mode it will hit a breakpoint before doing break.
    560  *
    561  * @param   expr    Expression which should be true.
    562  * @param   stmt    Statement to execute before break in case of a failed assertion.
    563  */
    564 #ifdef RT_STRICT
    565 # define AssertBreakStmt(expr, stmt) \
     586/** @def AssertContinueStmt
     587 * Assert that an expression is true and continue if it isn't.
     588 * In RT_STRICT mode it will hit a breakpoint before continuing.
     589 *
     590 * @param   expr    Expression which should be true.
     591 * @param   stmt    Statement to execute before contine in case of a failed assertion.
     592 */
     593#ifdef RT_STRICT
     594# define AssertContinueStmt(expr, stmt) \
    566595    if (RT_LIKELY(!!(expr))) \
    567596    { /* likely */ } \
     
    571600        RTAssertPanic(); \
    572601        stmt; \
    573         break; \
     602        continue; \
    574603    } else do {} while (0)
    575604#else
    576 # define AssertBreakStmt(expr, stmt) \
     605# define AssertContinueStmt(expr, stmt) \
    577606    if (RT_LIKELY(!!(expr))) \
    578607    { /* likely */ } \
    579     else if (1) \
     608    else \
    580609    { \
    581610        stmt; \
    582         break; \
     611        continue;
    583612    } else do {} while (0)
    584613#endif
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