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