~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to include/VBox/com/errorprint.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    } while (0)
57
57
 
58
58
/**
 
59
 * Same as CHECK_ERROR except that it also executes the statement |stmt| on
 
60
 * failure.
 
61
 */
 
62
#define CHECK_ERROR_STMT(iface, method, stmt) \
 
63
    do { \
 
64
        rc = iface->method; \
 
65
        if (FAILED(rc)) \
 
66
        { \
 
67
            com::GlueHandleComError(iface, #method, rc, __FILE__, __LINE__); \
 
68
            stmt; \
 
69
        } \
 
70
    } while (0)
 
71
 
 
72
/**
 
73
 * Same as CHECK_ERROR_STMT except that it uses an internal variable |hrcCheck|
 
74
 * for holding the result.
 
75
 */
 
76
#define CHECK_ERROR2_STMT(iface, method, stmt) \
 
77
    do { \
 
78
        HRESULT hrcCheck = iface->method; \
 
79
        if (FAILED(hrcCheck)) \
 
80
        { \
 
81
            com::GlueHandleComError(iface, #method, hrcCheck, __FILE__, __LINE__); \
 
82
            stmt; \
 
83
        } \
 
84
    } while (0)
 
85
 
 
86
 
 
87
/**
59
88
 *  Does the same as CHECK_ERROR(), but executes the |break| statement on
60
89
 *  failure.
61
90
 */
99
128
    } while (0)
100
129
 
101
130
/**
 
131
 * Does the same as CHECK_ERROR(), but returns @a ret on failure.
 
132
 *
 
133
 * Unlike CHECK_ERROR and CHECK_ERROR_RET, this macro does not presuppose a
 
134
 * |rc| variable but instead employs a local variable |hrcCheck| in its own
 
135
 * scope.  This |hrcCheck| variable can be referenced by the @a rcRet
 
136
 * parameter.
 
137
 *
 
138
 * @param   iface       The interface pointer (can be a smart pointer object).
 
139
 * @param   method      The method to invoke together with the parameters.
 
140
 * @param   rcRet       What to return on failure.  Use |hrcCheck| to return
 
141
 *                      the status code of the method call.
 
142
 */
 
143
#define CHECK_ERROR2_RET(iface, method, rcRet) \
 
144
    do { \
 
145
        HRESULT hrcCheck = iface->method; \
 
146
        if (FAILED(hrcCheck)) \
 
147
        { \
 
148
            com::GlueHandleComError(iface, #method, hrcCheck, __FILE__, __LINE__); \
 
149
            return (rcRet); \
 
150
        } \
 
151
    } while (0)
 
152
 
 
153
/**
102
154
 *  Asserts the given expression is true. When the expression is false, prints
103
155
 *  a line containing the failed function/line/file; otherwise does nothing.
104
156
 */