VirtualBox

Changeset 24729 in vbox for trunk


Ignore:
Timestamp:
Nov 17, 2009 4:49:30 PM (15 years ago)
Author:
vboxsync
Message:

iprt/assert.h: AssertStmt.

File:
1 edited

Legend:

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

    r21792 r24729  
    379379
    380380
     381/** @def AssertStmt
     382 * Assert that an expression is true. If false, hit breakpoint and execute the
     383 * statement.
     384 * @param   expr    Expression which should be true.
     385 * @param   stmt    Statement to execute on failure.
     386 */
     387#ifdef RT_STRICT
     388# define AssertStmt(expr, stmt)  \
     389    do { \
     390        if (RT_UNLIKELY(!(expr))) \
     391        { \
     392            AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
     393            RTAssertPanic(); \
     394            stmt; \
     395        } \
     396    } while (0)
     397#else
     398# define AssertStmt(expr, stmt)  \
     399    do { \
     400        if (RT_UNLIKELY(!(expr))) \
     401        { \
     402            stmt; \
     403        } \
     404    } while (0)
     405#endif
     406
     407
    381408/** @def AssertReturn
    382409 * Assert that an expression is true and returns if it isn't.
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