VirtualBox

Changeset 47386 in vbox


Ignore:
Timestamp:
Jul 25, 2013 11:24:33 AM (11 years ago)
Author:
vboxsync
Message:

Main/include/VirtualBoxBase.h: extend the list of ComAssert* macros to cover more cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r45814 r47386  
    44
    55/*
    6  * Copyright (C) 2006-2012 Oracle Corporation
     6 * Copyright (C) 2006-2013 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    213213
    214214/**
     215 *  Special version of the AssertMsgFailed macro to be used within VirtualBoxBase
     216 *  subclasses.
     217 *
     218 *  See ComAssert for more info.
     219 *
     220 *  @param   a       printf argument list (in parenthesis).
     221 */
     222#if defined(DEBUG)
     223#define ComAssertMsgFailed(a)   AssertMsgFailed(a)
     224#else
     225#define ComAssertMsgFailed(a) \
     226    do { \
     227        setError(E_FAIL, \
     228                 "Assertion failed: at '%s' (%d) in %s.\n%s.\nPlease contact the product vendor!", \
     229                 __FILE__, __LINE__, __PRETTY_FUNCTION__, Utf8StrFmt a .c_str()); \
     230    } while (0)
     231#endif
     232
     233/**
    215234 *  Special version of the AssertRC macro to be used within VirtualBoxBase
    216235 *  subclasses.
     
    271290#define ComAssertComRCRetRC(rc)             \
    272291    do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (rc); } while (0)
    273 /** Special version of ComAssert that returns ret */
    274 #define ComAssertFailedRet(ret)                \
     292/** Special version of ComAssertFailed that returns ret */
     293#define ComAssertFailedRet(ret)             \
    275294    do { ComAssertFailed(); return (ret); } while (0)
     295/** Special version of ComAssertMsgFailed that returns ret */
     296#define ComAssertMsgFailedRet(msg, ret)     \
     297    do { ComAssertMsgFailed(msg); return (ret); } while (0)
     298
     299
     300/** Special version of ComAssert that returns void if expr fails */
     301#define ComAssertRetVoid(expr)                  \
     302    do { ComAssert(expr); if (!(expr)) return; } while (0)
     303/** Special version of ComAssertMsg that returns void if expr fails */
     304#define ComAssertMsgRetVoid(expr, a)            \
     305    do { ComAssertMsg(expr, a); if (!(expr)) return; } while (0)
     306/** Special version of ComAssertRC that returns void if vrc does not succeed */
     307#define ComAssertRCRetVoid(vrc)                 \
     308    do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) return; } while (0)
     309/** Special version of ComAssertComRC that returns void if rc does not succeed */
     310#define ComAssertComRCRetVoid(rc)               \
     311    do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return; } while (0)
     312/** Special version of ComAssertFailed that returns void */
     313#define ComAssertFailedRetVoid()                \
     314    do { ComAssertFailed(); return; } while (0)
     315/** Special version of ComAssertMsgFailed that returns void */
     316#define ComAssertMsgFailedRetVoid(msg)          \
     317    do { ComAssertMsgFailed(msg); return; } while (0)
    276318
    277319
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