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 AssertBreak
|
---|
295 | * Assert that an expression is true and breaks if it isn't.
|
---|
296 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
297 | *
|
---|
298 | * @param expr Expression which should be true.
|
---|
299 | */
|
---|
300 | #ifdef RT_STRICT
|
---|
301 | # define AssertBreak(expr) \
|
---|
302 | if (RT_UNLIKELY(!(expr))) \
|
---|
303 | { \
|
---|
304 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
305 | AssertBreakpoint(); \
|
---|
306 | break; \
|
---|
307 | } else do {} while (0)
|
---|
308 | #else
|
---|
309 | # define AssertBreak(expr) \
|
---|
310 | if (RT_UNLIKELY(!(expr))) \
|
---|
311 | break; \
|
---|
312 | else do {} while (0)
|
---|
313 | #endif
|
---|
314 |
|
---|
315 | /** @def AssertBreakStmt
|
---|
316 | * Assert that an expression is true and breaks if it isn't.
|
---|
317 | * In RT_STRICT mode it will hit a breakpoint before doing break.
|
---|
318 | *
|
---|
319 | * @param expr Expression which should be true.
|
---|
320 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
321 | */
|
---|
322 | #ifdef RT_STRICT
|
---|
323 | # define AssertBreakStmt(expr, stmt) \
|
---|
324 | if (RT_UNLIKELY(!(expr))) { \
|
---|
325 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
326 | AssertBreakpoint(); \
|
---|
327 | stmt; \
|
---|
328 | break; \
|
---|
329 | } else do {} while (0)
|
---|
330 | #else
|
---|
331 | # define AssertBreakStmt(expr, stmt) \
|
---|
332 | if (RT_UNLIKELY(!(expr))) { \
|
---|
333 | stmt; \
|
---|
334 | break; \
|
---|
335 | } else do {} while (0)
|
---|
336 | #endif
|
---|
337 |
|
---|
338 |
|
---|
339 | /** @def AssertMsg
|
---|
340 | * Assert that an expression is true. If it's not print message and hit breakpoint.
|
---|
341 | * @param expr Expression which should be true.
|
---|
342 | * @param a printf argument list (in parenthesis).
|
---|
343 | */
|
---|
344 | #ifdef RT_STRICT
|
---|
345 | # define AssertMsg(expr, a) \
|
---|
346 | do { \
|
---|
347 | if (RT_UNLIKELY(!(expr))) \
|
---|
348 | { \
|
---|
349 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
350 | AssertMsg2 a; \
|
---|
351 | AssertBreakpoint(); \
|
---|
352 | } \
|
---|
353 | } while (0)
|
---|
354 | #else
|
---|
355 | # define AssertMsg(expr, a) do { } while (0)
|
---|
356 | #endif
|
---|
357 |
|
---|
358 | /** @def AssertMsgReturn
|
---|
359 | * Assert that an expression is true and returns if it isn't.
|
---|
360 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
361 | *
|
---|
362 | * @param expr Expression which should be true.
|
---|
363 | * @param a printf argument list (in parenthesis).
|
---|
364 | * @param rc What is to be presented to return.
|
---|
365 | */
|
---|
366 | #ifdef RT_STRICT
|
---|
367 | # define AssertMsgReturn(expr, a, rc) \
|
---|
368 | do { \
|
---|
369 | if (RT_UNLIKELY(!(expr))) \
|
---|
370 | { \
|
---|
371 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
372 | AssertMsg2 a; \
|
---|
373 | AssertBreakpoint(); \
|
---|
374 | return (rc); \
|
---|
375 | } \
|
---|
376 | } while (0)
|
---|
377 | #else
|
---|
378 | # define AssertMsgReturn(expr, a, rc) \
|
---|
379 | do { \
|
---|
380 | if (RT_UNLIKELY(!(expr))) \
|
---|
381 | return (rc); \
|
---|
382 | } while (0)
|
---|
383 | #endif
|
---|
384 |
|
---|
385 | /** @def AssertMsgReturnVoid
|
---|
386 | * Assert that an expression is true and returns if it isn't.
|
---|
387 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
388 | *
|
---|
389 | * @param expr Expression which should be true.
|
---|
390 | * @param a printf argument list (in parenthesis).
|
---|
391 | */
|
---|
392 | #ifdef RT_STRICT
|
---|
393 | # define AssertMsgReturnVoid(expr, a) \
|
---|
394 | do { \
|
---|
395 | if (RT_UNLIKELY(!(expr))) \
|
---|
396 | { \
|
---|
397 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
398 | AssertMsg2 a; \
|
---|
399 | AssertBreakpoint(); \
|
---|
400 | return; \
|
---|
401 | } \
|
---|
402 | } while (0)
|
---|
403 | #else
|
---|
404 | # define AssertMsgReturnVoid(expr, a) \
|
---|
405 | do { \
|
---|
406 | if (RT_UNLIKELY(!(expr))) \
|
---|
407 | return; \
|
---|
408 | } while (0)
|
---|
409 | #endif
|
---|
410 |
|
---|
411 |
|
---|
412 | /** @def AssertMsgBreak
|
---|
413 | * Assert that an expression is true and breaks if it isn't.
|
---|
414 | * In RT_STRICT mode it will hit a breakpoint before returning.
|
---|
415 | *
|
---|
416 | * @param expr Expression which should be true.
|
---|
417 | * @param a printf argument list (in parenthesis).
|
---|
418 | */
|
---|
419 | #ifdef RT_STRICT
|
---|
420 | # define AssertMsgBreak(expr, a) \
|
---|
421 | if (RT_UNLIKELY(!(expr))) \
|
---|
422 | { \
|
---|
423 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
424 | AssertMsg2 a; \
|
---|
425 | AssertBreakpoint(); \
|
---|
426 | break; \
|
---|
427 | } else do {} while (0)
|
---|
428 | #else
|
---|
429 | # define AssertMsgBreak(expr, a) \
|
---|
430 | if (RT_UNLIKELY(!(expr))) \
|
---|
431 | break; \
|
---|
432 | else do {} while (0)
|
---|
433 | #endif
|
---|
434 |
|
---|
435 | /** @def AssertMsgBreakStmt
|
---|
436 | * Assert that an expression is true and breaks if it isn't.
|
---|
437 | * In RT_STRICT mode it will hit a breakpoint before doing break.
|
---|
438 | *
|
---|
439 | * @param expr Expression which should be true.
|
---|
440 | * @param a printf argument list (in parenthesis).
|
---|
441 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
442 | */
|
---|
443 | #ifdef RT_STRICT
|
---|
444 | # define AssertMsgBreakStmt(expr, a, stmt) \
|
---|
445 | if (RT_UNLIKELY(!(expr))) { \
|
---|
446 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
447 | AssertMsg2 a; \
|
---|
448 | AssertBreakpoint(); \
|
---|
449 | stmt; \
|
---|
450 | break; \
|
---|
451 | } else do {} while (0)
|
---|
452 | #else
|
---|
453 | # define AssertMsgBreakStmt(expr, a, stmt) \
|
---|
454 | if (RT_UNLIKELY(!(expr))) { \
|
---|
455 | stmt; \
|
---|
456 | break; \
|
---|
457 | } else do {} while (0)
|
---|
458 | #endif
|
---|
459 |
|
---|
460 | /** @def AssertFailed
|
---|
461 | * An assertion failed hit breakpoint.
|
---|
462 | */
|
---|
463 | #ifdef RT_STRICT
|
---|
464 | # define AssertFailed() \
|
---|
465 | do { \
|
---|
466 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
467 | AssertBreakpoint(); \
|
---|
468 | } while (0)
|
---|
469 | #else
|
---|
470 | # define AssertFailed() do { } while (0)
|
---|
471 | #endif
|
---|
472 |
|
---|
473 | /** @def AssertFailedReturn
|
---|
474 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and return.
|
---|
475 | *
|
---|
476 | * @param rc The rc to return.
|
---|
477 | */
|
---|
478 | #ifdef RT_STRICT
|
---|
479 | # define AssertFailedReturn(rc) \
|
---|
480 | do { \
|
---|
481 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
482 | AssertBreakpoint(); \
|
---|
483 | return (rc); \
|
---|
484 | } while (0)
|
---|
485 | #else
|
---|
486 | # define AssertFailedReturn(rc) \
|
---|
487 | do { \
|
---|
488 | return (rc); \
|
---|
489 | } while (0)
|
---|
490 | #endif
|
---|
491 |
|
---|
492 | /** @def AssertFailedReturnVoid
|
---|
493 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and return.
|
---|
494 | */
|
---|
495 | #ifdef RT_STRICT
|
---|
496 | # define AssertFailedReturnVoid() \
|
---|
497 | do { \
|
---|
498 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
499 | AssertBreakpoint(); \
|
---|
500 | return; \
|
---|
501 | } while (0)
|
---|
502 | #else
|
---|
503 | # define AssertFailedReturnVoid() \
|
---|
504 | do { \
|
---|
505 | return; \
|
---|
506 | } while (0)
|
---|
507 | #endif
|
---|
508 |
|
---|
509 |
|
---|
510 | /** @def AssertFailedBreak
|
---|
511 | * An assertion failed, hit breakpoint (RT_STRICT mode only) and break.
|
---|
512 | * @todo Rename to AssertFailedBreak.
|
---|
513 | */
|
---|
514 | #ifdef RT_STRICT
|
---|
515 | # define AssertFailedBreak() \
|
---|
516 | if (1) { \
|
---|
517 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
518 | AssertBreakpoint(); \
|
---|
519 | break; \
|
---|
520 | } else do {} while (0)
|
---|
521 | #else
|
---|
522 | # define AssertFailedBreak() \
|
---|
523 | if (1) \
|
---|
524 | break; \
|
---|
525 | else do {} while (0)
|
---|
526 | #endif
|
---|
527 |
|
---|
528 | /** @def AssertFailedBreakStmt
|
---|
529 | * An assertion failed, hit breakpoint (RT_STRICT mode only), execute
|
---|
530 | * the given statement and break.
|
---|
531 | *
|
---|
532 | * @param stmt Statement to execute before break.
|
---|
533 | */
|
---|
534 | #ifdef RT_STRICT
|
---|
535 | # define AssertFailedBreakStmt(stmt) \
|
---|
536 | if (1) { \
|
---|
537 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
538 | AssertBreakpoint(); \
|
---|
539 | stmt; \
|
---|
540 | break; \
|
---|
541 | } else do {} while (0)
|
---|
542 | #else
|
---|
543 | # define AssertFailedBreakStmt(stmt) \
|
---|
544 | if (1) { \
|
---|
545 | stmt; \
|
---|
546 | break; \
|
---|
547 | } else do {} while (0)
|
---|
548 | #endif
|
---|
549 |
|
---|
550 |
|
---|
551 | /** @def AssertMsgFailed
|
---|
552 | * An assertion failed print a message and a hit breakpoint.
|
---|
553 | *
|
---|
554 | * @param a printf argument list (in parenthesis).
|
---|
555 | */
|
---|
556 | #ifdef RT_STRICT
|
---|
557 | # define AssertMsgFailed(a) \
|
---|
558 | do { \
|
---|
559 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
560 | AssertMsg2 a; \
|
---|
561 | AssertBreakpoint(); \
|
---|
562 | } while (0)
|
---|
563 | #else
|
---|
564 | # define AssertMsgFailed(a) do { } while (0)
|
---|
565 | #endif
|
---|
566 |
|
---|
567 | /** @def AssertMsgFailedReturn
|
---|
568 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and return.
|
---|
569 | *
|
---|
570 | * @param a printf argument list (in parenthesis).
|
---|
571 | * @param rc What is to be presented to return.
|
---|
572 | */
|
---|
573 | #ifdef RT_STRICT
|
---|
574 | # define AssertMsgFailedReturn(a, rc) \
|
---|
575 | do { \
|
---|
576 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
577 | AssertMsg2 a; \
|
---|
578 | AssertBreakpoint(); \
|
---|
579 | return (rc); \
|
---|
580 | } while (0)
|
---|
581 | #else
|
---|
582 | # define AssertMsgFailedReturn(a, rc) \
|
---|
583 | do { \
|
---|
584 | return (rc); \
|
---|
585 | } while (0)
|
---|
586 | #endif
|
---|
587 |
|
---|
588 | /** @def AssertMsgFailedReturnVoid
|
---|
589 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and return.
|
---|
590 | *
|
---|
591 | * @param a printf argument list (in parenthesis).
|
---|
592 | */
|
---|
593 | #ifdef RT_STRICT
|
---|
594 | # define AssertMsgFailedReturnVoid(a) \
|
---|
595 | do { \
|
---|
596 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
597 | AssertMsg2 a; \
|
---|
598 | AssertBreakpoint(); \
|
---|
599 | return; \
|
---|
600 | } while (0)
|
---|
601 | #else
|
---|
602 | # define AssertMsgFailedReturnVoid(a) \
|
---|
603 | do { \
|
---|
604 | return; \
|
---|
605 | } while (0)
|
---|
606 | #endif
|
---|
607 |
|
---|
608 |
|
---|
609 | /** @def AssertMsgFailedBreak
|
---|
610 | * An assertion failed, hit breakpoint with message (RT_STRICT mode only) and break.
|
---|
611 | *
|
---|
612 | * @param a printf argument list (in parenthesis).
|
---|
613 | */
|
---|
614 | #ifdef RT_STRICT
|
---|
615 | # define AssertMsgFailedBreak(a) \
|
---|
616 | if (1) { \
|
---|
617 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
618 | AssertMsg2 a; \
|
---|
619 | AssertBreakpoint(); \
|
---|
620 | break; \
|
---|
621 | } else do {} while (0)
|
---|
622 | #else
|
---|
623 | # define AssertMsgFailedBreak(a) \
|
---|
624 | if (1) \
|
---|
625 | break; \
|
---|
626 | else do {} while (0)
|
---|
627 | #endif
|
---|
628 |
|
---|
629 | /** @def AssertMsgFailedBreakStmt
|
---|
630 | * An assertion failed, hit breakpoint (RT_STRICT mode only), execute
|
---|
631 | * the given statement and break.
|
---|
632 | *
|
---|
633 | * @param a printf argument list (in parenthesis).
|
---|
634 | * @param stmt Statement to execute before break.
|
---|
635 | */
|
---|
636 | #ifdef RT_STRICT
|
---|
637 | # define AssertMsgFailedBreakStmt(a, stmt) \
|
---|
638 | if (1) { \
|
---|
639 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
640 | AssertMsg2 a; \
|
---|
641 | AssertBreakpoint(); \
|
---|
642 | stmt; \
|
---|
643 | break; \
|
---|
644 | } else do {} while (0)
|
---|
645 | #else
|
---|
646 | # define AssertMsgFailedBreakStmt(a, stmt) \
|
---|
647 | if (1) { \
|
---|
648 | stmt; \
|
---|
649 | break; \
|
---|
650 | } else do {} while (0)
|
---|
651 | #endif
|
---|
652 |
|
---|
653 |
|
---|
654 |
|
---|
655 | /** @def AssertLogRelBreakpoint()
|
---|
656 | * Assertion LogRel Breakpoint.
|
---|
657 | *
|
---|
658 | * NOP in non-strict (release) builds, hardware breakpoint in strict builds,
|
---|
659 | *
|
---|
660 | * @remark In the gnu world we add a nop instruction after the int3 to
|
---|
661 | * force gdb to remain at the int3 source line.
|
---|
662 | * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
|
---|
663 | */
|
---|
664 | #ifdef RT_STRICT
|
---|
665 | # ifdef __GNUC__
|
---|
666 | # ifndef __L4ENV__
|
---|
667 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0)
|
---|
668 | # else
|
---|
669 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
|
---|
670 | # endif
|
---|
671 | # elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
672 | # define AssertLogRelBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0)
|
---|
673 | # else
|
---|
674 | # error "Unknown compiler"
|
---|
675 | # endif
|
---|
676 | #else /* !RT_STRICT */
|
---|
677 | # define AssertLogRelBreakpoint() do { } while (0)
|
---|
678 | #endif /* !RT_STRICT */
|
---|
679 |
|
---|
680 |
|
---|
681 | /** @def AssertLogRelMsg1
|
---|
682 | * AssertMsg1 (strict builds) / LogRel wrapper (non-strict).
|
---|
683 | */
|
---|
684 | #ifdef RT_STRICT
|
---|
685 | # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \
|
---|
686 | AssertMsg1(pszExpr, iLine, pszFile, pszFunction)
|
---|
687 | #else
|
---|
688 | # define AssertLogRelMsg1(pszExpr, iLine, pszFile, pszFunction) \
|
---|
689 | LogRel(("AssertLogRel %s(%d): %s\n",\
|
---|
690 | (pszFile), (iLine), (pszFile), (pszFunction), (pszExpr) ))
|
---|
691 | #endif
|
---|
692 |
|
---|
693 | /** @def AssertLogRelMsg2
|
---|
694 | * AssertMsg2 (strict builds) / LogRel wrapper (non-strict).
|
---|
695 | */
|
---|
696 | #ifdef RT_STRICT
|
---|
697 | # define AssertLogRelMsg2(a) AssertMsg2 a
|
---|
698 | #else
|
---|
699 | # define AssertLogRelMsg2(a) LogRel(a)
|
---|
700 | #endif
|
---|
701 |
|
---|
702 | /** @def AssertLogRel
|
---|
703 | * Assert that an expression is true.
|
---|
704 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
705 | *
|
---|
706 | * @param expr Expression which should be true.
|
---|
707 | */
|
---|
708 | #define AssertLogRel(expr) \
|
---|
709 | do { \
|
---|
710 | if (RT_UNLIKELY(!(expr))) \
|
---|
711 | { \
|
---|
712 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
713 | AssertLogRelBreakpoint(); \
|
---|
714 | } \
|
---|
715 | } while (0)
|
---|
716 |
|
---|
717 | /** @def AssertLogRelReturn
|
---|
718 | * Assert that an expression is true, return \a rc if it isn't.
|
---|
719 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
720 | *
|
---|
721 | * @param expr Expression which should be true.
|
---|
722 | * @param rc What is to be presented to return.
|
---|
723 | */
|
---|
724 | #define AssertLogRelReturn(expr, rc) \
|
---|
725 | do { \
|
---|
726 | if (RT_UNLIKELY(!(expr))) \
|
---|
727 | { \
|
---|
728 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
729 | AssertLogRelBreakpoint(); \
|
---|
730 | return (rc); \
|
---|
731 | } \
|
---|
732 | } while (0)
|
---|
733 |
|
---|
734 | /** @def AssertLogRelReturnVoid
|
---|
735 | * Assert that an expression is true, return void if it isn't.
|
---|
736 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
737 | *
|
---|
738 | * @param expr Expression which should be true.
|
---|
739 | */
|
---|
740 | #define AssertLogRelReturnVoid(expr) \
|
---|
741 | do { \
|
---|
742 | if (RT_UNLIKELY(!(expr))) \
|
---|
743 | { \
|
---|
744 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
745 | AssertLogRelBreakpoint(); \
|
---|
746 | return; \
|
---|
747 | } \
|
---|
748 | } while (0)
|
---|
749 |
|
---|
750 | /** @def AssertLogRelBreak
|
---|
751 | * Assert that an expression is true, break if it isn't.
|
---|
752 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
753 | *
|
---|
754 | * @param expr Expression which should be true.
|
---|
755 | */
|
---|
756 | #define AssertLogRelBreak(expr) \
|
---|
757 | if (RT_UNLIKELY(!(expr))) \
|
---|
758 | { \
|
---|
759 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
760 | AssertLogRelBreakpoint(); \
|
---|
761 | break; \
|
---|
762 | } \
|
---|
763 | else do {} while (0)
|
---|
764 |
|
---|
765 | /** @def AssertLogRelBreakStmt
|
---|
766 | * Assert that an expression is true, execute \a stmt and break if it isn't.
|
---|
767 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
768 | *
|
---|
769 | * @param expr Expression which should be true.
|
---|
770 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
771 | */
|
---|
772 | #define AssertLogRelBreakStmt(expr, stmt) \
|
---|
773 | if (RT_UNLIKELY(!(expr))) \
|
---|
774 | { \
|
---|
775 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
776 | AssertLogRelBreakpoint(); \
|
---|
777 | stmt; \
|
---|
778 | break; \
|
---|
779 | } else do {} while (0)
|
---|
780 |
|
---|
781 | /** @def AssertLogRelMsg
|
---|
782 | * Assert that an expression is true.
|
---|
783 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
784 | *
|
---|
785 | * @param expr Expression which should be true.
|
---|
786 | * @param a printf argument list (in parenthesis).
|
---|
787 | */
|
---|
788 | #define AssertLogRelMsg(expr, a) \
|
---|
789 | do { \
|
---|
790 | if (RT_UNLIKELY(!(expr))) \
|
---|
791 | { \
|
---|
792 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
793 | AssertLogRelMsg2(a); \
|
---|
794 | AssertLogRelBreakpoint(); \
|
---|
795 | } \
|
---|
796 | } while (0)
|
---|
797 |
|
---|
798 | /** @def AssertLogRelMsgReturn
|
---|
799 | * Assert that an expression is true, return \a rc if it isn't.
|
---|
800 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
801 | *
|
---|
802 | * @param expr Expression which should be true.
|
---|
803 | * @param a printf argument list (in parenthesis).
|
---|
804 | * @param rc What is to be presented to return.
|
---|
805 | */
|
---|
806 | #define AssertLogRelMsgReturn(expr, a, rc) \
|
---|
807 | do { \
|
---|
808 | if (RT_UNLIKELY(!(expr))) \
|
---|
809 | { \
|
---|
810 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
811 | AssertLogRelMsg2(a); \
|
---|
812 | AssertLogRelBreakpoint(); \
|
---|
813 | return (rc); \
|
---|
814 | } \
|
---|
815 | } while (0)
|
---|
816 |
|
---|
817 | /** @def AssertLogRelMsgReturnVoid
|
---|
818 | * Assert that an expression is true, return (void) if it isn't.
|
---|
819 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
820 | *
|
---|
821 | * @param expr Expression which should be true.
|
---|
822 | * @param a printf argument list (in parenthesis).
|
---|
823 | */
|
---|
824 | #define AssertLogRelMsgReturnVoid(expr, a) \
|
---|
825 | do { \
|
---|
826 | if (RT_UNLIKELY(!(expr))) \
|
---|
827 | { \
|
---|
828 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
829 | AssertLogRelMsg2(a); \
|
---|
830 | AssertLogRelBreakpoint(); \
|
---|
831 | return; \
|
---|
832 | } \
|
---|
833 | } while (0)
|
---|
834 |
|
---|
835 | /** @def AssertLogRelMsgBreak
|
---|
836 | * Assert that an expression is true, break if it isn't.
|
---|
837 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
838 | *
|
---|
839 | * @param expr Expression which should be true.
|
---|
840 | * @param a printf argument list (in parenthesis).
|
---|
841 | */
|
---|
842 | #define AssertLogRelMsgBreak(expr, a) \
|
---|
843 | if (RT_UNLIKELY(!(expr))) \
|
---|
844 | { \
|
---|
845 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
846 | AssertLogRelMsg2(a); \
|
---|
847 | AssertLogRelBreakpoint(); \
|
---|
848 | break; \
|
---|
849 | } \
|
---|
850 | else do {} while (0)
|
---|
851 |
|
---|
852 | /** @def AssertLogRelMsgBreakStmt
|
---|
853 | * Assert that an expression is true, execute \a stmt and break if it isn't.
|
---|
854 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
855 | *
|
---|
856 | * @param expr Expression which should be true.
|
---|
857 | * @param a printf argument list (in parenthesis).
|
---|
858 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
859 | */
|
---|
860 | #define AssertLogRelMsgBreakStmt(expr, a, stmt) \
|
---|
861 | if (RT_UNLIKELY(!(expr))) \
|
---|
862 | { \
|
---|
863 | AssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
864 | AssertLogRelMsg2(a); \
|
---|
865 | AssertLogRelBreakpoint(); \
|
---|
866 | stmt; \
|
---|
867 | break; \
|
---|
868 | } else do {} while (0)
|
---|
869 |
|
---|
870 | /** @def AssertLogRelFailed
|
---|
871 | * An assertion failed.
|
---|
872 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
873 | */
|
---|
874 | #define AssertLogRelFailed() \
|
---|
875 | do { \
|
---|
876 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
877 | AssertLogRelBreakpoint(); \
|
---|
878 | } while (0)
|
---|
879 |
|
---|
880 | /** @def AssertLogRelFailedReturn
|
---|
881 | * An assertion failed.
|
---|
882 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
883 | *
|
---|
884 | * @param rc What is to be presented to return.
|
---|
885 | */
|
---|
886 | #define AssertLogRelFailedReturn(rc) \
|
---|
887 | do { \
|
---|
888 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
889 | AssertLogRelBreakpoint(); \
|
---|
890 | return (rc); \
|
---|
891 | } while (0)
|
---|
892 |
|
---|
893 | /** @def AssertLogRelFailedReturnVoid
|
---|
894 | * An assertion failed, hit a breakpoint and return.
|
---|
895 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
896 | */
|
---|
897 | #define AssertLogRelFailedReturnVoid() \
|
---|
898 | do { \
|
---|
899 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
900 | AssertLogRelBreakpoint(); \
|
---|
901 | return; \
|
---|
902 | } while (0)
|
---|
903 |
|
---|
904 | /** @def AssertLogRelFailedBreak
|
---|
905 | * An assertion failed, break.
|
---|
906 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
907 | */
|
---|
908 | #define AssertLogRelFailedBreak() \
|
---|
909 | if (1) \
|
---|
910 | { \
|
---|
911 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
912 | AssertLogRelBreakpoint(); \
|
---|
913 | break; \
|
---|
914 | } else do {} while (0)
|
---|
915 |
|
---|
916 | /** @def AssertLogRelFailedBreakStmt
|
---|
917 | * An assertion failed, execute \a stmt and break.
|
---|
918 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
919 | *
|
---|
920 | * @param stmt Statement to execute before break.
|
---|
921 | */
|
---|
922 | #define AssertLogRelFailedBreakStmt(stmt) \
|
---|
923 | if (1) \
|
---|
924 | { \
|
---|
925 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
926 | AssertLogRelBreakpoint(); \
|
---|
927 | stmt; \
|
---|
928 | break; \
|
---|
929 | } else do {} while (0)
|
---|
930 |
|
---|
931 | /** @def AssertLogRelMsgFailed
|
---|
932 | * An assertion failed.
|
---|
933 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
934 | *
|
---|
935 | * @param a printf argument list (in parenthesis).
|
---|
936 | */
|
---|
937 | #define AssertLogRelMsgFailed(a) \
|
---|
938 | do { \
|
---|
939 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
940 | AssertLogRelMsg2(a); \
|
---|
941 | AssertLogRelBreakpoint(); \
|
---|
942 | } while (0)
|
---|
943 |
|
---|
944 | /** @def AssertLogRelMsgFailedReturn
|
---|
945 | * An assertion failed, return \a rc.
|
---|
946 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
947 | *
|
---|
948 | * @param a printf argument list (in parenthesis).
|
---|
949 | * @param rc What is to be presented to return.
|
---|
950 | */
|
---|
951 | #define AssertLogRelMsgFailedReturn(a, rc) \
|
---|
952 | do { \
|
---|
953 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
954 | AssertLogRelMsg2(a); \
|
---|
955 | AssertLogRelBreakpoint(); \
|
---|
956 | return (rc); \
|
---|
957 | } while (0)
|
---|
958 |
|
---|
959 | /** @def AssertLogRelMsgFailedReturnVoid
|
---|
960 | * An assertion failed, return void.
|
---|
961 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
962 | *
|
---|
963 | * @param a printf argument list (in parenthesis).
|
---|
964 | */
|
---|
965 | #define AssertLogRelMsgFailedReturnVoid(a) \
|
---|
966 | do { \
|
---|
967 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
968 | AssertLogRelMsg2(a); \
|
---|
969 | AssertLogRelBreakpoint(); \
|
---|
970 | return; \
|
---|
971 | } while (0)
|
---|
972 |
|
---|
973 | /** @def AssertLogRelMsgFailedBreak
|
---|
974 | * An assertion failed, break.
|
---|
975 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
976 | *
|
---|
977 | * @param a printf argument list (in parenthesis).
|
---|
978 | */
|
---|
979 | #define AssertLogRelMsgFailedBreak(a) \
|
---|
980 | if (1)\
|
---|
981 | { \
|
---|
982 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
983 | AssertLogRelMsg2(a); \
|
---|
984 | AssertLogRelBreakpoint(); \
|
---|
985 | break; \
|
---|
986 | } else do {} while (0)
|
---|
987 |
|
---|
988 | /** @def AssertLogRelMsgFailedBreakStmt
|
---|
989 | * An assertion failed, execute \a stmt and break.
|
---|
990 | * Strict builds will hit a breakpoint, non-strict will only do LogRel.
|
---|
991 | *
|
---|
992 | * @param a printf argument list (in parenthesis).
|
---|
993 | * @param stmt Statement to execute before break.
|
---|
994 | */
|
---|
995 | #define AssertLogRelMsgFailedBreakStmt(a, stmt) \
|
---|
996 | if (1) \
|
---|
997 | { \
|
---|
998 | AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
999 | AssertLogRelMsg2(a); \
|
---|
1000 | AssertLogRelBreakpoint(); \
|
---|
1001 | stmt; \
|
---|
1002 | break; \
|
---|
1003 | } else do {} while (0)
|
---|
1004 |
|
---|
1005 |
|
---|
1006 |
|
---|
1007 | /** @def AssertReleaseBreakpoint()
|
---|
1008 | * Assertion Breakpoint.
|
---|
1009 | *
|
---|
1010 | * @remark In the gnu world we add a nop instruction after the int3 to
|
---|
1011 | * force gdb to remain at the int3 source line.
|
---|
1012 | * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
|
---|
1013 | */
|
---|
1014 | #ifdef __GNUC__
|
---|
1015 | # ifndef __L4ENV__
|
---|
1016 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0)
|
---|
1017 | # else
|
---|
1018 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
|
---|
1019 | # endif
|
---|
1020 | #elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
|
---|
1021 | # define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0)
|
---|
1022 | #else
|
---|
1023 | # error "Unknown compiler"
|
---|
1024 | #endif
|
---|
1025 |
|
---|
1026 |
|
---|
1027 | /** @def AssertRelease
|
---|
1028 | * Assert that an expression is true. If it's not hit a breakpoint.
|
---|
1029 | *
|
---|
1030 | * @param expr Expression which should be true.
|
---|
1031 | */
|
---|
1032 | #define AssertRelease(expr) \
|
---|
1033 | do { \
|
---|
1034 | if (RT_UNLIKELY(!(expr))) \
|
---|
1035 | { \
|
---|
1036 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1037 | AssertReleaseBreakpoint(); \
|
---|
1038 | } \
|
---|
1039 | } while (0)
|
---|
1040 |
|
---|
1041 | /** @def AssertReleaseReturn
|
---|
1042 | * Assert that an expression is true, hit a breakpoing and return if it isn't.
|
---|
1043 | *
|
---|
1044 | * @param expr Expression which should be true.
|
---|
1045 | * @param rc What is to be presented to return.
|
---|
1046 | */
|
---|
1047 | #define AssertReleaseReturn(expr, rc) \
|
---|
1048 | do { \
|
---|
1049 | if (RT_UNLIKELY(!(expr))) \
|
---|
1050 | { \
|
---|
1051 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1052 | AssertReleaseBreakpoint(); \
|
---|
1053 | return (rc); \
|
---|
1054 | } \
|
---|
1055 | } while (0)
|
---|
1056 |
|
---|
1057 | /** @def AssertReleaseReturnVoid
|
---|
1058 | * Assert that an expression is true, hit a breakpoing and return if it isn't.
|
---|
1059 | *
|
---|
1060 | * @param expr Expression which should be true.
|
---|
1061 | */
|
---|
1062 | #define AssertReleaseReturnVoid(expr) \
|
---|
1063 | do { \
|
---|
1064 | if (RT_UNLIKELY(!(expr))) \
|
---|
1065 | { \
|
---|
1066 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1067 | AssertReleaseBreakpoint(); \
|
---|
1068 | return; \
|
---|
1069 | } \
|
---|
1070 | } while (0)
|
---|
1071 |
|
---|
1072 |
|
---|
1073 | /** @def AssertReleaseBreak
|
---|
1074 | * Assert that an expression is true, hit a breakpoing and break if it isn't.
|
---|
1075 | *
|
---|
1076 | * @param expr Expression which should be true.
|
---|
1077 | */
|
---|
1078 | #define AssertReleaseBreak(expr) \
|
---|
1079 | if { \
|
---|
1080 | if (RT_UNLIKELY(!(expr))) \
|
---|
1081 | { \
|
---|
1082 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1083 | AssertReleaseBreakpoint(); \
|
---|
1084 | break; \
|
---|
1085 | } \
|
---|
1086 | } else do {} while (0)
|
---|
1087 |
|
---|
1088 | /** @def AssertReleaseBreakStmt
|
---|
1089 | * Assert that an expression is true, hit a breakpoing and break if it isn't.
|
---|
1090 | *
|
---|
1091 | * @param expr Expression which should be true.
|
---|
1092 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1093 | */
|
---|
1094 | #define AssertReleaseBreakStmt(expr, stmt) \
|
---|
1095 | if (RT_UNLIKELY(!(expr))) \
|
---|
1096 | { \
|
---|
1097 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1098 | AssertReleaseBreakpoint(); \
|
---|
1099 | stmt; \
|
---|
1100 | break; \
|
---|
1101 | } else do {} while (0)
|
---|
1102 |
|
---|
1103 |
|
---|
1104 | /** @def AssertReleaseMsg
|
---|
1105 | * Assert that an expression is true, print the message and hit a breakpoint if it isn't.
|
---|
1106 | *
|
---|
1107 | * @param expr Expression which should be true.
|
---|
1108 | * @param a printf argument list (in parenthesis).
|
---|
1109 | */
|
---|
1110 | #define AssertReleaseMsg(expr, a) \
|
---|
1111 | do { \
|
---|
1112 | if (RT_UNLIKELY(!(expr))) \
|
---|
1113 | { \
|
---|
1114 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1115 | AssertMsg2 a; \
|
---|
1116 | AssertReleaseBreakpoint(); \
|
---|
1117 | } \
|
---|
1118 | } while (0)
|
---|
1119 |
|
---|
1120 | /** @def AssertReleaseMsgReturn
|
---|
1121 | * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
|
---|
1122 | *
|
---|
1123 | * @param expr Expression which should be true.
|
---|
1124 | * @param a printf argument list (in parenthesis).
|
---|
1125 | * @param rc What is to be presented to return.
|
---|
1126 | */
|
---|
1127 | #define AssertReleaseMsgReturn(expr, a, rc) \
|
---|
1128 | do { \
|
---|
1129 | if (RT_UNLIKELY(!(expr))) \
|
---|
1130 | { \
|
---|
1131 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1132 | AssertMsg2 a; \
|
---|
1133 | AssertReleaseBreakpoint(); \
|
---|
1134 | return (rc); \
|
---|
1135 | } \
|
---|
1136 | } while (0)
|
---|
1137 |
|
---|
1138 | /** @def AssertReleaseMsgReturnVoid
|
---|
1139 | * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
|
---|
1140 | *
|
---|
1141 | * @param expr Expression which should be true.
|
---|
1142 | * @param a printf argument list (in parenthesis).
|
---|
1143 | */
|
---|
1144 | #define AssertReleaseMsgReturnVoid(expr, a) \
|
---|
1145 | do { \
|
---|
1146 | if (RT_UNLIKELY(!(expr))) \
|
---|
1147 | { \
|
---|
1148 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1149 | AssertMsg2 a; \
|
---|
1150 | AssertReleaseBreakpoint(); \
|
---|
1151 | return; \
|
---|
1152 | } \
|
---|
1153 | } while (0)
|
---|
1154 |
|
---|
1155 |
|
---|
1156 | /** @def AssertReleaseMsgBreak
|
---|
1157 | * Assert that an expression is true, print the message and hit a breakpoint and break if it isn't.
|
---|
1158 | *
|
---|
1159 | * @param expr Expression which should be true.
|
---|
1160 | * @param a printf argument list (in parenthesis).
|
---|
1161 | */
|
---|
1162 | #define AssertReleaseMsgBreak(expr, a) \
|
---|
1163 | if (RT_UNLIKELY(!(expr))) \
|
---|
1164 | { \
|
---|
1165 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1166 | AssertMsg2 a; \
|
---|
1167 | AssertReleaseBreakpoint(); \
|
---|
1168 | break; \
|
---|
1169 | } else do {} while (0)
|
---|
1170 |
|
---|
1171 | /** @def AssertReleaseMsgBreakStmt
|
---|
1172 | * Assert that an expression is true, print the message and hit a breakpoing and break if it isn't.
|
---|
1173 | *
|
---|
1174 | * @param expr Expression which should be true.
|
---|
1175 | * @param a printf argument list (in parenthesis).
|
---|
1176 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1177 | */
|
---|
1178 | #define AssertReleaseMsgBreakStmt(expr, a, stmt) \
|
---|
1179 | if (RT_UNLIKELY(!(expr))) { \
|
---|
1180 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1181 | AssertMsg2 a; \
|
---|
1182 | AssertReleaseBreakpoint(); \
|
---|
1183 | stmt; \
|
---|
1184 | break; \
|
---|
1185 | } else do {} while (0)
|
---|
1186 |
|
---|
1187 |
|
---|
1188 | /** @def AssertReleaseFailed
|
---|
1189 | * An assertion failed, hit a breakpoint.
|
---|
1190 | */
|
---|
1191 | #define AssertReleaseFailed() \
|
---|
1192 | do { \
|
---|
1193 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1194 | AssertReleaseBreakpoint(); \
|
---|
1195 | } while (0)
|
---|
1196 |
|
---|
1197 | /** @def AssertReleaseFailedReturn
|
---|
1198 | * An assertion failed, hit a breakpoint and return.
|
---|
1199 | *
|
---|
1200 | * @param rc What is to be presented to return.
|
---|
1201 | */
|
---|
1202 | #define AssertReleaseFailedReturn(rc) \
|
---|
1203 | do { \
|
---|
1204 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1205 | AssertReleaseBreakpoint(); \
|
---|
1206 | return (rc); \
|
---|
1207 | } while (0)
|
---|
1208 |
|
---|
1209 | /** @def AssertReleaseFailedReturnVoid
|
---|
1210 | * An assertion failed, hit a breakpoint and return.
|
---|
1211 | */
|
---|
1212 | #define AssertReleaseFailedReturnVoid() \
|
---|
1213 | do { \
|
---|
1214 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1215 | AssertReleaseBreakpoint(); \
|
---|
1216 | return; \
|
---|
1217 | } while (0)
|
---|
1218 |
|
---|
1219 |
|
---|
1220 | /** @def AssertReleaseFailedBreakStmt
|
---|
1221 | * An assertion failed, hit a breakpoint and break.
|
---|
1222 | *
|
---|
1223 | * @param stmt Statement to execute before break.
|
---|
1224 | */
|
---|
1225 | #define AssertReleaseFailedBreakStmt(stmt) \
|
---|
1226 | if (1) { \
|
---|
1227 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1228 | AssertReleaseBreakpoint(); \
|
---|
1229 | stmt; \
|
---|
1230 | break; \
|
---|
1231 | } else do {} while (0)
|
---|
1232 |
|
---|
1233 | /** @def AssertReleaseFailedBreakVoid
|
---|
1234 | * An assertion failed, hit a breakpoint and break.
|
---|
1235 | * @todo Rename to AssertReleaseFailedBreak.
|
---|
1236 | * @todo broken, should use 'if' instead of 'do'.
|
---|
1237 | */
|
---|
1238 | #define AssertReleaseFailedBreakVoid() \
|
---|
1239 | if (1) { \
|
---|
1240 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1241 | AssertReleaseBreakpoint(); \
|
---|
1242 | break; \
|
---|
1243 | } else do {} while (0)
|
---|
1244 |
|
---|
1245 |
|
---|
1246 | /** @def AssertReleaseMsgFailed
|
---|
1247 | * An assertion failed, print a message and hit a breakpoint.
|
---|
1248 | *
|
---|
1249 | * @param a printf argument list (in parenthesis).
|
---|
1250 | */
|
---|
1251 | #define AssertReleaseMsgFailed(a) \
|
---|
1252 | do { \
|
---|
1253 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1254 | AssertMsg2 a; \
|
---|
1255 | AssertReleaseBreakpoint(); \
|
---|
1256 | } while (0)
|
---|
1257 |
|
---|
1258 | /** @def AssertReleaseMsgFailedReturn
|
---|
1259 | * An assertion failed, print a message, hit a breakpoint and return.
|
---|
1260 | *
|
---|
1261 | * @param a printf argument list (in parenthesis).
|
---|
1262 | * @param rc What is to be presented to return.
|
---|
1263 | */
|
---|
1264 | #define AssertReleaseMsgFailedReturn(a, rc) \
|
---|
1265 | do { \
|
---|
1266 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1267 | AssertMsg2 a; \
|
---|
1268 | AssertReleaseBreakpoint(); \
|
---|
1269 | return (rc); \
|
---|
1270 | } while (0)
|
---|
1271 |
|
---|
1272 | /** @def AssertReleaseMsgFailedReturnVoid
|
---|
1273 | * An assertion failed, print a message, hit a breakpoint and return.
|
---|
1274 | *
|
---|
1275 | * @param a printf argument list (in parenthesis).
|
---|
1276 | */
|
---|
1277 | #define AssertReleaseMsgFailedReturnVoid(a) \
|
---|
1278 | do { \
|
---|
1279 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1280 | AssertMsg2 a; \
|
---|
1281 | AssertReleaseBreakpoint(); \
|
---|
1282 | return; \
|
---|
1283 | } while (0)
|
---|
1284 |
|
---|
1285 |
|
---|
1286 | /** @def AssertReleaseMsgFailedBreakStmt
|
---|
1287 | * An assertion failed, print a message, hit a breakpoint and break.
|
---|
1288 | *
|
---|
1289 | * @param a printf argument list (in parenthesis).
|
---|
1290 | * @param stmt Statement to execute before break.
|
---|
1291 | */
|
---|
1292 | #define AssertReleaseMsgFailedBreakStmt(a, stmt) \
|
---|
1293 | if (1) { \
|
---|
1294 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1295 | AssertMsg2 a; \
|
---|
1296 | AssertReleaseBreakpoint(); \
|
---|
1297 | stmt; \
|
---|
1298 | break; \
|
---|
1299 | } else do {} while (0)
|
---|
1300 |
|
---|
1301 | /** @def AssertReleaseMsgFailedBreakVoid
|
---|
1302 | * An assertion failed, print a message, hit a breakpoint and break.
|
---|
1303 | *
|
---|
1304 | * @param a printf argument list (in parenthesis).
|
---|
1305 | * @todo Rename to AssertReleaseMsgFailedBreak.
|
---|
1306 | * @todo broken
|
---|
1307 | */
|
---|
1308 | #define AssertReleaseMsgFailedBreakVoid(a) \
|
---|
1309 | if (1) { \
|
---|
1310 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1311 | AssertMsg2 a; \
|
---|
1312 | AssertReleaseBreakpoint(); \
|
---|
1313 | break; \
|
---|
1314 | } else do {} while (0)
|
---|
1315 |
|
---|
1316 |
|
---|
1317 | /** @def AssertFatal
|
---|
1318 | * Assert that an expression is true. If it's not hit a breakpoint (for ever).
|
---|
1319 | *
|
---|
1320 | * @param expr Expression which should be true.
|
---|
1321 | */
|
---|
1322 | #define AssertFatal(expr) \
|
---|
1323 | do { \
|
---|
1324 | if (RT_UNLIKELY(!(expr))) \
|
---|
1325 | for (;;) \
|
---|
1326 | { \
|
---|
1327 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1328 | AssertReleaseBreakpoint(); \
|
---|
1329 | } \
|
---|
1330 | } while (0)
|
---|
1331 |
|
---|
1332 | /** @def AssertFatalMsg
|
---|
1333 | * Assert that an expression is true, print the message and hit a breakpoint (for ever) if it isn't.
|
---|
1334 | *
|
---|
1335 | * @param expr Expression which should be true.
|
---|
1336 | * @param a printf argument list (in parenthesis).
|
---|
1337 | */
|
---|
1338 | #define AssertFatalMsg(expr, a) \
|
---|
1339 | do { \
|
---|
1340 | if (RT_UNLIKELY(!(expr))) \
|
---|
1341 | for (;;) \
|
---|
1342 | { \
|
---|
1343 | AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1344 | AssertMsg2 a; \
|
---|
1345 | AssertReleaseBreakpoint(); \
|
---|
1346 | } \
|
---|
1347 | } while (0)
|
---|
1348 |
|
---|
1349 | /** @def AssertFatalFailed
|
---|
1350 | * An assertion failed, hit a breakpoint (for ever).
|
---|
1351 | */
|
---|
1352 | #define AssertFatalFailed() \
|
---|
1353 | do { \
|
---|
1354 | for (;;) \
|
---|
1355 | { \
|
---|
1356 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1357 | AssertReleaseBreakpoint(); \
|
---|
1358 | } \
|
---|
1359 | } while (0)
|
---|
1360 |
|
---|
1361 | /** @def AssertFatalMsgFailed
|
---|
1362 | * An assertion failed, print a message and hit a breakpoint (for ever).
|
---|
1363 | *
|
---|
1364 | * @param a printf argument list (in parenthesis).
|
---|
1365 | */
|
---|
1366 | #define AssertFatalMsgFailed(a) \
|
---|
1367 | do { \
|
---|
1368 | for (;;) \
|
---|
1369 | { \
|
---|
1370 | AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
1371 | AssertMsg2 a; \
|
---|
1372 | AssertReleaseBreakpoint(); \
|
---|
1373 | } \
|
---|
1374 | } while (0)
|
---|
1375 |
|
---|
1376 |
|
---|
1377 | /** @def AssertRC
|
---|
1378 | * Asserts a iprt status code successful.
|
---|
1379 | *
|
---|
1380 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1381 | *
|
---|
1382 | * @param rc iprt status code.
|
---|
1383 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1384 | */
|
---|
1385 | #define AssertRC(rc) AssertMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1386 |
|
---|
1387 | /** @def AssertRCReturn
|
---|
1388 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1389 | *
|
---|
1390 | * @param rc iprt status code.
|
---|
1391 | * @param rcRet What is to be presented to return.
|
---|
1392 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1393 | */
|
---|
1394 | #define AssertRCReturn(rc, rcRet) AssertMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
|
---|
1395 |
|
---|
1396 | /** @def AssertRCReturnVoid
|
---|
1397 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1398 | *
|
---|
1399 | * @param rc iprt status code.
|
---|
1400 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1401 | */
|
---|
1402 | #define AssertRCReturnVoid(rc) AssertMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
|
---|
1403 |
|
---|
1404 | /** @def AssertRCBreakStmt
|
---|
1405 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1406 | *
|
---|
1407 | * @param rc iprt status code.
|
---|
1408 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1409 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1410 | */
|
---|
1411 | #define AssertRCBreakStmt(rc, stmt) AssertMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
|
---|
1412 |
|
---|
1413 | /** @def AssertRCBreakVoid
|
---|
1414 | * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1415 | *
|
---|
1416 | * @param rc iprt status code.
|
---|
1417 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1418 | * @todo Rename to AssertRCBreak.
|
---|
1419 | */
|
---|
1420 | #define AssertRCBreakVoid(rc) AssertMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
|
---|
1421 |
|
---|
1422 | /** @def AssertMsgRC
|
---|
1423 | * Asserts a iprt status code successful.
|
---|
1424 | *
|
---|
1425 | * It prints a custom message and hits a breakpoint on FAILURE.
|
---|
1426 | *
|
---|
1427 | * @param rc iprt status code.
|
---|
1428 | * @param msg printf argument list (in parenthesis).
|
---|
1429 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1430 | */
|
---|
1431 | #define AssertMsgRC(rc, msg) \
|
---|
1432 | do { AssertMsg(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1433 |
|
---|
1434 | /** @def AssertMsgRCReturn
|
---|
1435 | * Asserts a iprt status code successful and if it's not return the specified status code.
|
---|
1436 | *
|
---|
1437 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1438 | *
|
---|
1439 | * @param rc iprt status code.
|
---|
1440 | * @param msg printf argument list (in parenthesis).
|
---|
1441 | * @param rcRet What is to be presented to return.
|
---|
1442 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1443 | */
|
---|
1444 | #define AssertMsgRCReturn(rc, msg, rcRet) \
|
---|
1445 | do { AssertMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
|
---|
1446 |
|
---|
1447 | /** @def AssertMsgRCReturnVoid
|
---|
1448 | * Asserts a iprt status code successful and if it's not return.
|
---|
1449 | *
|
---|
1450 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1451 | *
|
---|
1452 | * @param rc iprt status code.
|
---|
1453 | * @param msg printf argument list (in parenthesis).
|
---|
1454 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1455 | */
|
---|
1456 | #define AssertMsgRCReturnVoid(rc, msg) \
|
---|
1457 | do { AssertMsgReturnVoid(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
|
---|
1458 |
|
---|
1459 | /** @def AssertMsgRCBreakStmt
|
---|
1460 | * Asserts a iprt status code successful and break if it's not.
|
---|
1461 | *
|
---|
1462 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
|
---|
1463 | *
|
---|
1464 | * @param rc iprt status code.
|
---|
1465 | * @param msg printf argument list (in parenthesis).
|
---|
1466 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1467 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1468 | */
|
---|
1469 | #define AssertMsgRCBreakStmt(rc, msg, stmt) \
|
---|
1470 | if (1) { AssertMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)
|
---|
1471 |
|
---|
1472 | /** @def AssertMsgRCBreakVoid
|
---|
1473 | * Asserts a iprt status code successful and if it's not break.
|
---|
1474 | *
|
---|
1475 | * If RT_STRICT is defined the message will be printed and a breakpoint hit before it breaks
|
---|
1476 | *
|
---|
1477 | * @param rc iprt status code.
|
---|
1478 | * @param msg printf argument list (in parenthesis).
|
---|
1479 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1480 | * @todo Rename to AssertMsgRCBreak.
|
---|
1481 | */
|
---|
1482 | #define AssertMsgRCBreakVoid(rc, msg) \
|
---|
1483 | if (1) { AssertMsgBreak(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)
|
---|
1484 |
|
---|
1485 | /** @def AssertRCSuccess
|
---|
1486 | * Asserts an iprt status code equals VINF_SUCCESS.
|
---|
1487 | *
|
---|
1488 | * On failure it will print info about the rc and hit a breakpoint.
|
---|
1489 | *
|
---|
1490 | * @param rc iprt status code.
|
---|
1491 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1492 | */
|
---|
1493 | #define AssertRCSuccess(rc) AssertMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1494 |
|
---|
1495 | /** @def AssertRCSuccessReturn
|
---|
1496 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1497 | *
|
---|
1498 | * @param rc iprt status code.
|
---|
1499 | * @param rcRet What is to be presented to return.
|
---|
1500 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1501 | */
|
---|
1502 | #define AssertRCSuccessReturn(rc, rcRet) AssertMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
|
---|
1503 |
|
---|
1504 | /** @def AssertRCSuccessReturnVoid
|
---|
1505 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
|
---|
1506 | *
|
---|
1507 | * @param rc iprt status code.
|
---|
1508 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1509 | */
|
---|
1510 | #define AssertRCSuccessReturnVoid(rc) AssertMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1511 |
|
---|
1512 | /** @def AssertRCSuccessBreakStmt
|
---|
1513 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1514 | *
|
---|
1515 | * @param rc iprt status code.
|
---|
1516 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1517 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1518 | */
|
---|
1519 | #define AssertRCSuccessBreakStmt(rc, stmt) AssertMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1520 |
|
---|
1521 | /** @def AssertRCSuccessBreakVoid
|
---|
1522 | * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
|
---|
1523 | *
|
---|
1524 | * @param rc iprt status code.
|
---|
1525 | * @remark rc is references multiple times. In release mode is NOREF()'ed.
|
---|
1526 | * @todo Rename to AssertRCSuccessBreak.
|
---|
1527 | */
|
---|
1528 | #define AssertRCSuccessBreakVoid(rc) AssertMsgBreak((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1529 |
|
---|
1530 |
|
---|
1531 | /** @def AssertLogRelRC
|
---|
1532 | * Asserts a iprt status code successful.
|
---|
1533 | *
|
---|
1534 | * @param rc iprt status code.
|
---|
1535 | * @remark rc is references multiple times.
|
---|
1536 | */
|
---|
1537 | #define AssertLogRelRC(rc) AssertLogRelMsgRC(rc, ("%Rra\n", (rc)))
|
---|
1538 |
|
---|
1539 | /** @def AssertLogRelRCReturn
|
---|
1540 | * Asserts a iprt status code successful, returning \a rc if it isn't.
|
---|
1541 | *
|
---|
1542 | * @param rc iprt status code.
|
---|
1543 | * @param rcRet What is to be presented to return.
|
---|
1544 | * @remark rc is references multiple times.
|
---|
1545 | */
|
---|
1546 | #define AssertLogRelRCReturn(rc, rcRet) AssertLogRelMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)
|
---|
1547 |
|
---|
1548 | /** @def AssertLogRelRCReturnVoid
|
---|
1549 | * Asserts a iprt status code successful, returning (void) if it isn't.
|
---|
1550 | *
|
---|
1551 | * @param rc iprt status code.
|
---|
1552 | * @remark rc is references multiple times.
|
---|
1553 | */
|
---|
1554 | #define AssertLogRelRCReturnVoid(rc) AssertLogRelMsgRCReturnVoid(rc, ("%Rra\n", (rc)))
|
---|
1555 |
|
---|
1556 | /** @def AssertLogRelRCBreak
|
---|
1557 | * Asserts a iprt status code successful, breaking if it isn't.
|
---|
1558 | *
|
---|
1559 | * @param rc iprt status code.
|
---|
1560 | * @remark rc is references multiple times.
|
---|
1561 | */
|
---|
1562 | #define AssertLogRelRCBreak(rc) AssertLogRelMsgRCBreak(rc, ("%Rra\n", (rc)))
|
---|
1563 |
|
---|
1564 | /** @def AssertLogRelRCBreakStmt
|
---|
1565 | * Asserts a iprt status code successful, execute \a statement and break if it isn't.
|
---|
1566 | *
|
---|
1567 | * @param rc iprt status code.
|
---|
1568 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1569 | * @remark rc is references multiple times.
|
---|
1570 | */
|
---|
1571 | #define AssertLogRelRCBreakStmt(rc, stmt) AssertLogRelMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt)
|
---|
1572 |
|
---|
1573 | /** @def AssertLogRelMsgRC
|
---|
1574 | * Asserts a iprt status code successful.
|
---|
1575 | *
|
---|
1576 | * @param rc iprt status code.
|
---|
1577 | * @param msg printf argument list (in parenthesis).
|
---|
1578 | * @remark rc is references multiple times.
|
---|
1579 | */
|
---|
1580 | #define AssertLogRelMsgRC(rc, msg) AssertLogRelMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1581 |
|
---|
1582 | /** @def AssertLogRelMsgRCReturn
|
---|
1583 | * Asserts a iprt status code successful.
|
---|
1584 | *
|
---|
1585 | * @param rc iprt status code.
|
---|
1586 | * @param msg printf argument list (in parenthesis).
|
---|
1587 | * @param rcRet What is to be presented to return.
|
---|
1588 | * @remark rc is references multiple times.
|
---|
1589 | */
|
---|
1590 | #define AssertLogRelMsgRCReturn(rc, msg, rcRet) AssertLogRelMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
|
---|
1591 |
|
---|
1592 | /** @def AssertLogRelMsgRCReturnVoid
|
---|
1593 | * Asserts a iprt status code successful.
|
---|
1594 | *
|
---|
1595 | * @param rc iprt status code.
|
---|
1596 | * @param msg printf argument list (in parenthesis).
|
---|
1597 | * @remark rc is references multiple times.
|
---|
1598 | */
|
---|
1599 | #define AssertLogRelMsgRCReturnVoid(rc, msg) AssertLogRelMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
|
---|
1600 |
|
---|
1601 | /** @def AssertLogRelMsgRCBreak
|
---|
1602 | * Asserts a iprt status code successful.
|
---|
1603 | *
|
---|
1604 | * @param rc iprt status code.
|
---|
1605 | * @param msg printf argument list (in parenthesis).
|
---|
1606 | * @remark rc is references multiple times.
|
---|
1607 | */
|
---|
1608 | #define AssertLogRelMsgRCBreak(rc, msg) AssertLogRelMsgBreak(RT_SUCCESS(rc), msg)
|
---|
1609 |
|
---|
1610 | /** @def AssertLogRelMsgRCBreakStmt
|
---|
1611 | * Asserts a iprt status code successful, execute \a stmt and break if it isn't.
|
---|
1612 | *
|
---|
1613 | * @param rc iprt status code.
|
---|
1614 | * @param msg printf argument list (in parenthesis).
|
---|
1615 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1616 | * @remark rc is references multiple times.
|
---|
1617 | */
|
---|
1618 | #define AssertLogRelMsgRCBreakStmt(rc, msg, stmt) AssertLogRelMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
|
---|
1619 |
|
---|
1620 | /** @def AssertLogRelRCSuccess
|
---|
1621 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1622 | *
|
---|
1623 | * @param rc iprt status code.
|
---|
1624 | * @remark rc is references multiple times.
|
---|
1625 | */
|
---|
1626 | #define AssertLogRelRCSuccess(rc) AssertLogRelMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1627 |
|
---|
1628 | /** @def AssertLogRelRCSuccessReturn
|
---|
1629 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1630 | *
|
---|
1631 | * @param rc iprt status code.
|
---|
1632 | * @param rcRet What is to be presented to return.
|
---|
1633 | * @remark rc is references multiple times.
|
---|
1634 | */
|
---|
1635 | #define AssertLogRelRCSuccessReturn(rc, rcRet) AssertLogRelMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
|
---|
1636 |
|
---|
1637 | /** @def AssertLogRelRCSuccessReturnVoid
|
---|
1638 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1639 | *
|
---|
1640 | * @param rc iprt status code.
|
---|
1641 | * @remark rc is references multiple times.
|
---|
1642 | */
|
---|
1643 | #define AssertLogRelRCSuccessReturnVoid(rc) AssertLogRelMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
|
---|
1644 |
|
---|
1645 | /** @def AssertLogRelRCSuccessBreak
|
---|
1646 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1647 | *
|
---|
1648 | * @param rc iprt status code.
|
---|
1649 | * @remark rc is references multiple times.
|
---|
1650 | */
|
---|
1651 | #define AssertLogRelRCSuccessBreak(rc) AssertLogRelMsgBreak((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1652 |
|
---|
1653 | /** @def AssertLogRelRCSuccessBreakStmt
|
---|
1654 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1655 | *
|
---|
1656 | * @param rc iprt status code.
|
---|
1657 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1658 | * @remark rc is references multiple times.
|
---|
1659 | */
|
---|
1660 | #define AssertLogRelRCSuccessBreakStmt(rc, stmt) AssertLogRelMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1661 |
|
---|
1662 |
|
---|
1663 | /** @def AssertReleaseRC
|
---|
1664 | * Asserts a iprt status code successful.
|
---|
1665 | *
|
---|
1666 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1667 | *
|
---|
1668 | * @param rc iprt status code.
|
---|
1669 | * @remark rc is references multiple times.
|
---|
1670 | */
|
---|
1671 | #define AssertReleaseRC(rc) AssertReleaseMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1672 |
|
---|
1673 | /** @def AssertReleaseRCReturn
|
---|
1674 | * Asserts a iprt status code successful, returning if it isn't.
|
---|
1675 | *
|
---|
1676 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1677 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1678 | *
|
---|
1679 | * @param rc iprt status code.
|
---|
1680 | * @param rcRet What is to be presented to return.
|
---|
1681 | * @remark rc is references multiple times.
|
---|
1682 | */
|
---|
1683 | #define AssertReleaseRCReturn(rc, rcRet) AssertReleaseMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
|
---|
1684 |
|
---|
1685 | /** @def AssertReleaseRCReturnVoid
|
---|
1686 | * Asserts a iprt status code successful, returning if it isn't.
|
---|
1687 | *
|
---|
1688 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1689 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1690 | *
|
---|
1691 | * @param rc iprt status code.
|
---|
1692 | * @remark rc is references multiple times.
|
---|
1693 | */
|
---|
1694 | #define AssertReleaseRCReturnVoid(rc) AssertReleaseMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
|
---|
1695 |
|
---|
1696 | /** @def AssertReleaseRCBreakStmt
|
---|
1697 | * Asserts a iprt status code successful, break if it isn't.
|
---|
1698 | *
|
---|
1699 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1700 | * and finally the break statement will be issued if the breakpoint is somehow ignored.
|
---|
1701 | *
|
---|
1702 | * @param rc iprt status code.
|
---|
1703 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1704 | * @remark rc is references multiple times.
|
---|
1705 | */
|
---|
1706 | #define AssertReleaseRCBreakStmt(rc, stmt) AssertReleaseMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
|
---|
1707 |
|
---|
1708 | /** @def AssertReleaseRCBreakVoid
|
---|
1709 | * Asserts a iprt status code successful, breaking if it isn't.
|
---|
1710 | *
|
---|
1711 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1712 | * and finally breaking the current statement if the breakpoint is somehow ignored.
|
---|
1713 | *
|
---|
1714 | * @param rc iprt status code.
|
---|
1715 | * @remark rc is references multiple times.
|
---|
1716 | * @todo Rename to AssertReleaseRCBreak.
|
---|
1717 | */
|
---|
1718 | #define AssertReleaseRCBreakVoid(rc) AssertReleaseMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
|
---|
1719 |
|
---|
1720 | /** @def AssertReleaseMsgRC
|
---|
1721 | * Asserts a iprt status code successful.
|
---|
1722 | *
|
---|
1723 | * On failure a custom message is printed and a breakpoint is hit.
|
---|
1724 | *
|
---|
1725 | * @param rc iprt status code.
|
---|
1726 | * @param msg printf argument list (in parenthesis).
|
---|
1727 | * @remark rc is references multiple times.
|
---|
1728 | */
|
---|
1729 | #define AssertReleaseMsgRC(rc, msg) AssertReleaseMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1730 |
|
---|
1731 | /** @def AssertReleaseMsgRCReturn
|
---|
1732 | * Asserts a iprt status code successful.
|
---|
1733 | *
|
---|
1734 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1735 | * returning from the function if the breakpoint is showhow ignored.
|
---|
1736 | *
|
---|
1737 | * @param rc iprt status code.
|
---|
1738 | * @param msg printf argument list (in parenthesis).
|
---|
1739 | * @param rcRet What is to be presented to return.
|
---|
1740 | * @remark rc is references multiple times.
|
---|
1741 | */
|
---|
1742 | #define AssertReleaseMsgRCReturn(rc, msg, rcRet) AssertReleaseMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
|
---|
1743 |
|
---|
1744 | /** @def AssertReleaseMsgRCReturnVoid
|
---|
1745 | * Asserts a iprt status code successful.
|
---|
1746 | *
|
---|
1747 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1748 | * returning from the function if the breakpoint is showhow ignored.
|
---|
1749 | *
|
---|
1750 | * @param rc iprt status code.
|
---|
1751 | * @param msg printf argument list (in parenthesis).
|
---|
1752 | * @remark rc is references multiple times.
|
---|
1753 | */
|
---|
1754 | #define AssertReleaseMsgRCReturnVoid(rc, msg) AssertReleaseMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
|
---|
1755 |
|
---|
1756 | /** @def AssertReleaseMsgRCBreakStmt
|
---|
1757 | * Asserts a iprt status code successful.
|
---|
1758 | *
|
---|
1759 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1760 | * the brean statement is issued if the breakpoint is showhow ignored.
|
---|
1761 | *
|
---|
1762 | * @param rc iprt status code.
|
---|
1763 | * @param msg printf argument list (in parenthesis).
|
---|
1764 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1765 | * @remark rc is references multiple times.
|
---|
1766 | */
|
---|
1767 | #define AssertReleaseMsgRCBreakStmt(rc, msg, stmt) AssertReleaseMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
|
---|
1768 |
|
---|
1769 | /** @def AssertReleaseMsgRCBreakVoid
|
---|
1770 | * Asserts a iprt status code successful.
|
---|
1771 | *
|
---|
1772 | * On failure a custom message is printed, a breakpoint is hit, and finally
|
---|
1773 | * breaking the current status if the breakpoint is showhow ignored.
|
---|
1774 | *
|
---|
1775 | * @param rc iprt status code.
|
---|
1776 | * @param msg printf argument list (in parenthesis).
|
---|
1777 | * @remark rc is references multiple times.
|
---|
1778 | * @todo Rename to AssertReleaseMsgRCBreak.
|
---|
1779 | */
|
---|
1780 | #define AssertReleaseMsgRCBreakVoid(rc, msg) AssertReleaseMsgBreak(RT_SUCCESS(rc), msg)
|
---|
1781 |
|
---|
1782 | /** @def AssertReleaseRCSuccess
|
---|
1783 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1784 | *
|
---|
1785 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1786 | *
|
---|
1787 | * @param rc iprt status code.
|
---|
1788 | * @remark rc is references multiple times.
|
---|
1789 | */
|
---|
1790 | #define AssertReleaseRCSuccess(rc) AssertReleaseMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1791 |
|
---|
1792 | /** @def AssertReleaseRCSuccessReturn
|
---|
1793 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1794 | *
|
---|
1795 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1796 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1797 | *
|
---|
1798 | * @param rc iprt status code.
|
---|
1799 | * @param rcRet What is to be presented to return.
|
---|
1800 | * @remark rc is references multiple times.
|
---|
1801 | */
|
---|
1802 | #define AssertReleaseRCSuccessReturn(rc, rcRet) AssertReleaseMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
|
---|
1803 |
|
---|
1804 | /** @def AssertReleaseRCSuccessReturnVoid
|
---|
1805 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1806 | *
|
---|
1807 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1808 | * and finally returning from the function if the breakpoint is somehow ignored.
|
---|
1809 | *
|
---|
1810 | * @param rc iprt status code.
|
---|
1811 | * @remark rc is references multiple times.
|
---|
1812 | */
|
---|
1813 | #define AssertReleaseRCSuccessReturnVoid(rc) AssertReleaseMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1814 |
|
---|
1815 | /** @def AssertReleaseRCSuccessBreakStmt
|
---|
1816 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1817 | *
|
---|
1818 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1819 | * and finally the break statement will be issued if the breakpoint is somehow ignored.
|
---|
1820 | *
|
---|
1821 | * @param rc iprt status code.
|
---|
1822 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1823 | * @remark rc is references multiple times.
|
---|
1824 | */
|
---|
1825 | #define AssertReleaseRCSuccessBreakStmt(rc, stmt) AssertReleaseMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
|
---|
1826 |
|
---|
1827 | /** @def AssertReleaseRCSuccessBreakVoid
|
---|
1828 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1829 | *
|
---|
1830 | * On failure information about the error will be printed, a breakpoint hit
|
---|
1831 | * and finally breaking the current statement if the breakpoint is somehow ignored.
|
---|
1832 | *
|
---|
1833 | * @param rc iprt status code.
|
---|
1834 | * @remark rc is references multiple times.
|
---|
1835 | * @todo Rename to AssertReleaseRCSuccessBreak.
|
---|
1836 | */
|
---|
1837 | #define AssertReleaseRCSuccessBreakVoid(rc) AssertReleaseMsgBreak((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1838 |
|
---|
1839 |
|
---|
1840 | /** @def AssertFatalRC
|
---|
1841 | * Asserts a iprt status code successful.
|
---|
1842 | *
|
---|
1843 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1844 | *
|
---|
1845 | * @param rc iprt status code.
|
---|
1846 | * @remark rc is references multiple times.
|
---|
1847 | */
|
---|
1848 | #define AssertFatalRC(rc) AssertFatalMsgRC(rc, ("%Vra\n", (rc)))
|
---|
1849 |
|
---|
1850 | /** @def AssertReleaseMsgRC
|
---|
1851 | * Asserts a iprt status code successful.
|
---|
1852 | *
|
---|
1853 | * On failure a custom message is printed and a breakpoint is hit.
|
---|
1854 | *
|
---|
1855 | * @param rc iprt status code.
|
---|
1856 | * @param msg printf argument list (in parenthesis).
|
---|
1857 | * @remark rc is references multiple times.
|
---|
1858 | */
|
---|
1859 | #define AssertFatalMsgRC(rc, msg) AssertFatalMsg(RT_SUCCESS_NP(rc), msg)
|
---|
1860 |
|
---|
1861 | /** @def AssertFatalRCSuccess
|
---|
1862 | * Asserts that an iprt status code equals VINF_SUCCESS.
|
---|
1863 | *
|
---|
1864 | * On failure information about the error will be printed and a breakpoint hit.
|
---|
1865 | *
|
---|
1866 | * @param rc iprt status code.
|
---|
1867 | * @remark rc is references multiple times.
|
---|
1868 | */
|
---|
1869 | #define AssertFatalRCSuccess(rc) AssertFatalMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
|
---|
1870 |
|
---|
1871 |
|
---|
1872 | /** @def AssertPtr
|
---|
1873 | * Asserts that a pointer is valid.
|
---|
1874 | *
|
---|
1875 | * @param pv The pointer.
|
---|
1876 | */
|
---|
1877 | #define AssertPtr(pv) AssertMsg(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1878 |
|
---|
1879 | /** @def AssertPtrReturn
|
---|
1880 | * Asserts that a pointer is valid.
|
---|
1881 | *
|
---|
1882 | * @param pv The pointer.
|
---|
1883 | * @param rcRet What is to be presented to return.
|
---|
1884 | */
|
---|
1885 | #define AssertPtrReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv), ("%p\n", (pv)), rcRet)
|
---|
1886 |
|
---|
1887 | /** @def AssertPtrReturnVoid
|
---|
1888 | * Asserts that a pointer is valid.
|
---|
1889 | *
|
---|
1890 | * @param pv The pointer.
|
---|
1891 | */
|
---|
1892 | #define AssertPtrReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1893 |
|
---|
1894 | /** @def AssertPtrBreakStmt
|
---|
1895 | * Asserts that a pointer is valid.
|
---|
1896 | *
|
---|
1897 | * @param pv The pointer.
|
---|
1898 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1899 | */
|
---|
1900 | #define AssertPtrBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv), ("%p\n", (pv)), stmt)
|
---|
1901 |
|
---|
1902 | /** @def AssertPtrBreakVoid
|
---|
1903 | * Asserts that a pointer is valid.
|
---|
1904 | *
|
---|
1905 | * @param pv The pointer.
|
---|
1906 | * @todo Rename to AssertPtrBreak.
|
---|
1907 | */
|
---|
1908 | #define AssertPtrBreakVoid(pv) AssertMsgBreak(VALID_PTR(pv), ("%p\n", (pv)))
|
---|
1909 |
|
---|
1910 | /** @def AssertPtrNull
|
---|
1911 | * Asserts that a pointer is valid or NULL.
|
---|
1912 | *
|
---|
1913 | * @param pv The pointer.
|
---|
1914 | */
|
---|
1915 | #define AssertPtrNull(pv) AssertMsg(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1916 |
|
---|
1917 | /** @def AssertPtrNullReturn
|
---|
1918 | * Asserts that a pointer is valid or NULL.
|
---|
1919 | *
|
---|
1920 | * @param pv The pointer.
|
---|
1921 | * @param rcRet What is to be presented to return.
|
---|
1922 | */
|
---|
1923 | #define AssertPtrNullReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), rcRet)
|
---|
1924 |
|
---|
1925 | /** @def AssertPtrNullReturnVoid
|
---|
1926 | * Asserts that a pointer is valid or NULL.
|
---|
1927 | *
|
---|
1928 | * @param pv The pointer.
|
---|
1929 | */
|
---|
1930 | #define AssertPtrNullReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1931 |
|
---|
1932 | /** @def AssertPtrNullBreakStmt
|
---|
1933 | * Asserts that a pointer is valid or NULL.
|
---|
1934 | *
|
---|
1935 | * @param pv The pointer.
|
---|
1936 | * @param stmt Statement to execute before break in case of a failed assertion.
|
---|
1937 | */
|
---|
1938 | #define AssertPtrNullBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), stmt)
|
---|
1939 |
|
---|
1940 | /** @def AssertPtrNullBreakVoid
|
---|
1941 | * Asserts that a pointer is valid or NULL.
|
---|
1942 | *
|
---|
1943 | * @param pv The pointer.
|
---|
1944 | * @todo Rename to AssertPtrNullBreak.
|
---|
1945 | */
|
---|
1946 | #define AssertPtrNullBreakVoid(pv) AssertMsgBreak(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
|
---|
1947 |
|
---|
1948 | /** @def AssertGCPhys32
|
---|
1949 | * Asserts that the high dword of a physical address is zero
|
---|
1950 | *
|
---|
1951 | * @param GCPhys The address (RTGCPHYS).
|
---|
1952 | */
|
---|
1953 | #define AssertGCPhys32(GCPhys) AssertMsg(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
|
---|
1954 |
|
---|
1955 |
|
---|
1956 | /** @} */
|
---|
1957 |
|
---|
1958 | #endif
|
---|
1959 |
|
---|