1 | /** @file
|
---|
2 | * IPRT - Assertions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | *
|
---|
25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___iprt_assert_h
|
---|
31 | #define ___iprt_assert_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | /** @defgroup grp_rt_assert Assert - Assertions
|
---|
37 | * @ingroup grp_rt
|
---|
38 | *
|
---|
39 | * Assertions are generally used to check precoditions and other
|
---|
40 | * assumptions. Sometimes it is also used to catch odd errors or errors
|
---|
41 | * that one would like to inspect in the debugger. They should not be
|
---|
42 | * used for errors that happen frequently.
|
---|
43 | *
|
---|
44 | * IPRT provides a host of assertion macros, so many that it can be a bit
|
---|
45 | * overwhelming at first. Don't despair, there is a system (surprise).
|
---|
46 | *
|
---|
47 | * First there are four families of assertions:
|
---|
48 | * - Assert - The normal strict build only assertions.
|
---|
49 | * - AssertLogRel - Calls LogRel() in non-strict builds, otherwise like Assert.
|
---|
50 | * - AssertRelease - Triggers in all builds.
|
---|
51 | * - AssertFatal - Triggers in all builds and cannot be continued.
|
---|
52 | *
|
---|
53 | * Then there are variations wrt to argument list and behavior on failure:
|
---|
54 | * - Msg - Custom RTStrPrintf-like message with the assertion message.
|
---|
55 | * - Return - Return the specific rc on failure.
|
---|
56 | * - ReturnVoid - Return (void) on failure.
|
---|
57 | * - Break - Break (out of switch/loop) on failure.
|
---|
58 | * - Stmt - Execute the specified statment(s) on failure.
|
---|
59 | * - RC - Assert RT_SUCCESS.
|
---|
60 | * - RCSuccess - Assert VINF_SUCCESS.
|
---|
61 | *
|
---|
62 | * In additions there is a very special familiy AssertCompile that can be
|
---|
63 | * used for some limited compile checking. Like structure sizes and member
|
---|
64 | * alignment. This family doesn't have the same variations.
|
---|
65 | *
|
---|
66 | *
|
---|
67 | * @remarks As you might've noticed, the macros doesn't follow the
|
---|
68 | * coding guidelines wrt to macros supposedly being all uppercase
|
---|
69 | * and underscored. For various reasons they don't, and it nobody
|
---|
70 | * has complained yet. Wonder why... :-)
|
---|
71 | *
|
---|
72 | * @remarks Each project has its own specific guidelines on how to use
|
---|
73 | * assertions, so the above is just trying to give you the general idea
|
---|
74 | * from the IPRT point of view.
|
---|
75 | *
|
---|
76 | * @{
|
---|
77 | */
|
---|
78 |
|
---|
79 | __BEGIN_DECLS
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * The 1st part of an assert message.
|
---|
83 | *
|
---|
84 | * @param pszExpr Expression. Can be NULL.
|
---|
85 | * @param uLine Location line number.
|
---|
86 | * @param pszFile Location file name.
|
---|
87 | * @param pszFunction Location function name.
|
---|
88 | * @remark This API exists in HC Ring-3 and GC.
|
---|
89 | */
|
---|
90 | RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * The 2nd (optional) part of an assert message.
|
---|
94 | * @param pszFormat Printf like format string.
|
---|
95 | * @param ... Arguments to that string.
|
---|
96 | * @remark This API exists in HC Ring-3 and GC.
|
---|
97 | */
|
---|
98 | RTDECL(void) AssertMsg2(const char *pszFormat, ...);
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Overridable function that decides whether assertions executes the breakpoint or not.
|
---|
102 | *
|
---|
103 | * The generic implementation will return true.
|
---|
104 | *
|
---|
105 | * @returns true if the breakpoint should be hit, false if it should be ignored.
|
---|
106 | * @remark The RTDECL() makes this a bit difficult to override on windows. Sorry.
|
---|
107 | */
|
---|
108 | RTDECL(bool) RTAssertDoBreakpoint(void);
|
---|
109 |
|
---|
110 | /** The last assert message, 1st part. */
|
---|
111 | extern RTDATADECL(char) g_szRTAssertMsg1[1024];
|
---|
112 | /** The last assert message, 2nd part. */
|
---|
113 | extern RTDATADECL(char) g_szRTAssertMsg2[2048];
|
---|
114 |
|
---|
115 | __END_DECLS
|
---|
116 |
|
---|
117 |
|
---|
118 | /** @def AssertBreakpoint()
|
---|
119 | * Assertion Breakpoint.
|
---|
120 | *
|
---|
121 | * @remark In the gnu world we add a nop instruction after the int3 to
|
---|
122 | * force gdb to remain at the int3 source line.
|
---|
123 | * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
|
---|
124 | */
|
---|
125 | #ifdef RT_STRICT
|
---|
126 | # ifdef __GNUC__
|
---|
127 | # ifndef __L4ENV__
|
---|
128 | # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __asm__ __volatile__ ("int3\n\tnop"); } } while (0)
|
---|
129 | # else
|
---|
130 | # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __asm__ __volatile__ ("int3; jmp 1f; 1:"); } } while (0)
|
---|
131 | # endif
|
---|
132 | # elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
133 | # define AssertBreakpoint() do { if (RTAssertDoBreakpoint()) { __debugbreak(); } } while (0)
|
---|
134 | # else
|
---|
135 | # error "Unknown compiler"
|
---|
136 | # endif
|
---|
137 | #else
|
---|
138 | # define AssertBreakpoint() do { } while (0)
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * RTASSERTTYPE is the type the AssertCompile() macro redefines.
|
---|
143 | * It has no other function and shouldn't be used.
|
---|
144 | * Visual C++ uses this.
|
---|
145 | */
|
---|
146 | typedef int RTASSERTTYPE[1];
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * RTASSERTVAR is the type the AssertCompile() macro redefines.
|
---|
150 | * It has no other function and shouldn't be used.
|
---|
151 | * GCC uses this.
|
---|
152 | */
|
---|
153 | #ifdef __GNUC__
|
---|
154 | __BEGIN_DECLS
|
---|
155 | #endif
|
---|
156 | extern int RTASSERTVAR[1];
|
---|
157 | #ifdef __GNUC__
|
---|
158 | __END_DECLS
|
---|
159 | #endif
|
---|
160 |
|
---|
161 | /** @def AssertCompile
|
---|
162 | * Asserts that a compile-time expression is true. If it's not break the build.
|
---|
163 | * @param expr Expression which should be true.
|
---|
164 | */
|
---|
165 | #ifdef __GNUC__
|
---|
166 | # define AssertCompile(expr) extern int RTASSERTVAR[1] __attribute__((unused)), RTASSERTVAR[(expr) ? 1 : 0] __attribute__((unused))
|
---|
167 | #else
|
---|
168 | # define AssertCompile(expr) typedef int RTASSERTTYPE[(expr) ? 1 : 0]
|
---|
169 | #endif
|
---|
170 |
|
---|
171 | /** @def AssertCompileSize
|
---|
172 | * Asserts a size at compile.
|
---|
173 | * @param type The type.
|
---|
174 | * @param size The expected type size.
|
---|
175 | */
|
---|
176 | #define AssertCompileSize(type, size) \
|
---|
177 | AssertCompile(sizeof(type) == (size))
|
---|
178 |
|
---|
179 | /** @def AssertCompileSizeAlignment
|
---|
180 | * Asserts a size alignment at compile.
|
---|
181 | * @param type The type.
|
---|
182 | * @param align The size alignment to assert.
|
---|
183 | */
|
---|
184 | #define AssertCompileSizeAlignment(type, align) \
|
---|
185 | AssertCompile(!(sizeof(type) & ((align) - 1)))
|
---|
186 |
|
---|
187 | /** @def AssertCompileMemberAlignment
|
---|
188 | * Asserts a member offset alignment at compile.
|
---|
189 | * @param type The type.
|
---|
190 | * @param member The member.
|
---|
191 | * @param align The member offset alignment to assert.
|
---|
192 | */
|
---|
193 | #if defined(__GNUC__) && defined(__cplusplus)
|
---|
194 | # if __GNUC__ >= 4
|
---|
195 | # define AssertCompileMemberAlignment(type, member, align) \
|
---|
196 | AssertCompile(!(__builtin_offsetof(type, member) & ((align) - 1)))
|
---|
197 | # else
|
---|
198 | # define AssertCompileMemberAlignment(type, member, align) \
|
---|
199 | AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
|
---|
200 | # endif
|
---|
201 | #else
|
---|
202 | # define AssertCompileMemberAlignment(type, member, align) \
|
---|
203 | AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
|
---|
204 | #endif
|
---|
205 |
|
---|
206 |
|
---|
207 | /** @def AssertCompileMemberSize
|
---|
208 | * Asserts a member offset alignment at compile.
|
---|
209 | * @param type The type.
|
---|
210 | * @param member The member.
|
---|
211 | * @param size The member size to assert.
|
---|
212 | */
|
---|
213 | #define AssertCompileMemberSize(type, member, size) \
|
---|
214 | AssertCompile(RT_SIZEOFMEMB(type, member) == (size))
|
---|
215 |
|
---|
216 | /** @def AssertCompileMemberSizeAlignment
|
---|
217 | * Asserts a member size alignment at compile.
|
---|
218 | * @param type The type.
|
---|
219 | * @param member The member.
|
---|
220 | * @param align The member size alignment to assert.
|
---|
221 | */
|
---|
222 | #define AssertCompileMemberSizeAlignment(type, member, align) \
|
---|
223 | AssertCompile(!(RT_SIZEOFMEMB(type, member) & ((align) - 1)))
|
---|
224 |
|
---|
225 |
|
---|
226 | /** @def Assert
|
---|
227 | * Assert that an expression is true. If it's not hit breakpoint.
|
---|
228 | * @param expr Expression which should be true.
|
---|
229 | */
|
---|
230 | #ifdef RT_STRICT
|
---|
231 | # define Assert(expr) \
|
---|
232 | do { \
|
---|
233 | if (RT_UNLIKELY(!(expr))) \
|
---|
234 | { \
|
---|
235 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
236 | AssertBreakpoint(); \
|
---|
237 | } \
|
---|
238 | } while (0)
|
---|
239 | #else
|
---|
240 | # define Assert(expr) do { } while (0)
|
---|
241 | #endif
|
---|
242 |
|
---|
243 |
|
---|
244 | /** @def AssertReturn
|
---|
245 | * Assert that an expression is true and returns if it isn't.
|
---|
246 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
247 | *
|
---|
248 | * @param expr Expression which should be true.
|
---|
249 | * @param rc What is to be presented to return.
|
---|
250 | */
|
---|
251 | #ifdef RT_STRICT
|
---|
252 | # define AssertReturn(expr, rc) \
|
---|
253 | do { \
|
---|
254 | if (RT_UNLIKELY(!(expr))) \
|
---|
255 | { \
|
---|
256 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
257 | AssertBreakpoint(); \
|
---|
258 | return (rc); \
|
---|
259 | } \
|
---|
260 | } while (0)
|
---|
261 | #else
|
---|
262 | # define AssertReturn(expr, rc) \
|
---|
263 | do { \
|
---|
264 | if (RT_UNLIKELY(!(expr))) \
|
---|
265 | return (rc); \
|
---|
266 | } while (0)
|
---|
267 | #endif
|
---|
268 |
|
---|
269 | /** @def AssertReturnVoid
|
---|
270 | * Assert that an expression is true and returns if it isn't.
|
---|
271 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
272 | *
|
---|
273 | * @param expr Expression which should be true.
|
---|
274 | */
|
---|
275 | #ifdef RT_STRICT
|
---|
276 | # define AssertReturnVoid(expr) \
|
---|
277 | do { \
|
---|
278 | if (RT_UNLIKELY(!(expr))) \
|
---|
279 | { \
|
---|
280 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
281 | AssertBreakpoint(); \
|
---|
282 | return; \
|
---|
283 | } \
|
---|
284 | } while (0)
|
---|
285 | #else
|
---|
286 | # define AssertReturnVoid(expr) \
|
---|
287 | do { \
|
---|
288 | if (RT_UNLIKELY(!(expr))) \
|
---|
289 | return; \
|
---|
290 | } while (0)
|
---|
291 | #endif
|
---|
292 |
|
---|
293 |
|
---|
294 | /** @def AssertBreakStmt
|
---|
295 | * Assert that an expression is true and breaks if it isn't.
|
---|
296 | * In RT_STRICT mode it will hit a breakpoint before doing break.
|
---|
297 | *
|
---|
298 | * @param expr Expression which should be true.
|
---|
299 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
300 | */
|
---|
301 | #ifdef RT_STRICT
|
---|
302 | # define AssertBreakStmt(expr, stmt) \
|
---|
303 | if (RT_UNLIKELY(!(expr))) { \
|
---|
304 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
305 | AssertBreakpoint(); \
|
---|
306 | stmt; \
|
---|
307 | break; \
|
---|
308 | } else do {} while (0)
|
---|
309 | #else
|
---|
310 | # define AssertBreakStmt(expr, stmt) \
|
---|
311 | if (RT_UNLIKELY(!(expr))) { \
|
---|
312 | stmt; \
|
---|
313 | break; \
|
---|
314 | } else do {} while (0)
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | /** @def AssertBreakVoid
|
---|
318 | * Assert that an expression is true and breaks if it isn't.
|
---|
319 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
320 | *
|
---|
321 | * @param expr Expression which should be true.
|
---|
322 | * @todo Rename to AssertBreak.
|
---|
323 | * @todo broken, use if.
|
---|
324 | */
|
---|
325 | #ifdef RT_STRICT
|
---|
326 | # define AssertBreakVoid(expr) \
|
---|
327 | do { \
|
---|
328 | if (RT_UNLIKELY(!(expr))) \
|
---|
329 | { \
|
---|
330 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
331 | AssertBreakpoint(); \
|
---|
332 | break; \
|
---|
333 | } \
|
---|
334 | } while (0)
|
---|
335 | #else
|
---|
336 | # define AssertBreakVoid(expr) \
|
---|
337 | do { \
|
---|
338 | if (RT_UNLIKELY(!(expr))) \
|
---|
339 | break; \
|
---|
340 | } while (0)
|
---|
341 | #endif
|
---|
342 |
|
---|
343 |
|
---|
344 | /** @def AssertMsg
|
---|
345 | * Assert that an expression is true. If it's not print message and hit breakpoint.
|
---|
346 | * @param expr Expression which should be true.
|
---|
347 | * @param a printf argument list (in parenthesis).
|
---|
348 | */
|
---|
349 | #ifdef RT_STRICT
|
---|
350 | # define AssertMsg(expr, a) \
|
---|
351 | do { \
|
---|
352 | if (RT_UNLIKELY(!(expr))) \
|
---|
353 | { \
|
---|
354 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
355 | AssertMsg2 a; \
|
---|
356 | AssertBreakpoint(); \
|
---|
357 | } \
|
---|
358 | } while (0)
|
---|
359 | #else
|
---|
360 | # define AssertMsg(expr, a) do { } while (0)
|
---|
361 | #endif
|
---|
362 |
|
---|
363 | /** @def AssertMsgReturn
|
---|
364 | * Assert that an expression is true and returns if it isn't.
|
---|
365 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
366 | *
|
---|
367 | * @param expr Expression which should be true.
|
---|
368 | * @param a printf argument list (in parenthesis).
|
---|
369 | * @param rc What is to be presented to return.
|
---|
370 | */
|
---|
371 | #ifdef RT_STRICT
|
---|
372 | # define AssertMsgReturn(expr, a, rc) \
|
---|
373 | do { \
|
---|
374 | if (RT_UNLIKELY(!(expr))) \
|
---|
375 | { \
|
---|
376 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
377 | AssertMsg2 a; \
|
---|
378 | AssertBreakpoint(); \
|
---|
379 | return (rc); \
|
---|
380 | } \
|
---|
381 | } while (0)
|
---|
382 | #else
|
---|
383 | # define AssertMsgReturn(expr, a, rc) \
|
---|
384 | do { \
|
---|
385 | if (RT_UNLIKELY(!(expr))) \
|
---|
386 | return (rc); \
|
---|
387 | } while (0)
|
---|
388 | #endif
|
---|
389 |
|
---|
390 | /** @def AssertMsgReturnVoid
|
---|
391 | * Assert that an expression is true and returns if it isn't.
|
---|
392 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
393 | *
|
---|
394 | * @param expr Expression which should be true.
|
---|
395 | * @param a printf argument list (in parenthesis).
|
---|
396 | */
|
---|
397 | #ifdef RT_STRICT
|
---|
398 | # define AssertMsgReturnVoid(expr, a) \
|
---|
399 | do { \
|
---|
400 | if (RT_UNLIKELY(!(expr))) \
|
---|
401 | { \
|
---|
402 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
403 | AssertMsg2 a; \
|
---|
404 | AssertBreakpoint(); \
|
---|
405 | return; \
|
---|
406 | } \
|
---|
407 | } while (0)
|
---|
408 | #else
|
---|
409 | # define AssertMsgReturnVoid(expr, a) \
|
---|
410 | do { \
|
---|
411 | if (RT_UNLIKELY(!(expr))) \
|
---|
412 | return; \
|
---|
413 | } while (0)
|
---|
414 | #endif
|
---|
415 |
|
---|
416 |
|
---|
417 | /** @def AssertMsgBreakStmt
|
---|
418 | * Assert that an expression is true and breaks if it isn't.
|
---|
419 | * In RT_STRICT mode it will hit a breakpoint before doing break.
|
---|
420 | *
|
---|
421 | * @param expr Expression which should be true.
|
---|
422 | * @param a printf argument list (in parenthesis).
|
---|
423 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
424 | */
|
---|
425 | #ifdef RT_STRICT
|
---|
426 | # define AssertMsgBreakStmt(expr, a, stmt) \
|
---|
427 | if (RT_UNLIKELY(!(expr))) { \
|
---|
428 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
429 | AssertMsg2 a; \
|
---|
430 | AssertBreakpoint(); \
|
---|
431 | stmt; \
|
---|
432 | break; \
|
---|
433 | } else do {} while (0)
|
---|
434 | #else
|
---|
435 | # define AssertMsgBreakStmt(expr, a, stmt) \
|
---|
436 | if (RT_UNLIKELY(!(expr))) { \
|
---|
437 | stmt; \
|
---|
438 | break; \
|
---|
439 | } else do {} while (0)
|
---|
440 | #endif
|
---|
441 |
|
---|
442 | /** @def AssertMsgBreakVoid
|
---|
443 | * Assert that an expression is true and breaks if it isn't.
|
---|
444 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
445 | *
|
---|
446 | * @param expr Expression which should be true.
|
---|
447 | * @param a printf argument list (in parenthesis).
|
---|
448 | * @todo Rename to AssertMsgBreak.
|
---|
449 | */
|
---|
450 | #ifdef RT_STRICT
|
---|
451 | # define AssertMsgBreakVoid(expr, a) \
|
---|
452 | if (RT_UNLIKELY(!(expr))) \
|
---|
453 | { \
|
---|
454 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
455 | AssertMsg2 a; \
|
---|
456 | AssertBreakpoint(); \
|
---|
457 | break; \
|
---|
458 | } else do {} while (0)
|
---|
459 | #else
|
---|
460 | # define AssertMsgBreakVoid(expr, a) \
|
---|
461 | if (RT_UNLIKELY(!(expr))) \
|
---|
462 | break; \
|
---|
463 | else do {} while (0)
|
---|
464 | #endif
|
---|
465 |
|
---|
466 |
|
---|
467 | /** @def AssertFailed
|
---|
468 | * An assertion failed hit breakpoint.
|
---|
469 | */
|
---|
470 | #ifdef RT_STRICT
|
---|
471 | # define AssertFailed() \
|
---|
472 | do { \
|
---|
473 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
474 | AssertBreakpoint(); \
|
---|
475 | } while (0)
|
---|
476 | #else
|
---|
477 | # define AssertFailed() do { } while (0)
|
---|
478 | #endif
|
---|
479 |
|
---|
480 | /** @def AssertFailedReturn
|
---|
481 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and return.
|
---|
482 | *
|
---|
483 | * @param rc The rc to return.
|
---|
484 | */
|
---|
485 | #ifdef RT_STRICT
|
---|
486 | # define AssertFailedReturn(rc) \
|
---|
487 | do { \
|
---|
488 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
489 | AssertBreakpoint(); \
|
---|
490 | return (rc); \
|
---|
491 | } while (0)
|
---|
492 | #else
|
---|
493 | # define AssertFailedReturn(rc) \
|
---|
494 | do { \
|
---|
495 | return (rc); \
|
---|
496 | } while (0)
|
---|
497 | #endif
|
---|
498 |
|
---|
499 | /** @def AssertFailedReturnVoid
|
---|
500 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and return.
|
---|
501 | */
|
---|
502 | #ifdef RT_STRICT
|
---|
503 | # define AssertFailedReturnVoid() \
|
---|
504 | do { \
|
---|
505 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
506 | AssertBreakpoint(); \
|
---|
507 | return; \
|
---|
508 | } while (0)
|
---|
509 | #else
|
---|
510 | # define AssertFailedReturnVoid() \
|
---|
511 | do { \
|
---|
512 | return; \
|
---|
513 | } while (0)
|
---|
514 | #endif
|
---|
515 |
|
---|
516 |
|
---|
517 | /** @def AssertFailedBreakStmt
|
---|
518 | * An assertion failed, hit breakpoint (RT_STRICT mode only), execute
|
---|
519 | * the given statement and break.
|
---|
520 | *
|
---|
521 | * @param stmt Statement to execute before break.
|
---|
522 | */
|
---|
523 | #ifdef RT_STRICT
|
---|
524 | # define AssertFailedBreakStmt(stmt) \
|
---|
525 | if (1) { \
|
---|
526 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
527 | AssertBreakpoint(); \
|
---|
528 | stmt; \
|
---|
529 | break; \
|
---|
530 | } else do {} while (0)
|
---|
531 | #else
|
---|
532 | # define AssertFailedBreakStmt(stmt) \
|
---|
533 | if (1) { \
|
---|
534 | stmt; \
|
---|
535 | break; \
|
---|
536 | } else do {} while (0)
|
---|
537 | #endif
|
---|
538 |
|
---|
539 | /** @def AssertFailedBreakVoid
|
---|
540 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and break.
|
---|
541 | * @todo Rename to AssertFailedBreak.
|
---|
542 | */
|
---|
543 | #ifdef RT_STRICT
|
---|
544 | # define AssertFailedBreakVoid() \
|
---|
545 | do { \
|
---|
546 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
547 | AssertBreakpoint(); \
|
---|
548 | break; \
|
---|
549 | } while (0)
|
---|
550 | #else
|
---|
551 | # define AssertFailedBreakVoid() \
|
---|
552 | do { \
|
---|
553 | break; \
|
---|
554 | } while (0)
|
---|
555 | #endif
|
---|
556 |
|
---|
557 |
|
---|
558 | /** @def AssertMsgFailed
|
---|
559 | * An assertion failed print a message and a hit breakpoint.
|
---|
560 | *
|
---|
561 | * @param a printf argument list (in parenthesis).
|
---|
562 | */
|
---|
563 | #ifdef RT_STRICT
|
---|
564 | # define AssertMsgFailed(a) \
|
---|
565 | do { \
|
---|
566 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
567 | AssertMsg2 a; \
|
---|
568 | AssertBreakpoint(); \
|
---|
569 | } while (0)
|
---|
570 | #else
|
---|
571 | # define AssertMsgFailed(a) do { } while (0)
|
---|
572 | #endif
|
---|
573 |
|
---|
574 | /** @def AssertMsgFailedReturn
|
---|
575 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and return.
|
---|
576 | *
|
---|
577 | * @param a printf argument list (in parenthesis).
|
---|
578 | * @param rc What is to be presented to return.
|
---|
579 | */
|
---|
580 | #ifdef RT_STRICT
|
---|
581 | # define AssertMsgFailedReturn(a, rc) \
|
---|
582 | do { \
|
---|
583 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
584 | AssertMsg2 a; \
|
---|
585 | AssertBreakpoint(); \
|
---|
586 | return (rc); \
|
---|
587 | } while (0)
|
---|
588 | #else
|
---|
589 | # define AssertMsgFailedReturn(a, rc) \
|
---|
590 | do { \
|
---|
591 | return (rc); \
|
---|
592 | } while (0)
|
---|
593 | #endif
|
---|
594 |
|
---|
595 | /** @def AssertMsgFailedReturnVoid
|
---|
596 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and return.
|
---|
597 | *
|
---|
598 | * @param a printf argument list (in parenthesis).
|
---|
599 | */
|
---|
600 | #ifdef RT_STRICT
|
---|
601 | # define AssertMsgFailedReturnVoid(a) \
|
---|
602 | do { \
|
---|
603 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
604 | AssertMsg2 a; \
|
---|
605 | AssertBreakpoint(); \
|
---|
606 | return; \
|
---|
607 | } while (0)
|
---|
608 | #else
|
---|
609 | # define AssertMsgFailedReturnVoid(a) \
|
---|
610 | do { \
|
---|
611 | return; \
|
---|
612 | } while (0)
|
---|
613 | #endif
|
---|
614 |
|
---|
615 |
|
---|
616 | /** @def AssertMsgFailedBreakStmt
|
---|
617 | * An assertion failed, hit breakpoint (RT_STRICT mode only), execute
|
---|
618 | * the given statement and break.
|
---|
619 | *
|
---|
620 | * @param a printf argument list (in parenthesis).
|
---|
621 | * @param stmt Statement to execute before break.
|
---|
622 | */
|
---|
623 | #ifdef RT_STRICT
|
---|
624 | # define AssertMsgFailedBreakStmt(a, stmt) \
|
---|
625 | if (1) { \
|
---|
626 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
627 | AssertMsg2 a; \
|
---|
628 | AssertBreakpoint(); \
|
---|
629 | stmt; \
|
---|
630 | break; \
|
---|
631 | } else do {} while (0)
|
---|
632 | #else
|
---|
633 | # define AssertMsgFailedBreakStmt(a, stmt) \
|
---|
634 | if (1) { \
|
---|
635 | stmt; \
|
---|
636 | break; \
|
---|
637 | } else do {} while (0)
|
---|
638 | #endif
|
---|
639 |
|
---|
640 | /** @def AssertMsgFailedBreakVoid
|
---|
641 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and break.
|
---|
642 | *
|
---|
643 | * @param a printf argument list (in parenthesis).
|
---|
644 | * @todo Rename to AssertMsgFailedBreak.
|
---|
645 | * @todo broken
|
---|
646 | */
|
---|
647 | #ifdef RT_STRICT
|
---|
648 | # define AssertMsgFailedBreakVoid(a) \
|
---|
649 | do { \
|
---|
650 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
651 | AssertMsg2 a; \
|
---|
652 | AssertBreakpoint(); \
|
---|
653 | break; \
|
---|
654 | } while (0)
|
---|
655 | #else
|
---|
656 | # define AssertMsgFailedBreakVoid(a) \
|
---|
657 | do { \
|
---|
658 | break; \
|
---|
659 | } while (0)
|
---|
660 | #endif
|
---|
661 |
|
---|
662 |
|
---|
663 |
|
---|
664 | /** @def AssertLogRelBreakpoint()
|
---|
665 | * Assertion LogRel Breakpoint.
|
---|
666 | *
|
---|
667 | * NOP in non-strict (release) builds, hardware breakpoint in strict builds,
|
---|
668 | *
|
---|
669 | * @remark In the gnu world we add a nop instruction after the int3 to
|
---|
670 | * force gdb to remain at the int3 source line.
|
---|
671 | * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
|
---|
672 | */
|
---|
673 | #ifdef RT_STRICT
|
---|
674 | # ifdef __GNUC__
|
---|
675 | # ifndef __L4ENV__
|
---|
676 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0)
|
---|
677 | # else
|
---|
678 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
|
---|
679 | # endif
|
---|
680 | # elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
681 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0)
|
---|
682 | # else
|
---|
683 | # error "Unknown compiler"
|
---|
684 | # endif
|
---|
685 | #else /* !RT_STRICT */
|
---|
686 | # define AssertLogRelBreakpoint() do { } while (0)
|
---|
687 | #endif /* !RT_STRICT */
|
---|
688 |
|
---|
689 |
|
---|
690 | /** @def AssertLogRelMsg1
|
---|
691 | * AssertMsg1 (strict builds) / LogRel wrapper (non-strict).
|
---|
692 | */
|
---|
693 | #ifdef RT_STRICT
|
---|
694 | # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \
|
---|
695 | AssertMsg1(pszExpr, iLine, pszFile, pszFunction)
|
---|
696 | #else
|
---|
697 | # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \
|
---|
698 | LogRel(("AssertLogRel %s(%d): %s\n",\
|
---|
699 | (pszFile), (iLine), (pszFile), (pszFunction), (pszExpr) ))
|
---|
700 | #endif
|
---|
701 |
|
---|
702 | /** @def AssertLogRelMsg2
|
---|
703 | * AssertMsg2 (strict builds) / LogRel wrapper (non-strict).
|
---|
704 | */
|
---|
705 | #ifdef RT_STRICT
|
---|
706 | # define AssertLogRelMsg2(a) AssertMsg2 a
|
---|
707 | #else
|
---|
708 | # define AssertLogRelMsg2(a) LogRel(a)
|
---|
709 | #endif
|
---|
710 |
|
---|
711 | /** @def AssertLogRel
|
---|
712 | * Assert that an expression is true.
|
---|
713 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
714 | *
|
---|
715 | * @param expr Expression which should be true.
|
---|
716 | */
|
---|
717 | #define AssertLogRel(expr) \
|
---|
718 | do { \
|
---|
719 | if (RT_UNLIKELY(!(expr))) \
|
---|
720 | { \
|
---|
721 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
722 | AssertLogRelBreakpoint(); \
|
---|
723 | } \
|
---|
724 | } while (0)
|
---|
725 |
|
---|
726 | /** @def AssertLogRelReturn
|
---|
727 | * Assert that an expression is true, return \a rc if it isn't.
|
---|
728 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
729 | *
|
---|
730 | * @param expr Expression which should be true.
|
---|
731 | * @param rc What is to be presented to return.
|
---|
732 | */
|
---|
733 | #define AssertLogRelReturn(expr, rc) \
|
---|
734 | do { \
|
---|
735 | if (RT_UNLIKELY(!(expr))) \
|
---|
736 | { \
|
---|
737 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
738 | AssertLogRelBreakpoint(); \
|
---|
739 | return (rc); \
|
---|
740 | } \
|
---|
741 | } while (0)
|
---|
742 |
|
---|
743 | /** @def AssertLogRelReturnVoid
|
---|
744 | * Assert that an expression is true, return void if it isn't.
|
---|
745 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
746 | *
|
---|
747 | * @param expr Expression which should be true.
|
---|
748 | */
|
---|
749 | #define AssertLogRelReturnVoid(expr) \
|
---|
750 | do { \
|
---|
751 | if (RT_UNLIKELY(!(expr))) \
|
---|
752 | { \
|
---|
753 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
754 | AssertLogRelBreakpoint(); \
|
---|
755 | return; \
|
---|
756 | } \
|
---|
757 | } while (0)
|
---|
758 |
|
---|
759 | /** @def AssertLogRelBreak
|
---|
760 | * Assert that an expression is true, break if it isn't.
|
---|
761 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
762 | *
|
---|
763 | * @param expr Expression which should be true.
|
---|
764 | */
|
---|
765 | #define AssertLogRelBreak(expr) \
|
---|
766 | if (RT_UNLIKELY(!(expr))) \
|
---|
767 | { \
|
---|
768 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
769 | AssertLogRelBreakpoint(); \
|
---|
770 | break; \
|
---|
771 | } \
|
---|
772 | else do {} while (0)
|
---|
773 |
|
---|
774 | /** @def AssertLogRelBreakStmt
|
---|
775 | * Assert that an expression is true, execute \a stmt and break if it isn't.
|
---|
776 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
777 | *
|
---|
778 | * @param expr Expression which should be true.
|
---|
779 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
780 | */
|
---|
781 | #define AssertLogRelBreakStmt(expr, stmt) \
|
---|
782 | if (RT_UNLIKELY(!(expr))) \
|
---|
783 | { \
|
---|
784 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
785 | AssertLogRelBreakpoint(); \
|
---|
786 | stmt; \
|
---|
787 | break; \
|
---|
788 | } else do {} while (0)
|
---|
789 |
|
---|
790 | /** @def AssertLogRelMsg
|
---|
791 | * Assert that an expression is true.
|
---|
792 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
793 | *
|
---|
794 | * @param expr Expression which should be true.
|
---|
795 | * @param a printf argument list (in parenthesis).
|
---|
796 | */
|
---|
797 | #define AssertLogRelMsg(expr, a) \
|
---|
798 | do { \
|
---|
799 | if (RT_UNLIKELY(!(expr))) \
|
---|
800 | { \
|
---|
801 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
802 | AssertLogRelMsg2(a); \
|
---|
803 | AssertLogRelBreakpoint(); \
|
---|
804 | } \
|
---|
805 | } while (0)
|
---|
806 |
|
---|
807 | /** @def AssertLogRelMsgReturn
|
---|
808 | * Assert that an expression is true, return \a rc if it isn't.
|
---|
809 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
810 | *
|
---|
811 | * @param expr Expression which should be true.
|
---|
812 | * @param a printf argument list (in parenthesis).
|
---|
813 | * @param rc What is to be presented to return.
|
---|
814 | */
|
---|
815 | #define AssertLogRelMsgReturn(expr, a, rc) \
|
---|
816 | do { \
|
---|
817 | if (RT_UNLIKELY(!(expr))) \
|
---|
818 | { \
|
---|
819 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
820 | AssertLogRelMsg2(a); \
|
---|
821 | AssertLogRelBreakpoint(); \
|
---|
822 | return (rc); \
|
---|
823 | } \
|
---|
824 | } while (0)
|
---|
825 |
|
---|
826 | /** @def AssertLogRelMsgReturnVoid
|
---|
827 | * Assert that an expression is true, return (void) if it isn't.
|
---|
828 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
829 | *
|
---|
830 | * @param expr Expression which should be true.
|
---|
831 | * @param a printf argument list (in parenthesis).
|
---|
832 | */
|
---|
833 | #define AssertLogRelMsgReturnVoid(expr, a) \
|
---|
834 | do { \
|
---|
835 | if (RT_UNLIKELY(!(expr))) \
|
---|
836 | { \
|
---|
837 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
838 | AssertLogRelMsg2(a); \
|
---|
839 | AssertLogRelBreakpoint(); \
|
---|
840 | return; \
|
---|
841 | } \
|
---|
842 | } while (0)
|
---|
843 |
|
---|
844 | /** @def AssertLogRelMsgBreak
|
---|
845 | * Assert that an expression is true, break if it isn't.
|
---|
846 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
847 | *
|
---|
848 | * @param expr Expression which should be true.
|
---|
849 | * @param a printf argument list (in parenthesis).
|
---|
850 | */
|
---|
851 | #define AssertLogRelMsgBreak(expr, a) \
|
---|
852 | if (RT_UNLIKELY(!(expr))) \
|
---|
853 | { \
|
---|
854 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
855 | AssertLogRelMsg2(a); \
|
---|
856 | AssertLogRelBreakpoint(); \
|
---|
857 | break; \
|
---|
858 | } \
|
---|
859 | else do {} while (0)
|
---|
860 |
|
---|
861 | /** @def AssertLogRelMsgBreakStmt
|
---|
862 | * Assert that an expression is true, execute \a stmt and break if it isn't.
|
---|
863 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
864 | *
|
---|
865 | * @param expr Expression which should be true.
|
---|
866 | * @param a printf argument list (in parenthesis).
|
---|
867 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
868 | */
|
---|
869 | #define AssertLogRelMsgBreakStmt(expr, a, stmt) \
|
---|
870 | if (RT_UNLIKELY(!(expr))) \
|
---|
871 | { \
|
---|
872 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
873 | AssertLogRelMsg2(a); \
|
---|
874 | AssertLogRelBreakpoint(); \
|
---|
875 | stmt; \
|
---|
876 | break; \
|
---|
877 | } else do {} while (0)
|
---|
878 |
|
---|
879 | /** @def AssertLogRelFailed
|
---|
880 | * An assertion failed.
|
---|
881 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
882 | */
|
---|
883 | #define AssertLogRelFailed() \
|
---|
884 | do { \
|
---|
885 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
886 | AssertLogRelBreakpoint(); \
|
---|
887 | } while (0)
|
---|
888 |
|
---|
889 | /** @def AssertLogRelFailedReturn
|
---|
890 | * An assertion failed.
|
---|
891 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
892 | *
|
---|
893 | * @param rc What is to be presented to return.
|
---|
894 | */
|
---|
895 | #define AssertLogRelFailedReturn(rc) \
|
---|
896 | do { \
|
---|
897 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
898 | AssertLogRelBreakpoint(); \
|
---|
899 | return (rc); \
|
---|
900 | } while (0)
|
---|
901 |
|
---|
902 | /** @def AssertLogRelFailedReturnVoid
|
---|
903 | * An assertion failed, hit a breakpoint and return.
|
---|
904 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
905 | */
|
---|
906 | #define AssertLogRelFailedReturnVoid() \
|
---|
907 | do { \
|
---|
908 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
909 | AssertLogRelBreakpoint(); \
|
---|
910 | return; \
|
---|
911 | } while (0)
|
---|
912 |
|
---|
913 | /** @def AssertLogRelFailedBreak
|
---|
914 | * An assertion failed, break.
|
---|
915 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
916 | */
|
---|
917 | #define AssertLogRelFailedBreak() \
|
---|
918 | if (1) \
|
---|
919 | { \
|
---|
920 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
921 | AssertLogRelBreakpoint(); \
|
---|
922 | break; \
|
---|
923 | } else do {} while (0)
|
---|
924 |
|
---|
925 | /** @def AssertLogRelFailedBreakStmt
|
---|
926 | * An assertion failed, execute \a stmt and break.
|
---|
927 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
928 | *
|
---|
929 | * @param stmt Statement to execute before break.
|
---|
930 | */
|
---|
931 | #define AssertLogRelFailedBreakStmt(stmt) \
|
---|
932 | if (1) \
|
---|
933 | { \
|
---|
934 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
935 | AssertLogRelBreakpoint(); \
|
---|
936 | stmt; \
|
---|
937 | break; \
|
---|
938 | } else do {} while (0)
|
---|
939 |
|
---|
940 | /** @def AssertLogRelMsgFailed
|
---|
941 | * An assertion failed.
|
---|
942 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
943 | *
|
---|
944 | * @param a printf argument list (in parenthesis).
|
---|
945 | */
|
---|
946 | #define AssertLogRelMsgFailed(a) \
|
---|
947 | do { \
|
---|
948 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
949 | AssertLogRelMsg2(a); \
|
---|
950 | AssertLogRelBreakpoint(); \
|
---|
951 | } while (0)
|
---|
952 |
|
---|
953 | /** @def AssertLogRelMsgFailedReturn
|
---|
954 | * An assertion failed, return \a rc.
|
---|
955 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
956 | *
|
---|
957 | * @param a printf argument list (in parenthesis).
|
---|
958 | * @param rc What is to be presented to return.
|
---|
959 | */
|
---|
960 | #define AssertLogRelMsgFailedReturn(a, rc) \
|
---|
961 | do { \
|
---|
962 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
963 | AssertLogRelMsg2(a); \
|
---|
964 | AssertLogRelBreakpoint(); \
|
---|
965 | return (rc); \
|
---|
966 | } while (0)
|
---|
967 |
|
---|
968 | /** @def AssertLogRelMsgFailedReturnVoid
|
---|
969 | * An assertion failed, return void.
|
---|
970 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
971 | *
|
---|
972 | * @param a printf argument list (in parenthesis).
|
---|
973 | */
|
---|
974 | #define AssertLogRelMsgFailedReturnVoid(a) \
|
---|
975 | do { \
|
---|
976 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
977 | AssertLogRelMsg2(a); \
|
---|
978 | AssertLogRelBreakpoint(); \
|
---|
979 | return; \
|
---|
980 | } while (0)
|
---|
981 |
|
---|
982 | /** @def AssertLogRelMsgFailedBreak
|
---|
983 | * An assertion failed, break.
|
---|
984 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
985 | *
|
---|
986 | * @param a printf argument list (in parenthesis).
|
---|
987 | */
|
---|
988 | #define AssertLogRelMsgFailedBreak(a) \
|
---|
989 | if (1)\
|
---|
990 | { \
|
---|
991 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
992 | AssertLogRelMsg2(a); \
|
---|
993 | AssertLogRelBreakpoint(); \
|
---|
994 | break; \
|
---|
995 | } else do {} while (0)
|
---|
996 |
|
---|
997 | /** @def AssertLogRelMsgFailedBreakStmt
|
---|
998 | * An assertion failed, execute \a stmt and break.
|
---|
999 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
1000 | *
|
---|
1001 | * @param a printf argument list (in parenthesis).
|
---|
1002 | * @param stmt Statement to execute before break.
|
---|
1003 | */
|
---|
1004 | #define AssertLogRelMsgFailedBreakStmt(a, stmt) \
|
---|
1005 | if (1) \
|
---|
1006 | { \
|
---|
1007 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1008 | AssertLogRelMsg2(a); \
|
---|
1009 | AssertLogRelBreakpoint(); \
|
---|
1010 | stmt; \
|
---|
1011 | break; \
|
---|
1012 | } else do {} while (0)
|
---|
1013 |
|
---|
1014 |
|
---|
1015 |
|
---|
1016 | /** @def AssertReleaseBreakpoint()
|
---|
1017 | * Assertion Breakpoint.
|
---|
1018 | *
|
---|
1019 | * @remark In the gnu world we add a nop instruction after the int3 to
|
---|
1020 | * force gdb to remain at the int3 source line.
|
---|
1021 | * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
|
---|
1022 | */
|
---|
1023 | #ifdef __GNUC__
|
---|
1024 | # ifndef __L4ENV__
|
---|
1025 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0)
|
---|
1026 | # else
|
---|
1027 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
|
---|
1028 | # endif
|
---|
1029 | #elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
1030 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0)
|
---|
1031 | #else
|
---|
1032 | # error "Unknown compiler"
|
---|
1033 | #endif
|
---|
1034 |
|
---|
1035 |
|
---|
1036 | /** @def AssertRelease
|
---|
1037 | * Assert that an expression is true. If it's not hit a breakpoint.
|
---|
1038 | *
|
---|
1039 | * @param expr Expression which should be true.
|
---|
1040 | */
|
---|
1041 | #define AssertRelease(expr) \
|
---|
1042 | do { \
|
---|
1043 | if (RT_UNLIKELY(!(expr))) \
|
---|
1044 | { \
|
---|
1045 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1046 | AssertReleaseBreakpoint(); \
|
---|
1047 | } \
|
---|
1048 | } while (0)
|
---|
1049 |
|
---|
1050 | /** @def AssertReleaseReturn
|
---|
1051 | * Assert that an expression is true, hit a breakpoing and return if it isn't.
|
---|
1052 | *
|
---|
1053 | * @param expr Expression which should be true.
|
---|
1054 | * @param rc What is to be presented to return.
|
---|
1055 | */
|
---|
1056 | #define AssertReleaseReturn(expr, rc) \
|
---|
1057 | do { \
|
---|
1058 | if (RT_UNLIKELY(!(expr))) \
|
---|
1059 | { \
|
---|
1060 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1061 | AssertReleaseBreakpoint(); \
|
---|
1062 | return (rc); \
|
---|
1063 | } \
|
---|
1064 | } while (0)
|
---|
1065 |
|
---|
1066 | /** @def AssertReleaseReturnVoid
|
---|
1067 | * Assert that an expression is true, hit a breakpoing and return if it isn't.
|
---|
1068 | *
|
---|
1069 | * @param expr Expression which should be true.
|
---|
1070 | */
|
---|
1071 | #define AssertReleaseReturnVoid(expr) \
|
---|
1072 | do { \
|
---|
1073 | if (RT_UNLIKELY(!(expr))) \
|
---|
1074 | { \
|
---|
1075 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1076 | AssertReleaseBreakpoint(); \
|
---|
1077 | return; \
|
---|
1078 | } \
|
---|
1079 | } while (0)
|
---|
1080 |
|
---|
1081 |
|
---|
1082 | /** @def AssertReleaseBreakStmt
|
---|
1083 | * Assert that an expression is true, hit a breakpoing and break if it isn't.
|
---|
1084 | *
|
---|
1085 | * @param expr Expression which should be true.
|
---|
1086 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1087 | */
|
---|
1088 | #define AssertReleaseBreakStmt(expr, stmt) \
|
---|
1089 | do { \
|
---|
1090 | if (RT_UNLIKELY(!(expr))) \
|
---|
1091 | { \
|
---|
1092 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1093 | AssertReleaseBreakpoint(); \
|
---|
1094 | stmt; \
|
---|
1095 | break; \
|
---|
1096 | } \
|
---|
1097 | } while (0)
|
---|
1098 |
|
---|
1099 | /** @def AssertReleaseBreakVoid
|
---|
1100 | * Assert that an expression is true, hit a breakpoing and break if it isn't.
|
---|
1101 | *
|
---|
1102 | * @param expr Expression which should be true.
|
---|
1103 | * @todo Rename to AssertReleaseBreak.
|
---|
1104 | */
|
---|
1105 | #define AssertReleaseBreakVoid(expr) \
|
---|
1106 | if { \
|
---|
1107 | if (RT_UNLIKELY(!(expr))) \
|
---|
1108 | { \
|
---|
1109 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1110 | AssertReleaseBreakpoint(); \
|
---|
1111 | break; \
|
---|
1112 | } \
|
---|
1113 | } else do {} while (0)
|
---|
1114 |
|
---|
1115 |
|
---|
1116 | /** @def AssertReleaseMsg
|
---|
1117 | * Assert that an expression is true, print the message and hit a breakpoint if it isn't.
|
---|
1118 | *
|
---|
1119 | * @param expr Expression which should be true.
|
---|
1120 | * @param a printf argument list (in parenthesis).
|
---|
1121 | */
|
---|
1122 | #define AssertReleaseMsg(expr, a) \
|
---|
1123 | do { \
|
---|
1124 | if (RT_UNLIKELY(!(expr))) \
|
---|
1125 | { \
|
---|
1126 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1127 | AssertMsg2 a; \
|
---|
1128 | AssertReleaseBreakpoint(); \
|
---|
1129 | } \
|
---|
1130 | } while (0)
|
---|
1131 |
|
---|
1132 | /** @def AssertReleaseMsgReturn
|
---|
1133 | * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
|
---|
1134 | *
|
---|
1135 | * @param expr Expression which should be true.
|
---|
1136 | * @param a printf argument list (in parenthesis).
|
---|
1137 | * @param rc What is to be presented to return.
|
---|
1138 | */
|
---|
1139 | #define AssertReleaseMsgReturn(expr, a, rc) \
|
---|
1140 | do { \
|
---|
1141 | if (RT_UNLIKELY(!(expr))) \
|
---|
1142 | { \
|
---|
1143 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1144 | AssertMsg2 a; \
|
---|
1145 | AssertReleaseBreakpoint(); \
|
---|
1146 | return (rc); \
|
---|
1147 | } \
|
---|
1148 | } while (0)
|
---|
1149 |
|
---|
1150 | /** @def AssertReleaseMsgReturnVoid
|
---|
1151 | * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
|
---|
1152 | *
|
---|
1153 | * @param expr Expression which should be true.
|
---|
1154 | * @param a printf argument list (in parenthesis).
|
---|
1155 | */
|
---|
1156 | #define AssertReleaseMsgReturnVoid(expr, a) \
|
---|
1157 | do { \
|
---|
1158 | if (RT_UNLIKELY(!(expr))) \
|
---|
1159 | { \
|
---|
1160 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1161 | AssertMsg2 a; \
|
---|
1162 | AssertReleaseBreakpoint(); \
|
---|
1163 | return; \
|
---|
1164 | } \
|
---|
1165 | } while (0)
|
---|
1166 |
|
---|
1167 |
|
---|
1168 | /** @def AssertReleaseMsgBreakStmt
|
---|
1169 | * Assert that an expression is true, print the message and hit a breakpoing and break if it isn't.
|
---|
1170 | *
|
---|
1171 | * @param expr Expression which should be true.
|
---|
1172 | * @param a printf argument list (in parenthesis).
|
---|
1173 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1174 | */
|
---|
1175 | #define AssertReleaseMsgBreakStmt(expr, a, stmt) \
|
---|
1176 | if (RT_UNLIKELY(!(expr))) { \
|
---|
1177 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1178 | AssertMsg2 a; \
|
---|
1179 | AssertReleaseBreakpoint(); \
|
---|
1180 | stmt; \
|
---|
1181 | break; \
|
---|
1182 | } else do {} while (0)
|
---|
1183 |
|
---|
1184 | /** @def AssertReleaseMsgBreakVoid
|
---|
1185 | * Assert that an expression is true, print the message and hit a breakpoint and break if it isn't.
|
---|
1186 | *
|
---|
1187 | * @param expr Expression which should be true.
|
---|
1188 | * @param a printf argument list (in parenthesis).
|
---|
1189 | * @todo Rename to AssertReleaseMsgBreak.
|
---|
1190 | * @todo broken
|
---|
1191 | */
|
---|
1192 | #define AssertReleaseMsgBreakVoid(expr, a) \
|
---|
1193 | do { \
|
---|
1194 | if (RT_UNLIKELY(!(expr))) \
|
---|
1195 | { \
|
---|
1196 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1197 | AssertMsg2 a; \
|
---|
1198 | AssertReleaseBreakpoint(); \
|
---|
1199 | break; \
|
---|
1200 | } \
|
---|
1201 | } while (0)
|
---|
1202 |
|
---|
1203 |
|
---|
1204 | /** @def AssertReleaseFailed
|
---|
1205 | * An assertion failed, hit a breakpoint.
|
---|
1206 | */
|
---|
1207 | #define AssertReleaseFailed() \
|
---|
1208 | do { \
|
---|
1209 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1210 | AssertReleaseBreakpoint(); \
|
---|
1211 | } while (0)
|
---|
1212 |
|
---|
1213 | /** @def AssertReleaseFailedReturn
|
---|
1214 | * An assertion failed, hit a breakpoint and return.
|
---|
1215 | *
|
---|
1216 | * @param rc What is to be presented to return.
|
---|
1217 | */
|
---|
1218 | #define AssertReleaseFailedReturn(rc) \
|
---|
1219 | do { \
|
---|
1220 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1221 | AssertReleaseBreakpoint(); \
|
---|
1222 | return (rc); \
|
---|
1223 | } while (0)
|
---|
1224 |
|
---|
1225 | /** @def AssertReleaseFailedReturnVoid
|
---|
1226 | * An assertion failed, hit a breakpoint and return.
|
---|
1227 | */
|
---|
1228 | #define AssertReleaseFailedReturnVoid() \
|
---|
1229 | do { \
|
---|
1230 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1231 | AssertReleaseBreakpoint(); \
|
---|
1232 | return; \
|
---|
1233 | } while (0)
|
---|
1234 |
|
---|
1235 |
|
---|
1236 | /** @def AssertReleaseFailedBreakStmt
|
---|
1237 | * An assertion failed, hit a breakpoint and break.
|
---|
1238 | *
|
---|
1239 | * @param stmt Statement to execute before break.
|
---|
1240 | */
|
---|
1241 | #define AssertReleaseFailedBreakStmt(stmt) \
|
---|
1242 | if (1) { \
|
---|
1243 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1244 | AssertReleaseBreakpoint(); \
|
---|
1245 | stmt; \
|
---|
1246 | break; \
|
---|
1247 | } else do {} while (0)
|
---|
1248 |
|
---|
1249 | /** @def AssertReleaseFailedBreakVoid
|
---|
1250 | * An assertion failed, hit a breakpoint and break.
|
---|
1251 | * @todo Rename to AssertReleaseFailedBreak.
|
---|
1252 | * @todo broken, should use 'if' instead of 'do'.
|
---|
1253 | */
|
---|
1254 | #define AssertReleaseFailedBreakVoid() \
|
---|
1255 | do { \
|
---|
1256 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1257 | AssertReleaseBreakpoint(); \
|
---|
1258 | break; \
|
---|
1259 | } while (0)
|
---|
1260 |
|
---|
1261 |
|
---|
1262 | /** @def AssertReleaseMsgFailed
|
---|
1263 | * An assertion failed, print a message and hit a breakpoint.
|
---|
1264 | *
|
---|
1265 | * @param a printf argument list (in parenthesis).
|
---|
1266 | */
|
---|
1267 | #define AssertReleaseMsgFailed(a) \
|
---|
1268 | do { \
|
---|
1269 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1270 | AssertMsg2 a; \
|
---|
1271 | AssertReleaseBreakpoint(); \
|
---|
1272 | } while (0)
|
---|
1273 |
|
---|
1274 | /** @def AssertReleaseMsgFailedReturn
|
---|
1275 | * An assertion failed, print a message, hit a breakpoint and return.
|
---|
1276 | *
|
---|
1277 | * @param a printf argument list (in parenthesis).
|
---|
1278 | * @param rc What is to be presented to return.
|
---|
1279 | */
|
---|
1280 | #define AssertReleaseMsgFailedReturn(a, rc) \
|
---|
1281 | do { \
|
---|
1282 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1283 | AssertMsg2 a; \
|
---|
1284 | AssertReleaseBreakpoint(); \
|
---|
1285 | return (rc); \
|
---|
1286 | } while (0)
|
---|
1287 |
|
---|
1288 | /** @def AssertReleaseMsgFailedReturnVoid
|
---|
1289 | * An assertion failed, print a message, hit a breakpoint and return.
|
---|
1290 | *
|
---|
1291 | * @param a printf argument list (in parenthesis).
|
---|
1292 | */
|
---|
1293 | #define AssertReleaseMsgFailedReturnVoid(a) \
|
---|
1294 | do { \
|
---|
1295 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1296 | AssertMsg2 a; \
|
---|
1297 | AssertReleaseBreakpoint(); \
|
---|
1298 | return; \
|
---|
1299 | } while (0)
|
---|
1300 |
|
---|
1301 |
|
---|
1302 | /** @def AssertReleaseMsgFailedBreakStmt
|
---|
1303 | * An assertion failed, print a message, hit a breakpoint and break.
|
---|
1304 | *
|
---|
1305 | * @param a printf argument list (in parenthesis).
|
---|
1306 | * @param stmt Statement to execute before break.
|
---|
1307 | */
|
---|
1308 | #define AssertReleaseMsgFailedBreakStmt(a, stmt) \
|
---|
1309 | if (1) { \
|
---|
1310 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1311 | AssertMsg2 a; \
|
---|
1312 | AssertReleaseBreakpoint(); \
|
---|
1313 | stmt; \
|
---|
1314 | break; \
|
---|
1315 | } else do {} while (0)
|
---|
1316 |
|
---|
1317 | /** @def AssertReleaseMsgFailedBreakVoid
|
---|
1318 | * An assertion failed, print a message, hit a breakpoint and break.
|
---|
1319 | *
|
---|
1320 | * @param a printf argument list (in parenthesis).
|
---|
1321 | * @todo Rename to AssertReleaseMsgFailedBreak.
|
---|
1322 | * @todo broken
|
---|
1323 | */
|
---|
1324 | #define AssertReleaseMsgFailedBreakVoid(a) \
|
---|
1325 | do { \
|
---|
1326 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1327 | AssertMsg2 a; \
|
---|
1328 | AssertReleaseBreakpoint(); \
|
---|
1329 | break; \
|
---|
1330 | } while (0)
|
---|
1331 |
|
---|
1332 |
|
---|
1333 | /** @def AssertFatal
|
---|
1334 | * Assert that an expression is true. If it's not hit a breakpoint (for ever).
|
---|
1335 | *
|
---|
1336 | * @param expr Expression which should be true.
|
---|
1337 | */
|
---|
1338 | #define AssertFatal(expr) \
|
---|
1339 | do { \
|
---|
1340 | if (RT_UNLIKELY(!(expr))) \
|
---|
1341 | for (;;) \
|
---|
1342 | { \
|
---|
1343 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1344 | AssertReleaseBreakpoint(); \
|
---|
1345 | } \
|
---|
1346 | } while (0)
|
---|
1347 |
|
---|
1348 | /** @def AssertFatalMsg
|
---|
1349 | * Assert that an expression is true, print the message and hit a breakpoint (for ever) if it isn't.
|
---|
1350 | *
|
---|
1351 | * @param expr Expression which should be true.
|
---|
1352 | * @param a printf argument list (in parenthesis).
|
---|
1353 | */
|
---|
1354 | #define AssertFatalMsg(expr, a) \
|
---|
1355 | do { \
|
---|
1356 | if (RT_UNLIKELY(!(expr))) \
|
---|
1357 | for (;;) \
|
---|
1358 | { \
|
---|
1359 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1360 | AssertMsg2 a; \
|
---|
1361 | AssertReleaseBreakpoint(); \
|
---|
1362 | } \
|
---|
1363 | } while (0)
|
---|
1364 |
|
---|
1365 | /** @def AssertFatalFailed
|
---|
1366 | * An assertion failed, hit a breakpoint (for ever).
|
---|
1367 | */
|
---|
1368 | #define AssertFatalFailed() \
|
---|
1369 | do { \
|
---|
1370 | for (;;) \
|
---|
1371 | { \
|
---|
1372 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1373 | AssertReleaseBreakpoint(); \
|
---|
1374 | } \
|
---|
1375 | } while (0)
|
---|
1376 |
|
---|
1377 | /** @def AssertFatalMsgFailed
|
---|
1378 | * An assertion failed, print a message and hit a breakpoint (for ever).
|
---|
1379 | *
|
---|
1380 | * @param a printf argument list (in parenthesis).
|
---|
1381 | */
|
---|
1382 | #define AssertFatalMsgFailed(a) \
|
---|
1383 | do { \
|
---|
1384 | for (;;) \
|
---|
1385 | { \
|
---|
1386 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1387 | AssertMsg2 a; \
|
---|
1388 | AssertReleaseBreakpoint(); \
|
---|
1389 | } \
|
---|
1390 | } while (0)
|
---|
1391 |
|
---|
1392 |
|
---|
1393 | /** @def AssertRC
|
---|
1394 | * Asserts a iprt status code successful.
|
---|
1395 | *
|
---|
1396 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1397 | *
|
---|
1398 | * @param rc iprt status code.
|
---|
1399 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1400 | */
|
---|
1401 | #define AssertRC(rc) AssertMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1402 |
|
---|
1403 | /** @def AssertRCReturn
|
---|
1404 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1405 | *
|
---|
1406 | * @param rc iprt status code.
|
---|
1407 | * @param rcRet What is to be presented to return.
|
---|
1408 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1409 | */
|
---|
1410 | #define AssertRCReturn(rc, rcRet) AssertMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
|
---|
1411 |
|
---|
1412 | /** @def AssertRCReturnVoid
|
---|
1413 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1414 | *
|
---|
1415 | * @param rc iprt status code.
|
---|
1416 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1417 | */
|
---|
1418 | #define AssertRCReturnVoid(rc) AssertMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
|
---|
1419 |
|
---|
1420 | /** @def AssertRCBreakStmt
|
---|
1421 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1422 | *
|
---|
1423 | * @param rc iprt status code.
|
---|
1424 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1425 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1426 | */
|
---|
1427 | #define AssertRCBreakStmt(rc, stmt) AssertMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
|
---|
1428 |
|
---|
1429 | /** @def AssertRCBreakVoid
|
---|
1430 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1431 | *
|
---|
1432 | * @param rc iprt status code.
|
---|
1433 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1434 | * @todo Rename to AssertRCBreak.
|
---|
1435 | */
|
---|
1436 | #define AssertRCBreakVoid(rc) AssertMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
|
---|
1437 |
|
---|
1438 | /** @def AssertMsgRC
|
---|
1439 | * Asserts a iprt status code successful.
|
---|
1440 | *
|
---|
1441 | * It prints a custom message and hits a breakpoint on FAILURE.
|
---|
1442 | *
|
---|
1443 | * @param rc iprt status code.
|
---|
1444 | * @param msg printf argument list (in parenthesis).
|
---|
1445 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1446 | */
|
---|
1447 | #define AssertMsgRC(rc, msg) \
|
---|
1448 | do { AssertMsg(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1449 |
|
---|
1450 | /** @def AssertMsgRCReturn
|
---|
1451 | * Asserts a iprt status code successful and if it's not return the specified status code.
|
---|
1452 | *
|
---|
1453 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1454 | *
|
---|
1455 | * @param rc iprt status code.
|
---|
1456 | * @param msg printf argument list (in parenthesis).
|
---|
1457 | * @param rcRet What is to be presented to return.
|
---|
1458 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1459 | */
|
---|
1460 | #define AssertMsgRCReturn(rc, msg, rcRet) \
|
---|
1461 | do { AssertMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
|
---|
1462 |
|
---|
1463 | /** @def AssertMsgRCReturnVoid
|
---|
1464 | * Asserts a iprt status code successful and if it's not return.
|
---|
1465 | *
|
---|
1466 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1467 | *
|
---|
1468 | * @param rc iprt status code.
|
---|
1469 | * @param msg printf argument list (in parenthesis).
|
---|
1470 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1471 | */
|
---|
1472 | #define AssertMsgRCReturnVoid(rc, msg) \
|
---|
1473 | do { AssertMsgReturnVoid(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1474 |
|
---|
1475 | /** @def AssertMsgRCBreakStmt
|
---|
1476 | * Asserts a iprt status code successful and break if it's not.
|
---|
1477 | *
|
---|
1478 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1479 | *
|
---|
1480 | * @param rc iprt status code.
|
---|
1481 | * @param msg printf argument list (in parenthesis).
|
---|
1482 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1483 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1484 | */
|
---|
1485 | #define AssertMsgRCBreakStmt(rc, msg, stmt) \
|
---|
1486 | if (1) { AssertMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)
|
---|
1487 |
|
---|
1488 | /** @def AssertMsgRCBreakVoid
|
---|
1489 | * Asserts a iprt status code successful and if it's not break.
|
---|
1490 | *
|
---|
1491 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it breaks
|
---|
1492 | *
|
---|
1493 | * @param rc iprt status code.
|
---|
1494 | * @param msg printf argument list (in parenthesis).
|
---|
1495 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1496 | * @todo Rename to AssertMsgRCBreak.
|
---|
1497 | */
|
---|
1498 | #define AssertMsgRCBreakVoid(rc, msg) \
|
---|
1499 | if (1) { AssertMsgBreakVoid(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)
|
---|
1500 |
|
---|
1501 | /** @def AssertRCSuccess
|
---|
1502 | * Asserts an iprt status code equals VINF_SUCCESS.
|
---|
1503 | *
|
---|
1504 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1505 | *
|
---|
1506 | * @param rc iprt status code.
|
---|
1507 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1508 | */
|
---|
1509 | #define AssertRCSuccess(rc) AssertMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1510 |
|
---|
1511 | /** @def AssertRCSuccessReturn
|
---|
1512 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1513 | *
|
---|
1514 | * @param rc iprt status code.
|
---|
1515 | * @param rcRet What is to be presented to return.
|
---|
1516 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1517 | */
|
---|
1518 | #define AssertRCSuccessReturn(rc, rcRet) AssertMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
|
---|
1519 |
|
---|
1520 | /** @def AssertRCSuccessReturnVoid
|
---|
1521 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1522 | *
|
---|
1523 | * @param rc iprt status code.
|
---|
1524 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1525 | */
|
---|
1526 | #define AssertRCSuccessReturnVoid(rc) AssertMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1527 |
|
---|
1528 | /** @def AssertRCSuccessBreakStmt
|
---|
1529 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1530 | *
|
---|
1531 | * @param rc iprt status code.
|
---|
1532 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1533 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1534 | */
|
---|
1535 | #define AssertRCSuccessBreakStmt(rc, stmt) AssertMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1536 |
|
---|
1537 | /** @def AssertRCSuccessBreakVoid
|
---|
1538 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1539 | *
|
---|
1540 | * @param rc iprt status code.
|
---|
1541 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1542 | * @todo Rename to AssertRCSuccessBreak.
|
---|
1543 | */
|
---|
1544 | #define AssertRCSuccessBreakVoid(rc) AssertMsgBreakVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1545 |
|
---|
1546 |
|
---|
1547 | /** @def AssertLogRelRC
|
---|
1548 | * Asserts a iprt status code successful.
|
---|
1549 | *
|
---|
1550 | * @param rc iprt status code.
|
---|
1551 | * @remark rc is references multiple times.
|
---|
1552 | */
|
---|
1553 | #define AssertLogRelRC(rc) AssertLogRelMsgRC(rc, ("%Rra\n", (rc)))
|
---|
1554 |
|
---|
1555 | /** @def AssertLogRelRCReturn
|
---|
1556 | * Asserts a iprt status code successful, returning \a rc if it isn't.
|
---|
1557 | *
|
---|
1558 | * @param rc iprt status code.
|
---|
1559 | * @param rcRet What is to be presented to return.
|
---|
1560 | * @remark rc is references multiple times.
|
---|
1561 | */
|
---|
1562 | #define AssertLogRelRCReturn(rc, rcRet) AssertLogRelMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)
|
---|
1563 |
|
---|
1564 | /** @def AssertLogRelRCReturnVoid
|
---|
1565 | * Asserts a iprt status code successful, returning (void) if it isn't.
|
---|
1566 | *
|
---|
1567 | * @param rc iprt status code.
|
---|
1568 | * @remark rc is references multiple times.
|
---|
1569 | */
|
---|
1570 | #define AssertLogRelRCReturnVoid(rc) AssertLogRelMsgRCReturnVoid(rc, ("%Rra\n", (rc)))
|
---|
1571 |
|
---|
1572 | /** @def AssertLogRelRCBreak
|
---|
1573 | * Asserts a iprt status code successful, breaking if it isn't.
|
---|
1574 | *
|
---|
1575 | * @param rc iprt status code.
|
---|
1576 | * @remark rc is references multiple times.
|
---|
1577 | */
|
---|
1578 | #define AssertLogRelRCBreak(rc) AssertLogRelMsgRCBreak(rc, ("%Rra\n", (rc)))
|
---|
1579 |
|
---|
1580 | /** @def AssertLogRelRCBreakStmt
|
---|
1581 | * Asserts a iprt status code successful, execute \a statement and break if it isn't.
|
---|
1582 | *
|
---|
1583 | * @param rc iprt status code.
|
---|
1584 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1585 | * @remark rc is references multiple times.
|
---|
1586 | */
|
---|
1587 | #define AssertLogRelRCBreakStmt(rc, stmt) AssertLogRelMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt)
|
---|
1588 |
|
---|
1589 | /** @def AssertLogRelMsgRC
|
---|
1590 | * Asserts a iprt status code successful.
|
---|
1591 | *
|
---|
1592 | * @param rc iprt status code.
|
---|
1593 | * @param msg printf argument list (in parenthesis).
|
---|
1594 | * @remark rc is references multiple times.
|
---|
1595 | */
|
---|
1596 | #define AssertLogRelMsgRC(rc, msg) AssertLogRelMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1597 |
|
---|
1598 | /** @def AssertLogRelMsgRCReturn
|
---|
1599 | * Asserts a iprt status code successful.
|
---|
1600 | *
|
---|
1601 | * @param rc iprt status code.
|
---|
1602 | * @param msg printf argument list (in parenthesis).
|
---|
1603 | * @param rcRet What is to be presented to return.
|
---|
1604 | * @remark rc is references multiple times.
|
---|
1605 | */
|
---|
1606 | #define AssertLogRelMsgRCReturn(rc, msg, rcRet) AssertLogRelMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
|
---|
1607 |
|
---|
1608 | /** @def AssertLogRelMsgRCReturnVoid
|
---|
1609 | * Asserts a iprt status code successful.
|
---|
1610 | *
|
---|
1611 | * @param rc iprt status code.
|
---|
1612 | * @param msg printf argument list (in parenthesis).
|
---|
1613 | * @remark rc is references multiple times.
|
---|
1614 | */
|
---|
1615 | #define AssertLogRelMsgRCReturnVoid(rc, msg) AssertLogRelMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
|
---|
1616 |
|
---|
1617 | /** @def AssertLogRelMsgRCBreak
|
---|
1618 | * Asserts a iprt status code successful.
|
---|
1619 | *
|
---|
1620 | * @param rc iprt status code.
|
---|
1621 | * @param msg printf argument list (in parenthesis).
|
---|
1622 | * @remark rc is references multiple times.
|
---|
1623 | */
|
---|
1624 | #define AssertLogRelMsgRCBreak(rc, msg) AssertLogRelMsgBreak(RT_SUCCESS(rc), msg)
|
---|
1625 |
|
---|
1626 | /** @def AssertLogRelMsgRCBreakStmt
|
---|
1627 | * Asserts a iprt status code successful, execute \a stmt and break if it isn't.
|
---|
1628 | *
|
---|
1629 | * @param rc iprt status code.
|
---|
1630 | * @param msg printf argument list (in parenthesis).
|
---|
1631 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1632 | * @remark rc is references multiple times.
|
---|
1633 | */
|
---|
1634 | #define AssertLogRelMsgRCBreakStmt(rc, msg, stmt) AssertLogRelMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
|
---|
1635 |
|
---|
1636 | /** @def AssertLogRelRCSuccess
|
---|
1637 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1638 | *
|
---|
1639 | * @param rc iprt status code.
|
---|
1640 | * @remark rc is references multiple times.
|
---|
1641 | */
|
---|
1642 | #define AssertLogRelRCSuccess(rc) AssertLogRelMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1643 |
|
---|
1644 | /** @def AssertLogRelRCSuccessReturn
|
---|
1645 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1646 | *
|
---|
1647 | * @param rc iprt status code.
|
---|
1648 | * @param rcRet What is to be presented to return.
|
---|
1649 | * @remark rc is references multiple times.
|
---|
1650 | */
|
---|
1651 | #define AssertLogRelRCSuccessReturn(rc, rcRet) AssertLogRelMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
|
---|
1652 |
|
---|
1653 | /** @def AssertLogRelRCSuccessReturnVoid
|
---|
1654 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1655 | *
|
---|
1656 | * @param rc iprt status code.
|
---|
1657 | * @remark rc is references multiple times.
|
---|
1658 | */
|
---|
1659 | #define AssertLogRelRCSuccessReturnVoid(rc) AssertLogRelMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1660 |
|
---|
1661 | /** @def AssertLogRelRCSuccessBreak
|
---|
1662 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1663 | *
|
---|
1664 | * @param rc iprt status code.
|
---|
1665 | * @remark rc is references multiple times.
|
---|
1666 | */
|
---|
1667 | #define AssertLogRelRCSuccessBreak(rc) AssertLogRelMsgBreak((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1668 |
|
---|
1669 | /** @def AssertLogRelRCSuccessBreakStmt
|
---|
1670 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1671 | *
|
---|
1672 | * @param rc iprt status code.
|
---|
1673 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1674 | * @remark rc is references multiple times.
|
---|
1675 | */
|
---|
1676 | #define AssertLogRelRCSuccessBreakStmt(rc, stmt) AssertLogRelMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1677 |
|
---|
1678 |
|
---|
1679 | /** @def AssertReleaseRC
|
---|
1680 | * Asserts a iprt status code successful.
|
---|
1681 | *
|
---|
1682 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1683 | *
|
---|
1684 | * @param rc iprt status code.
|
---|
1685 | * @remark rc is references multiple times.
|
---|
1686 | */
|
---|
1687 | #define AssertReleaseRC(rc) AssertReleaseMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1688 |
|
---|
1689 | /** @def AssertReleaseRCReturn
|
---|
1690 | * Asserts a iprt status code successful, returning if it isn't.
|
---|
1691 | *
|
---|
1692 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1693 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1694 | *
|
---|
1695 | * @param rc iprt status code.
|
---|
1696 | * @param rcRet What is to be presented to return.
|
---|
1697 | * @remark rc is references multiple times.
|
---|
1698 | */
|
---|
1699 | #define AssertReleaseRCReturn(rc, rcRet) AssertReleaseMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
|
---|
1700 |
|
---|
1701 | /** @def AssertReleaseRCReturnVoid
|
---|
1702 | * Asserts a iprt status code successful, returning if it isn't.
|
---|
1703 | *
|
---|
1704 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1705 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1706 | *
|
---|
1707 | * @param rc iprt status code.
|
---|
1708 | * @remark rc is references multiple times.
|
---|
1709 | */
|
---|
1710 | #define AssertReleaseRCReturnVoid(rc) AssertReleaseMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
|
---|
1711 |
|
---|
1712 | /** @def AssertReleaseRCBreakStmt
|
---|
1713 | * Asserts a iprt status code successful, break if it isn't.
|
---|
1714 | *
|
---|
1715 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1716 | * and finally the break statement will be issued if the breakpoint is somehow ignored.
|
---|
1717 | *
|
---|
1718 | * @param rc iprt status code.
|
---|
1719 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1720 | * @remark rc is references multiple times.
|
---|
1721 | */
|
---|
1722 | #define AssertReleaseRCBreakStmt(rc, stmt) AssertReleaseMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
|
---|
1723 |
|
---|
1724 | /** @def AssertReleaseRCBreakVoid
|
---|
1725 | * Asserts a iprt status code successful, breaking if it isn't.
|
---|
1726 | *
|
---|
1727 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1728 | * and finally breaking the current statement if the breakpoint is somehow ignored.
|
---|
1729 | *
|
---|
1730 | * @param rc iprt status code.
|
---|
1731 | * @remark rc is references multiple times.
|
---|
1732 | * @todo Rename to AssertReleaseRCBreak.
|
---|
1733 | */
|
---|
1734 | #define AssertReleaseRCBreakVoid(rc) AssertReleaseMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
|
---|
1735 |
|
---|
1736 | /** @def AssertReleaseMsgRC
|
---|
1737 | * Asserts a iprt status code successful.
|
---|
1738 | *
|
---|
1739 | * On failure a custom message is printed and a breakpoint is hit.
|
---|
1740 | *
|
---|
1741 | * @param rc iprt status code.
|
---|
1742 | * @param msg printf argument list (in parenthesis).
|
---|
1743 | * @remark rc is references multiple times.
|
---|
1744 | */
|
---|
1745 | #define AssertReleaseMsgRC(rc, msg) AssertReleaseMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1746 |
|
---|
1747 | /** @def AssertReleaseMsgRCReturn
|
---|
1748 | * Asserts a iprt status code successful.
|
---|
1749 | *
|
---|
1750 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1751 | * returning from the function if the breakpoint is showhow ignored.
|
---|
1752 | *
|
---|
1753 | * @param rc iprt status code.
|
---|
1754 | * @param msg printf argument list (in parenthesis).
|
---|
1755 | * @param rcRet What is to be presented to return.
|
---|
1756 | * @remark rc is references multiple times.
|
---|
1757 | */
|
---|
1758 | #define AssertReleaseMsgRCReturn(rc, msg, rcRet) AssertReleaseMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
|
---|
1759 |
|
---|
1760 | /** @def AssertReleaseMsgRCReturnVoid
|
---|
1761 | * Asserts a iprt status code successful.
|
---|
1762 | *
|
---|
1763 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1764 | * returning from the function if the breakpoint is showhow ignored.
|
---|
1765 | *
|
---|
1766 | * @param rc iprt status code.
|
---|
1767 | * @param msg printf argument list (in parenthesis).
|
---|
1768 | * @remark rc is references multiple times.
|
---|
1769 | */
|
---|
1770 | #define AssertReleaseMsgRCReturnVoid(rc, msg) AssertReleaseMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
|
---|
1771 |
|
---|
1772 | /** @def AssertReleaseMsgRCBreakStmt
|
---|
1773 | * Asserts a iprt status code successful.
|
---|
1774 | *
|
---|
1775 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1776 | * the brean statement is issued if the breakpoint is showhow ignored.
|
---|
1777 | *
|
---|
1778 | * @param rc iprt status code.
|
---|
1779 | * @param msg printf argument list (in parenthesis).
|
---|
1780 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1781 | * @remark rc is references multiple times.
|
---|
1782 | */
|
---|
1783 | #define AssertReleaseMsgRCBreakStmt(rc, msg, stmt) AssertReleaseMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
|
---|
1784 |
|
---|
1785 | /** @def AssertReleaseMsgRCBreakVoid
|
---|
1786 | * Asserts a iprt status code successful.
|
---|
1787 | *
|
---|
1788 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1789 | * breaking the current status if the breakpoint is showhow ignored.
|
---|
1790 | *
|
---|
1791 | * @param rc iprt status code.
|
---|
1792 | * @param msg printf argument list (in parenthesis).
|
---|
1793 | * @remark rc is references multiple times.
|
---|
1794 | * @todo Rename to AssertReleaseMsgRCBreak.
|
---|
1795 | */
|
---|
1796 | #define AssertReleaseMsgRCBreakVoid(rc, msg) AssertReleaseMsgBreakVoid(RT_SUCCESS(rc), msg)
|
---|
1797 |
|
---|
1798 | /** @def AssertReleaseRCSuccess
|
---|
1799 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1800 | *
|
---|
1801 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1802 | *
|
---|
1803 | * @param rc iprt status code.
|
---|
1804 | * @remark rc is references multiple times.
|
---|
1805 | */
|
---|
1806 | #define AssertReleaseRCSuccess(rc) AssertReleaseMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1807 |
|
---|
1808 | /** @def AssertReleaseRCSuccessReturn
|
---|
1809 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1810 | *
|
---|
1811 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1812 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1813 | *
|
---|
1814 | * @param rc iprt status code.
|
---|
1815 | * @param rcRet What is to be presented to return.
|
---|
1816 | * @remark rc is references multiple times.
|
---|
1817 | */
|
---|
1818 | #define AssertReleaseRCSuccessReturn(rc, rcRet) AssertReleaseMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
|
---|
1819 |
|
---|
1820 | /** @def AssertReleaseRCSuccessReturnVoid
|
---|
1821 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1822 | *
|
---|
1823 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1824 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1825 | *
|
---|
1826 | * @param rc iprt status code.
|
---|
1827 | * @remark rc is references multiple times.
|
---|
1828 | */
|
---|
1829 | #define AssertReleaseRCSuccessReturnVoid(rc) AssertReleaseMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1830 |
|
---|
1831 | /** @def AssertReleaseRCSuccessBreakStmt
|
---|
1832 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1833 | *
|
---|
1834 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1835 | * and finally the break statement will be issued if the breakpoint is somehow ignored.
|
---|
1836 | *
|
---|
1837 | * @param rc iprt status code.
|
---|
1838 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1839 | * @remark rc is references multiple times.
|
---|
1840 | */
|
---|
1841 | #define AssertReleaseRCSuccessBreakStmt(rc, stmt) AssertReleaseMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1842 |
|
---|
1843 | /** @def AssertReleaseRCSuccessBreakVoid
|
---|
1844 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1845 | *
|
---|
1846 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1847 | * and finally breaking the current statement if the breakpoint is somehow ignored.
|
---|
1848 | *
|
---|
1849 | * @param rc iprt status code.
|
---|
1850 | * @remark rc is references multiple times.
|
---|
1851 | * @todo Rename to AssertReleaseRCSuccessBreak.
|
---|
1852 | */
|
---|
1853 | #define AssertReleaseRCSuccessBreakVoid(rc) AssertReleaseMsgBreakVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1854 |
|
---|
1855 |
|
---|
1856 | /** @def AssertFatalRC
|
---|
1857 | * Asserts a iprt status code successful.
|
---|
1858 | *
|
---|
1859 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1860 | *
|
---|
1861 | * @param rc iprt status code.
|
---|
1862 | * @remark rc is references multiple times.
|
---|
1863 | */
|
---|
1864 | #define AssertFatalRC(rc) AssertFatalMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1865 |
|
---|
1866 | /** @def AssertReleaseMsgRC
|
---|
1867 | * Asserts a iprt status code successful.
|
---|
1868 | *
|
---|
1869 | * On failure a custom message is printed and a breakpoint is hit.
|
---|
1870 | *
|
---|
1871 | * @param rc iprt status code.
|
---|
1872 | * @param msg printf argument list (in parenthesis).
|
---|
1873 | * @remark rc is references multiple times.
|
---|
1874 | */
|
---|
1875 | #define AssertFatalMsgRC(rc, msg) AssertFatalMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1876 |
|
---|
1877 | /** @def AssertFatalRCSuccess
|
---|
1878 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1879 | *
|
---|
1880 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1881 | *
|
---|
1882 | * @param rc iprt status code.
|
---|
1883 | * @remark rc is references multiple times.
|
---|
1884 | */
|
---|
1885 | #define AssertFatalRCSuccess(rc) AssertFatalMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1886 |
|
---|
1887 |
|
---|
1888 | /** @def AssertPtr
|
---|
1889 | * Asserts that a pointer is valid.
|
---|
1890 | *
|
---|
1891 | * @param pv The pointer.
|
---|
1892 | */
|
---|
1893 | #define AssertPtr(pv) AssertMsg(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1894 |
|
---|
1895 | /** @def AssertPtrReturn
|
---|
1896 | * Asserts that a pointer is valid.
|
---|
1897 | *
|
---|
1898 | * @param pv The pointer.
|
---|
1899 | * @param rcRet What is to be presented to return.
|
---|
1900 | */
|
---|
1901 | #define AssertPtrReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv), ("%p\n", (pv)), rcRet)
|
---|
1902 |
|
---|
1903 | /** @def AssertPtrReturnVoid
|
---|
1904 | * Asserts that a pointer is valid.
|
---|
1905 | *
|
---|
1906 | * @param pv The pointer.
|
---|
1907 | */
|
---|
1908 | #define AssertPtrReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1909 |
|
---|
1910 | /** @def AssertPtrBreakStmt
|
---|
1911 | * Asserts that a pointer is valid.
|
---|
1912 | *
|
---|
1913 | * @param pv The pointer.
|
---|
1914 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1915 | */
|
---|
1916 | #define AssertPtrBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv), ("%p\n", (pv)), stmt)
|
---|
1917 |
|
---|
1918 | /** @def AssertPtrBreakVoid
|
---|
1919 | * Asserts that a pointer is valid.
|
---|
1920 | *
|
---|
1921 | * @param pv The pointer.
|
---|
1922 | * @todo Rename to AssertPtrBreak.
|
---|
1923 | */
|
---|
1924 | #define AssertPtrBreakVoid(pv) AssertMsgBreakVoid(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1925 |
|
---|
1926 | /** @def AssertPtrNull
|
---|
1927 | * Asserts that a pointer is valid or NULL.
|
---|
1928 | *
|
---|
1929 | * @param pv The pointer.
|
---|
1930 | */
|
---|
1931 | #define AssertPtrNull(pv) AssertMsg(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1932 |
|
---|
1933 | /** @def AssertPtrNullReturn
|
---|
1934 | * Asserts that a pointer is valid or NULL.
|
---|
1935 | *
|
---|
1936 | * @param pv The pointer.
|
---|
1937 | * @param rcRet What is to be presented to return.
|
---|
1938 | */
|
---|
1939 | #define AssertPtrNullReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), rcRet)
|
---|
1940 |
|
---|
1941 | /** @def AssertPtrNullReturnVoid
|
---|
1942 | * Asserts that a pointer is valid or NULL.
|
---|
1943 | *
|
---|
1944 | * @param pv The pointer.
|
---|
1945 | */
|
---|
1946 | #define AssertPtrNullReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1947 |
|
---|
1948 | /** @def AssertPtrNullBreakStmt
|
---|
1949 | * Asserts that a pointer is valid or NULL.
|
---|
1950 | *
|
---|
1951 | * @param pv The pointer.
|
---|
1952 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1953 | */
|
---|
1954 | #define AssertPtrNullBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), stmt)
|
---|
1955 |
|
---|
1956 | /** @def AssertPtrNullBreakVoid
|
---|
1957 | * Asserts that a pointer is valid or NULL.
|
---|
1958 | *
|
---|
1959 | * @param pv The pointer.
|
---|
1960 | * @todo Rename to AssertPtrNullBreak.
|
---|
1961 | */
|
---|
1962 | #define AssertPtrNullBreakVoid(pv) AssertMsgBreakVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1963 |
|
---|
1964 | /** @def AssertGCPhys32
|
---|
1965 | * Asserts that the high dword of a physical address is zero
|
---|
1966 | *
|
---|
1967 | * @param GCPhys The address (RTGCPHYS).
|
---|
1968 | */
|
---|
1969 | #define AssertGCPhys32(GCPhys) AssertMsg(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
|
---|
1970 |
|
---|
1971 |
|
---|
1972 | /** @} */
|
---|
1973 |
|
---|
1974 | #endif
|
---|
1975 |
|
---|