Changeset 58096 in vbox for trunk/include/VBox/com
- Timestamp:
- Oct 7, 2015 2:05:32 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 103170
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/assert.h
r56291 r58096 33 33 * In non-strict builds the result code will be NOREF'ed to kill compiler warnings. 34 34 * 35 * @param rcCOM result code35 * @param hrc The COM result code 36 36 */ 37 #define AssertComRC(rc) \ 38 do { AssertMsg (SUCCEEDED (rc), ("COM RC = %Rhrc (0x%08X)\n", rc, rc)); NOREF (rc); } while (0) 37 #define AssertComRC(hrc) \ 38 do { AssertMsg(SUCCEEDED(hrc), ("COM RC = %Rhrc (0x%08X)\n", hrc, hrc)); NOREF(hrc); } while (0) 39 40 /** 41 * Same as AssertComRC, except the caller already knows we failed. 42 * 43 * @param hrc The COM result code 44 */ 45 #define AssertComRCFailed(hrc) \ 46 do { AssertMsgFailed(("COM RC = %Rhrc (0x%08X)\n", hrc, hrc)); NOREF(hrc); } while (0) 39 47 40 48 /** … … 42 50 * if the result code is failed. 43 51 * 44 * @param rcCOM result code45 * @param ret the expression to return52 * @param hrc The COM result code 53 * @param RetExpr The expression to return 46 54 */ 47 #define AssertComRCReturn( rc, ret)\48 AssertMsgReturn (SUCCEEDED (rc), ("COM RC = %Rhrc (0x%08X)\n", rc, rc), ret)55 #define AssertComRCReturn(hrc, RetExpr) \ 56 AssertMsgReturn(SUCCEEDED(hrc), ("COM RC = %Rhrc (0x%08X)\n", hrc, hrc), RetExpr) 49 57 50 58 /** … … 52 60 * if it is failed. 53 61 * 54 * @param rc COM result code 55 * @param ret the expression to return 62 * @param hrc The COM result code 56 63 */ 57 #define AssertComRCReturnRC( rc)\58 AssertMsgReturn (SUCCEEDED (rc), ("COM RC = %Rhrc (0x%08X)\n", rc, rc),rc)64 #define AssertComRCReturnRC(hrc) \ 65 AssertMsgReturn(SUCCEEDED(hrc), ("COM RC = %Rhrc (0x%08X)\n", hrc, hrc), hrc) 59 66 60 67 /** 61 68 * A special version of AssertComRC that returns if the result code is failed. 62 69 * 63 * @param rc COM result code 64 * @param ret the expression to return 70 * @param hrc The COM result code 65 71 */ 66 #define AssertComRCReturnVoid( rc)\67 AssertMsgReturnVoid (SUCCEEDED (rc), ("COM RC = %Rhrc (0x%08X)\n", rc,rc))72 #define AssertComRCReturnVoid(hrc) \ 73 AssertMsgReturnVoid(SUCCEEDED(hrc), ("COM RC = %Rhrc (0x%08X)\n", hrc, hrc)) 68 74 69 75 /** … … 71 77 * breaks if the result code is failed. 72 78 * 73 * @param rcCOM result code74 * @param eval the expression to evaluate79 * @param hrc The COM result code 80 * @param PreBreakExpr The expression to evaluate on failure. 75 81 */ 76 #define AssertComRCBreak( rc, eval)\77 if (!SUCCEEDED (rc)) { AssertComRC (rc); eval; break; } else do {} while (0)82 #define AssertComRCBreak(hrc, PreBreakExpr) \ 83 if (!SUCCEEDED(hrc)) { AssertMsgFailed(hrc); PreBreakExpr; break; } else do {} while (0) 78 84 79 85 /** … … 81 87 * throws it if the result code is failed. 82 88 * 83 * @param rcCOM result code84 * @param eval the expression to throw89 * @param hrc The COM result code 90 * @param ThrowMeExpr The expression which result to be thrown on failure. 85 91 */ 86 #define AssertComRCThrow( rc, eval)\87 if (!SUCCEEDED (rc)) { AssertComRC (rc); throw (eval); } else do {} while (0)92 #define AssertComRCThrow(hrc, ThrowObjExpr) \ 93 do { if (SUCCEEDED(hrc)) { /*likely*/} else { AssertMsgFailed(hrc); throw (ThrowMeExpr); } } while (0) 88 94 89 95 /** … … 91 97 * failed. 92 98 * 93 * @param rcCOM result code99 * @param hrc The COM result code 94 100 */ 95 #define AssertComRCBreakRC( rc)\96 if (!SUCCEEDED (rc)) { AssertComRC (rc); break; } else do {} while (0)101 #define AssertComRCBreakRC(hrc) \ 102 if (!SUCCEEDED(hrc)) { AssertMsgFailed(hrc); break; } else do {} while (0) 97 103 98 104 /** 99 * A special version of AssertComRC that just throws @a rc if the result code is100 * failed.105 * A special version of AssertComRC that just throws @a hrc if the result code 106 * is failed. 101 107 * 102 * @param rcCOM result code108 * @param hrc The COM result code 103 109 */ 104 #define AssertComRCThrowRC( rc)\105 if (!SUCCEEDED (rc)) { AssertComRC (rc); throw rc; } else do {} while (0)110 #define AssertComRCThrowRC(hrc) \ 111 do { if (SUCCEEDED(hrc)) { /*likely*/ } else { AssertMsgFailed(hrc); throw hrc; } } while (0) 106 112 107 113 #endif // !___VBox_com_assert_h
Note:
See TracChangeset
for help on using the changeset viewer.