VirtualBox

source: vbox/trunk/include/iprt/assert.h@ 8574

Last change on this file since 8574 was 8574, checked in by vboxsync, 17 years ago

Fixed broken AssertReleaseBreakVoid macro (unused).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 63.4 KB
Line 
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 */
90RTDECL(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 */
98RTDECL(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 */
108RTDECL(bool) RTAssertDoBreakpoint(void);
109
110/** The last assert message, 1st part. */
111extern RTDATADECL(char) g_szRTAssertMsg1[1024];
112/** The last assert message, 2nd part. */
113extern 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 */
146typedef 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
156extern int RTASSERTVAR[1];
157#ifdef __GNUC__
158__END_DECLS
159#endif
160
161/** @def AssertCompile
162 * Asserts that a compile-time expression is true. If it's not break the build.
163 * @param expr Expression which should be true.
164 */
165#ifdef __GNUC__
166# define AssertCompile(expr) extern int RTASSERTVAR[1] __attribute__((unused)), RTASSERTVAR[(expr) ? 1 : 0] __attribute__((unused))
167#else
168# define AssertCompile(expr) typedef int RTASSERTTYPE[(expr) ? 1 : 0]
169#endif
170
171/** @def AssertCompileSize
172 * Asserts a size at compile.
173 * @param type The type.
174 * @param size The expected type size.
175 */
176#define AssertCompileSize(type, size) \
177 AssertCompile(sizeof(type) == (size))
178
179/** @def AssertCompileSizeAlignment
180 * Asserts a size alignment at compile.
181 * @param type The type.
182 * @param align The size alignment to assert.
183 */
184#define AssertCompileSizeAlignment(type, align) \
185 AssertCompile(!(sizeof(type) & ((align) - 1)))
186
187/** @def AssertCompileMemberAlignment
188 * Asserts a member offset alignment at compile.
189 * @param type The type.
190 * @param member The member.
191 * @param align The member offset alignment to assert.
192 */
193#if defined(__GNUC__) && defined(__cplusplus)
194# if __GNUC__ >= 4
195# define AssertCompileMemberAlignment(type, member, align) \
196 AssertCompile(!(__builtin_offsetof(type, member) & ((align) - 1)))
197# else
198# define AssertCompileMemberAlignment(type, member, align) \
199 AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
200# endif
201#else
202# define AssertCompileMemberAlignment(type, member, align) \
203 AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
204#endif
205
206
207/** @def AssertCompileMemberSize
208 * Asserts a member offset alignment at compile.
209 * @param type The type.
210 * @param member The member.
211 * @param size The member size to assert.
212 */
213#define AssertCompileMemberSize(type, member, size) \
214 AssertCompile(RT_SIZEOFMEMB(type, member) == (size))
215
216/** @def AssertCompileMemberSizeAlignment
217 * Asserts a member size alignment at compile.
218 * @param type The type.
219 * @param member The member.
220 * @param align The member size alignment to assert.
221 */
222#define AssertCompileMemberSizeAlignment(type, member, align) \
223 AssertCompile(!(RT_SIZEOFMEMB(type, member) & ((align) - 1)))
224
225
226/** @def Assert
227 * Assert that an expression is true. If it's not hit breakpoint.
228 * @param expr Expression which should be true.
229 */
230#ifdef RT_STRICT
231# define Assert(expr) \
232 do { \
233 if (RT_UNLIKELY(!(expr))) \
234 { \
235 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
236 AssertBreakpoint(); \
237 } \
238 } while (0)
239#else
240# define Assert(expr) do { } while (0)
241#endif
242
243
244/** @def AssertReturn
245 * Assert that an expression is true and returns if it isn't.
246 * In RT_STRICT mode it will hit a breakpoint before returning.
247 *
248 * @param expr Expression which should be true.
249 * @param rc What is to be presented to return.
250 */
251#ifdef RT_STRICT
252# define AssertReturn(expr, rc) \
253 do { \
254 if (RT_UNLIKELY(!(expr))) \
255 { \
256 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
257 AssertBreakpoint(); \
258 return (rc); \
259 } \
260 } while (0)
261#else
262# define AssertReturn(expr, rc) \
263 do { \
264 if (RT_UNLIKELY(!(expr))) \
265 return (rc); \
266 } while (0)
267#endif
268
269/** @def AssertReturnVoid
270 * Assert that an expression is true and returns if it isn't.
271 * In RT_STRICT mode it will hit a breakpoint before returning.
272 *
273 * @param expr Expression which should be true.
274 */
275#ifdef RT_STRICT
276# define AssertReturnVoid(expr) \
277 do { \
278 if (RT_UNLIKELY(!(expr))) \
279 { \
280 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
281 AssertBreakpoint(); \
282 return; \
283 } \
284 } while (0)
285#else
286# define AssertReturnVoid(expr) \
287 do { \
288 if (RT_UNLIKELY(!(expr))) \
289 return; \
290 } while (0)
291#endif
292
293
294/** @def AssertBreakStmt
295 * Assert that an expression is true and breaks if it isn't.
296 * In RT_STRICT mode it will hit a breakpoint before doing break.
297 *
298 * @param expr Expression which should be true.
299 * @param stmt Statement to execute before break in case of a failed assertion.
300 */
301#ifdef RT_STRICT
302# define AssertBreakStmt(expr, stmt) \
303 if (RT_UNLIKELY(!(expr))) { \
304 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
305 AssertBreakpoint(); \
306 stmt; \
307 break; \
308 } else do {} while (0)
309#else
310# define AssertBreakStmt(expr, stmt) \
311 if (RT_UNLIKELY(!(expr))) { \
312 stmt; \
313 break; \
314 } else do {} while (0)
315#endif
316
317/** @def AssertBreakVoid
318 * Assert that an expression is true and breaks if it isn't.
319 * In RT_STRICT mode it will hit a breakpoint before returning.
320 *
321 * @param expr Expression which should be true.
322 * @todo Rename to AssertBreak.
323 * @todo broken, use if.
324 */
325#ifdef RT_STRICT
326# define AssertBreakVoid(expr) \
327 do { \
328 if (RT_UNLIKELY(!(expr))) \
329 { \
330 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
331 AssertBreakpoint(); \
332 break; \
333 } \
334 } while (0)
335#else
336# define AssertBreakVoid(expr) \
337 do { \
338 if (RT_UNLIKELY(!(expr))) \
339 break; \
340 } while (0)
341#endif
342
343
344/** @def AssertMsg
345 * Assert that an expression is true. If it's not print message and hit breakpoint.
346 * @param expr Expression which should be true.
347 * @param a printf argument list (in parenthesis).
348 */
349#ifdef RT_STRICT
350# define AssertMsg(expr, a) \
351 do { \
352 if (RT_UNLIKELY(!(expr))) \
353 { \
354 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
355 AssertMsg2 a; \
356 AssertBreakpoint(); \
357 } \
358 } while (0)
359#else
360# define AssertMsg(expr, a) do { } while (0)
361#endif
362
363/** @def AssertMsgReturn
364 * Assert that an expression is true and returns if it isn't.
365 * In RT_STRICT mode it will hit a breakpoint before returning.
366 *
367 * @param expr Expression which should be true.
368 * @param a printf argument list (in parenthesis).
369 * @param rc What is to be presented to return.
370 */
371#ifdef RT_STRICT
372# define AssertMsgReturn(expr, a, rc) \
373 do { \
374 if (RT_UNLIKELY(!(expr))) \
375 { \
376 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
377 AssertMsg2 a; \
378 AssertBreakpoint(); \
379 return (rc); \
380 } \
381 } while (0)
382#else
383# define AssertMsgReturn(expr, a, rc) \
384 do { \
385 if (RT_UNLIKELY(!(expr))) \
386 return (rc); \
387 } while (0)
388#endif
389
390/** @def AssertMsgReturnVoid
391 * Assert that an expression is true and returns if it isn't.
392 * In RT_STRICT mode it will hit a breakpoint before returning.
393 *
394 * @param expr Expression which should be true.
395 * @param a printf argument list (in parenthesis).
396 */
397#ifdef RT_STRICT
398# define AssertMsgReturnVoid(expr, a) \
399 do { \
400 if (RT_UNLIKELY(!(expr))) \
401 { \
402 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
403 AssertMsg2 a; \
404 AssertBreakpoint(); \
405 return; \
406 } \
407 } while (0)
408#else
409# define AssertMsgReturnVoid(expr, a) \
410 do { \
411 if (RT_UNLIKELY(!(expr))) \
412 return; \
413 } while (0)
414#endif
415
416
417/** @def AssertMsgBreakStmt
418 * Assert that an expression is true and breaks if it isn't.
419 * In RT_STRICT mode it will hit a breakpoint before doing break.
420 *
421 * @param expr Expression which should be true.
422 * @param a printf argument list (in parenthesis).
423 * @param stmt Statement to execute before break in case of a failed assertion.
424 */
425#ifdef RT_STRICT
426# define AssertMsgBreakStmt(expr, a, stmt) \
427 if (RT_UNLIKELY(!(expr))) { \
428 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
429 AssertMsg2 a; \
430 AssertBreakpoint(); \
431 stmt; \
432 break; \
433 } else do {} while (0)
434#else
435# define AssertMsgBreakStmt(expr, a, stmt) \
436 if (RT_UNLIKELY(!(expr))) { \
437 stmt; \
438 break; \
439 } else do {} while (0)
440#endif
441
442/** @def AssertMsgBreakVoid
443 * Assert that an expression is true and breaks if it isn't.
444 * In RT_STRICT mode it will hit a breakpoint before returning.
445 *
446 * @param expr Expression which should be true.
447 * @param a printf argument list (in parenthesis).
448 * @todo Rename to AssertMsgBreak.
449 * @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 */
1008#define AssertLogRelMsgFailedBreakStmt(a, stmt) \
1009 if (1) \
1010 { \
1011 AssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1012 AssertLogRelMsg2(a); \
1013 AssertLogRelBreakpoint(); \
1014 stmt; \
1015 break; \
1016 } else do {} while (0)
1017
1018
1019
1020/** @def AssertReleaseBreakpoint()
1021 * Assertion Breakpoint.
1022 *
1023 * @remark In the gnu world we add a nop instruction after the int3 to
1024 * force gdb to remain at the int3 source line.
1025 * @remark The L4 kernel will try make sense of the breakpoint, thus the jmp.
1026 */
1027#ifdef __GNUC__
1028# ifndef __L4ENV__
1029# define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3\n\tnop"); } while (0)
1030# else
1031# define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
1032# endif
1033#elif defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
1034# define AssertReleaseBreakpoint() do { RTAssertDoBreakpoint(); __debugbreak(); } while (0)
1035#else
1036# error "Unknown compiler"
1037#endif
1038
1039
1040/** @def AssertRelease
1041 * Assert that an expression is true. If it's not hit a breakpoint.
1042 *
1043 * @param expr Expression which should be true.
1044 */
1045#define AssertRelease(expr) \
1046 do { \
1047 if (RT_UNLIKELY(!(expr))) \
1048 { \
1049 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1050 AssertReleaseBreakpoint(); \
1051 } \
1052 } while (0)
1053
1054/** @def AssertReleaseReturn
1055 * Assert that an expression is true, hit a breakpoing and return if it isn't.
1056 *
1057 * @param expr Expression which should be true.
1058 * @param rc What is to be presented to return.
1059 */
1060#define AssertReleaseReturn(expr, rc) \
1061 do { \
1062 if (RT_UNLIKELY(!(expr))) \
1063 { \
1064 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1065 AssertReleaseBreakpoint(); \
1066 return (rc); \
1067 } \
1068 } while (0)
1069
1070/** @def AssertReleaseReturnVoid
1071 * Assert that an expression is true, hit a breakpoing and return if it isn't.
1072 *
1073 * @param expr Expression which should be true.
1074 */
1075#define AssertReleaseReturnVoid(expr) \
1076 do { \
1077 if (RT_UNLIKELY(!(expr))) \
1078 { \
1079 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1080 AssertReleaseBreakpoint(); \
1081 return; \
1082 } \
1083 } while (0)
1084
1085
1086/** @def AssertReleaseBreakStmt
1087 * Assert that an expression is true, hit a breakpoing and break if it isn't.
1088 *
1089 * @param expr Expression which should be true.
1090 * @param stmt Statement to execute before break in case of a failed assertion.
1091 */
1092#define AssertReleaseBreakStmt(expr, stmt) \
1093 do { \
1094 if (RT_UNLIKELY(!(expr))) \
1095 { \
1096 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1097 AssertReleaseBreakpoint(); \
1098 stmt; \
1099 break; \
1100 } \
1101 } while (0)
1102
1103/** @def AssertReleaseBreakVoid
1104 * Assert that an expression is true, hit a breakpoing and break if it isn't.
1105 *
1106 * @param expr Expression which should be true.
1107 * @todo Rename to AssertReleaseBreak.
1108 */
1109#define AssertReleaseBreakVoid(expr) \
1110 if { \
1111 if (RT_UNLIKELY(!(expr))) \
1112 { \
1113 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1114 AssertReleaseBreakpoint(); \
1115 break; \
1116 } \
1117 } else do {} while (0)
1118
1119
1120/** @def AssertReleaseMsg
1121 * Assert that an expression is true, print the message and hit a breakpoint if it isn't.
1122 *
1123 * @param expr Expression which should be true.
1124 * @param a printf argument list (in parenthesis).
1125 */
1126#define AssertReleaseMsg(expr, a) \
1127 do { \
1128 if (RT_UNLIKELY(!(expr))) \
1129 { \
1130 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1131 AssertMsg2 a; \
1132 AssertReleaseBreakpoint(); \
1133 } \
1134 } while (0)
1135
1136/** @def AssertReleaseMsgReturn
1137 * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
1138 *
1139 * @param expr Expression which should be true.
1140 * @param a printf argument list (in parenthesis).
1141 * @param rc What is to be presented to return.
1142 */
1143#define AssertReleaseMsgReturn(expr, a, rc) \
1144 do { \
1145 if (RT_UNLIKELY(!(expr))) \
1146 { \
1147 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1148 AssertMsg2 a; \
1149 AssertReleaseBreakpoint(); \
1150 return (rc); \
1151 } \
1152 } while (0)
1153
1154/** @def AssertReleaseMsgReturnVoid
1155 * Assert that an expression is true, print the message and hit a breakpoint and return if it isn't.
1156 *
1157 * @param expr Expression which should be true.
1158 * @param a printf argument list (in parenthesis).
1159 */
1160#define AssertReleaseMsgReturnVoid(expr, a) \
1161 do { \
1162 if (RT_UNLIKELY(!(expr))) \
1163 { \
1164 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1165 AssertMsg2 a; \
1166 AssertReleaseBreakpoint(); \
1167 return; \
1168 } \
1169 } while (0)
1170
1171
1172/** @def AssertReleaseMsgBreakStmt
1173 * Assert that an expression is true, print the message and hit a breakpoing and break if it isn't.
1174 *
1175 * @param expr Expression which should be true.
1176 * @param a printf argument list (in parenthesis).
1177 * @param stmt Statement to execute before break in case of a failed assertion.
1178 */
1179#define AssertReleaseMsgBreakStmt(expr, a, stmt) \
1180 if (RT_UNLIKELY(!(expr))) { \
1181 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1182 AssertMsg2 a; \
1183 AssertReleaseBreakpoint(); \
1184 stmt; \
1185 break; \
1186 } else do {} while (0)
1187
1188/** @def AssertReleaseMsgBreakVoid
1189 * Assert that an expression is true, print the message and hit a breakpoint and break if it isn't.
1190 *
1191 * @param expr Expression which should be true.
1192 * @param a printf argument list (in parenthesis).
1193 * @todo Rename to AssertReleaseMsgBreak.
1194 * @todo broken
1195 */
1196#define AssertReleaseMsgBreakVoid(expr, a) \
1197 do { \
1198 if (RT_UNLIKELY(!(expr))) \
1199 { \
1200 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1201 AssertMsg2 a; \
1202 AssertReleaseBreakpoint(); \
1203 break; \
1204 } \
1205 } while (0)
1206
1207
1208/** @def AssertReleaseFailed
1209 * An assertion failed, hit a breakpoint.
1210 */
1211#define AssertReleaseFailed() \
1212 do { \
1213 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1214 AssertReleaseBreakpoint(); \
1215 } while (0)
1216
1217/** @def AssertReleaseFailedReturn
1218 * An assertion failed, hit a breakpoint and return.
1219 *
1220 * @param rc What is to be presented to return.
1221 */
1222#define AssertReleaseFailedReturn(rc) \
1223 do { \
1224 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1225 AssertReleaseBreakpoint(); \
1226 return (rc); \
1227 } while (0)
1228
1229/** @def AssertReleaseFailedReturnVoid
1230 * An assertion failed, hit a breakpoint and return.
1231 */
1232#define AssertReleaseFailedReturnVoid() \
1233 do { \
1234 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1235 AssertReleaseBreakpoint(); \
1236 return; \
1237 } while (0)
1238
1239
1240/** @def AssertReleaseFailedBreakStmt
1241 * An assertion failed, hit a breakpoint and break.
1242 *
1243 * @param stmt Statement to execute before break.
1244 */
1245#define AssertReleaseFailedBreakStmt(stmt) \
1246 if (1) { \
1247 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1248 AssertReleaseBreakpoint(); \
1249 stmt; \
1250 break; \
1251 } else do {} while (0)
1252
1253/** @def AssertReleaseFailedBreakVoid
1254 * An assertion failed, hit a breakpoint and break.
1255 * @todo Rename to AssertReleaseFailedBreak.
1256 * @todo broken, should use 'if' instead of 'do'.
1257 */
1258#define AssertReleaseFailedBreakVoid() \
1259 do { \
1260 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1261 AssertReleaseBreakpoint(); \
1262 break; \
1263 } while (0)
1264
1265
1266/** @def AssertReleaseMsgFailed
1267 * An assertion failed, print a message and hit a breakpoint.
1268 *
1269 * @param a printf argument list (in parenthesis).
1270 */
1271#define AssertReleaseMsgFailed(a) \
1272 do { \
1273 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1274 AssertMsg2 a; \
1275 AssertReleaseBreakpoint(); \
1276 } while (0)
1277
1278/** @def AssertReleaseMsgFailedReturn
1279 * An assertion failed, print a message, hit a breakpoint and return.
1280 *
1281 * @param a printf argument list (in parenthesis).
1282 * @param rc What is to be presented to return.
1283 */
1284#define AssertReleaseMsgFailedReturn(a, rc) \
1285 do { \
1286 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1287 AssertMsg2 a; \
1288 AssertReleaseBreakpoint(); \
1289 return (rc); \
1290 } while (0)
1291
1292/** @def AssertReleaseMsgFailedReturnVoid
1293 * An assertion failed, print a message, hit a breakpoint and return.
1294 *
1295 * @param a printf argument list (in parenthesis).
1296 */
1297#define AssertReleaseMsgFailedReturnVoid(a) \
1298 do { \
1299 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1300 AssertMsg2 a; \
1301 AssertReleaseBreakpoint(); \
1302 return; \
1303 } while (0)
1304
1305
1306/** @def AssertReleaseMsgFailedBreakStmt
1307 * An assertion failed, print a message, hit a breakpoint and break.
1308 *
1309 * @param a printf argument list (in parenthesis).
1310 * @param stmt Statement to execute before break.
1311 */
1312#define AssertReleaseMsgFailedBreakStmt(a, stmt) \
1313 if (1) { \
1314 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1315 AssertMsg2 a; \
1316 AssertReleaseBreakpoint(); \
1317 stmt; \
1318 break; \
1319 } else do {} while (0)
1320
1321/** @def AssertReleaseMsgFailedBreakVoid
1322 * An assertion failed, print a message, hit a breakpoint and break.
1323 *
1324 * @param a printf argument list (in parenthesis).
1325 * @todo Rename to AssertReleaseMsgFailedBreak.
1326 * @todo broken
1327 */
1328#define AssertReleaseMsgFailedBreakVoid(a) \
1329 do { \
1330 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1331 AssertMsg2 a; \
1332 AssertReleaseBreakpoint(); \
1333 break; \
1334 } while (0)
1335
1336
1337/** @def AssertFatal
1338 * Assert that an expression is true. If it's not hit a breakpoint (for ever).
1339 *
1340 * @param expr Expression which should be true.
1341 */
1342#define AssertFatal(expr) \
1343 do { \
1344 if (RT_UNLIKELY(!(expr))) \
1345 for (;;) \
1346 { \
1347 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1348 AssertReleaseBreakpoint(); \
1349 } \
1350 } while (0)
1351
1352/** @def AssertFatalMsg
1353 * Assert that an expression is true, print the message and hit a breakpoint (for ever) if it isn't.
1354 *
1355 * @param expr Expression which should be true.
1356 * @param a printf argument list (in parenthesis).
1357 */
1358#define AssertFatalMsg(expr, a) \
1359 do { \
1360 if (RT_UNLIKELY(!(expr))) \
1361 for (;;) \
1362 { \
1363 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1364 AssertMsg2 a; \
1365 AssertReleaseBreakpoint(); \
1366 } \
1367 } while (0)
1368
1369/** @def AssertFatalFailed
1370 * An assertion failed, hit a breakpoint (for ever).
1371 */
1372#define AssertFatalFailed() \
1373 do { \
1374 for (;;) \
1375 { \
1376 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1377 AssertReleaseBreakpoint(); \
1378 } \
1379 } while (0)
1380
1381/** @def AssertFatalMsgFailed
1382 * An assertion failed, print a message and hit a breakpoint (for ever).
1383 *
1384 * @param a printf argument list (in parenthesis).
1385 */
1386#define AssertFatalMsgFailed(a) \
1387 do { \
1388 for (;;) \
1389 { \
1390 AssertMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
1391 AssertMsg2 a; \
1392 AssertReleaseBreakpoint(); \
1393 } \
1394 } while (0)
1395
1396
1397/** @def AssertRC
1398 * Asserts a iprt status code successful.
1399 *
1400 * On failure it will print info about the rc and hit a breakpoint.
1401 *
1402 * @param rc iprt status code.
1403 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1404 */
1405#define AssertRC(rc) AssertMsgRC(rc, ("%Vra\n", (rc)))
1406
1407/** @def AssertRCReturn
1408 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
1409 *
1410 * @param rc iprt status code.
1411 * @param rcRet What is to be presented to return.
1412 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1413 */
1414#define AssertRCReturn(rc, rcRet) AssertMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
1415
1416/** @def AssertRCReturnVoid
1417 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
1418 *
1419 * @param rc iprt status code.
1420 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1421 */
1422#define AssertRCReturnVoid(rc) AssertMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
1423
1424/** @def AssertRCBreakStmt
1425 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
1426 *
1427 * @param rc iprt status code.
1428 * @param stmt Statement to execute before break in case of a failed assertion.
1429 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1430 */
1431#define AssertRCBreakStmt(rc, stmt) AssertMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
1432
1433/** @def AssertRCBreakVoid
1434 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and break if it isn't.
1435 *
1436 * @param rc iprt status code.
1437 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1438 * @todo Rename to AssertRCBreak.
1439 */
1440#define AssertRCBreakVoid(rc) AssertMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
1441
1442/** @def AssertMsgRC
1443 * Asserts a iprt status code successful.
1444 *
1445 * It prints a custom message and hits a breakpoint on FAILURE.
1446 *
1447 * @param rc iprt status code.
1448 * @param msg printf argument list (in parenthesis).
1449 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1450 */
1451#define AssertMsgRC(rc, msg) \
1452 do { AssertMsg(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
1453
1454/** @def AssertMsgRCReturn
1455 * Asserts a iprt status code successful and if it's not return the specified status code.
1456 *
1457 * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
1458 *
1459 * @param rc iprt status code.
1460 * @param msg printf argument list (in parenthesis).
1461 * @param rcRet What is to be presented to return.
1462 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1463 */
1464#define AssertMsgRCReturn(rc, msg, rcRet) \
1465 do { AssertMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
1466
1467/** @def AssertMsgRCReturnVoid
1468 * Asserts a iprt status code successful and if it's not return.
1469 *
1470 * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
1471 *
1472 * @param rc iprt status code.
1473 * @param msg printf argument list (in parenthesis).
1474 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1475 */
1476#define AssertMsgRCReturnVoid(rc, msg) \
1477 do { AssertMsgReturnVoid(RT_SUCCESS_NP(rc), msg); NOREF(rc); } while (0)
1478
1479/** @def AssertMsgRCBreakStmt
1480 * Asserts a iprt status code successful and break if it's not.
1481 *
1482 * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
1483 *
1484 * @param rc iprt status code.
1485 * @param msg printf argument list (in parenthesis).
1486 * @param stmt Statement to execute before break in case of a failed assertion.
1487 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1488 */
1489#define AssertMsgRCBreakStmt(rc, msg, stmt) \
1490 if (1) { AssertMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt); NOREF(rc); } else do {} while (0)
1491
1492/** @def AssertMsgRCBreakVoid
1493 * Asserts a iprt status code successful and if it's not break.
1494 *
1495 * If RT_STRICT is defined the message will be printed and a breakpoint hit before it breaks
1496 *
1497 * @param rc iprt status code.
1498 * @param msg printf argument list (in parenthesis).
1499 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1500 * @todo Rename to AssertMsgRCBreak.
1501 */
1502#define AssertMsgRCBreakVoid(rc, msg) \
1503 if (1) { AssertMsgBreakVoid(RT_SUCCESS(rc), msg); NOREF(rc); } else do {} while (0)
1504
1505/** @def AssertRCSuccess
1506 * Asserts an iprt status code equals VINF_SUCCESS.
1507 *
1508 * On failure it will print info about the rc and hit a breakpoint.
1509 *
1510 * @param rc iprt status code.
1511 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1512 */
1513#define AssertRCSuccess(rc) AssertMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1514
1515/** @def AssertRCSuccessReturn
1516 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
1517 *
1518 * @param rc iprt status code.
1519 * @param rcRet What is to be presented to return.
1520 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1521 */
1522#define AssertRCSuccessReturn(rc, rcRet) AssertMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
1523
1524/** @def AssertRCSuccessReturnVoid
1525 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
1526 *
1527 * @param rc iprt status code.
1528 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1529 */
1530#define AssertRCSuccessReturnVoid(rc) AssertMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1531
1532/** @def AssertRCSuccessBreakStmt
1533 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
1534 *
1535 * @param rc iprt status code.
1536 * @param stmt Statement to execute before break in case of a failed assertion.
1537 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1538 */
1539#define AssertRCSuccessBreakStmt(rc, stmt) AssertMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
1540
1541/** @def AssertRCSuccessBreakVoid
1542 * Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
1543 *
1544 * @param rc iprt status code.
1545 * @remark rc is references multiple times. In release mode is NOREF()'ed.
1546 * @todo Rename to AssertRCSuccessBreak.
1547 */
1548#define AssertRCSuccessBreakVoid(rc) AssertMsgBreakVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1549
1550
1551/** @def AssertLogRelRC
1552 * Asserts a iprt status code successful.
1553 *
1554 * @param rc iprt status code.
1555 * @remark rc is references multiple times.
1556 */
1557#define AssertLogRelRC(rc) AssertLogRelMsgRC(rc, ("%Rra\n", (rc)))
1558
1559/** @def AssertLogRelRCReturn
1560 * Asserts a iprt status code successful, returning \a rc if it isn't.
1561 *
1562 * @param rc iprt status code.
1563 * @param rcRet What is to be presented to return.
1564 * @remark rc is references multiple times.
1565 */
1566#define AssertLogRelRCReturn(rc, rcRet) AssertLogRelMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)
1567
1568/** @def AssertLogRelRCReturnVoid
1569 * Asserts a iprt status code successful, returning (void) if it isn't.
1570 *
1571 * @param rc iprt status code.
1572 * @remark rc is references multiple times.
1573 */
1574#define AssertLogRelRCReturnVoid(rc) AssertLogRelMsgRCReturnVoid(rc, ("%Rra\n", (rc)))
1575
1576/** @def AssertLogRelRCBreak
1577 * Asserts a iprt status code successful, breaking if it isn't.
1578 *
1579 * @param rc iprt status code.
1580 * @remark rc is references multiple times.
1581 */
1582#define AssertLogRelRCBreak(rc) AssertLogRelMsgRCBreak(rc, ("%Rra\n", (rc)))
1583
1584/** @def AssertLogRelRCBreakStmt
1585 * Asserts a iprt status code successful, execute \a statement and break if it isn't.
1586 *
1587 * @param rc iprt status code.
1588 * @param stmt Statement to execute before break in case of a failed assertion.
1589 * @remark rc is references multiple times.
1590 */
1591#define AssertLogRelRCBreakStmt(rc, stmt) AssertLogRelMsgRCBreakStmt(rc, ("%Rra\n", (rc)), stmt)
1592
1593/** @def AssertLogRelMsgRC
1594 * Asserts a iprt status code successful.
1595 *
1596 * @param rc iprt status code.
1597 * @param msg printf argument list (in parenthesis).
1598 * @remark rc is references multiple times.
1599 */
1600#define AssertLogRelMsgRC(rc, msg) AssertLogRelMsg(RT_SUCCESS_NP(rc), msg)
1601
1602/** @def AssertLogRelMsgRCReturn
1603 * Asserts a iprt status code successful.
1604 *
1605 * @param rc iprt status code.
1606 * @param msg printf argument list (in parenthesis).
1607 * @param rcRet What is to be presented to return.
1608 * @remark rc is references multiple times.
1609 */
1610#define AssertLogRelMsgRCReturn(rc, msg, rcRet) AssertLogRelMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
1611
1612/** @def AssertLogRelMsgRCReturnVoid
1613 * Asserts a iprt status code successful.
1614 *
1615 * @param rc iprt status code.
1616 * @param msg printf argument list (in parenthesis).
1617 * @remark rc is references multiple times.
1618 */
1619#define AssertLogRelMsgRCReturnVoid(rc, msg) AssertLogRelMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
1620
1621/** @def AssertLogRelMsgRCBreak
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 AssertLogRelMsgRCBreak(rc, msg) AssertLogRelMsgBreak(RT_SUCCESS(rc), msg)
1629
1630/** @def AssertLogRelMsgRCBreakStmt
1631 * Asserts a iprt status code successful, execute \a stmt and break if it isn't.
1632 *
1633 * @param rc iprt status code.
1634 * @param msg printf argument list (in parenthesis).
1635 * @param stmt Statement to execute before break in case of a failed assertion.
1636 * @remark rc is references multiple times.
1637 */
1638#define AssertLogRelMsgRCBreakStmt(rc, msg, stmt) AssertLogRelMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
1639
1640/** @def AssertLogRelRCSuccess
1641 * Asserts that an iprt status code equals VINF_SUCCESS.
1642 *
1643 * @param rc iprt status code.
1644 * @remark rc is references multiple times.
1645 */
1646#define AssertLogRelRCSuccess(rc) AssertLogRelMsg((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
1647
1648/** @def AssertLogRelRCSuccessReturn
1649 * Asserts that an iprt status code equals VINF_SUCCESS.
1650 *
1651 * @param rc iprt status code.
1652 * @param rcRet What is to be presented to return.
1653 * @remark rc is references multiple times.
1654 */
1655#define AssertLogRelRCSuccessReturn(rc, rcRet) AssertLogRelMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
1656
1657/** @def AssertLogRelRCSuccessReturnVoid
1658 * Asserts that an iprt status code equals VINF_SUCCESS.
1659 *
1660 * @param rc iprt status code.
1661 * @remark rc is references multiple times.
1662 */
1663#define AssertLogRelRCSuccessReturnVoid(rc) AssertLogRelMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
1664
1665/** @def AssertLogRelRCSuccessBreak
1666 * Asserts that an iprt status code equals VINF_SUCCESS.
1667 *
1668 * @param rc iprt status code.
1669 * @remark rc is references multiple times.
1670 */
1671#define AssertLogRelRCSuccessBreak(rc) AssertLogRelMsgBreak((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1672
1673/** @def AssertLogRelRCSuccessBreakStmt
1674 * Asserts that an iprt status code equals VINF_SUCCESS.
1675 *
1676 * @param rc iprt status code.
1677 * @param stmt Statement to execute before break in case of a failed assertion.
1678 * @remark rc is references multiple times.
1679 */
1680#define AssertLogRelRCSuccessBreakStmt(rc, stmt) AssertLogRelMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
1681
1682
1683/** @def AssertReleaseRC
1684 * Asserts a iprt status code successful.
1685 *
1686 * On failure information about the error will be printed and a breakpoint hit.
1687 *
1688 * @param rc iprt status code.
1689 * @remark rc is references multiple times.
1690 */
1691#define AssertReleaseRC(rc) AssertReleaseMsgRC(rc, ("%Vra\n", (rc)))
1692
1693/** @def AssertReleaseRCReturn
1694 * Asserts a iprt status code successful, returning if it isn't.
1695 *
1696 * On failure information about the error will be printed, a breakpoint hit
1697 * and finally returning from the function if the breakpoint is somehow ignored.
1698 *
1699 * @param rc iprt status code.
1700 * @param rcRet What is to be presented to return.
1701 * @remark rc is references multiple times.
1702 */
1703#define AssertReleaseRCReturn(rc, rcRet) AssertReleaseMsgRCReturn(rc, ("%Vra\n", (rc)), rcRet)
1704
1705/** @def AssertReleaseRCReturnVoid
1706 * Asserts a iprt status code successful, returning if it isn't.
1707 *
1708 * On failure information about the error will be printed, a breakpoint hit
1709 * and finally returning from the function if the breakpoint is somehow ignored.
1710 *
1711 * @param rc iprt status code.
1712 * @remark rc is references multiple times.
1713 */
1714#define AssertReleaseRCReturnVoid(rc) AssertReleaseMsgRCReturnVoid(rc, ("%Vra\n", (rc)))
1715
1716/** @def AssertReleaseRCBreakStmt
1717 * Asserts a iprt status code successful, break if it isn't.
1718 *
1719 * On failure information about the error will be printed, a breakpoint hit
1720 * and finally the break statement will be issued if the breakpoint is somehow ignored.
1721 *
1722 * @param rc iprt status code.
1723 * @param stmt Statement to execute before break in case of a failed assertion.
1724 * @remark rc is references multiple times.
1725 */
1726#define AssertReleaseRCBreakStmt(rc, stmt) AssertReleaseMsgRCBreakStmt(rc, ("%Vra\n", (rc)), stmt)
1727
1728/** @def AssertReleaseRCBreakVoid
1729 * Asserts a iprt status code successful, breaking if it isn't.
1730 *
1731 * On failure information about the error will be printed, a breakpoint hit
1732 * and finally breaking the current statement if the breakpoint is somehow ignored.
1733 *
1734 * @param rc iprt status code.
1735 * @remark rc is references multiple times.
1736 * @todo Rename to AssertReleaseRCBreak.
1737 */
1738#define AssertReleaseRCBreakVoid(rc) AssertReleaseMsgRCBreakVoid(rc, ("%Vra\n", (rc)))
1739
1740/** @def AssertReleaseMsgRC
1741 * Asserts a iprt status code successful.
1742 *
1743 * On failure a custom message is printed and a breakpoint is hit.
1744 *
1745 * @param rc iprt status code.
1746 * @param msg printf argument list (in parenthesis).
1747 * @remark rc is references multiple times.
1748 */
1749#define AssertReleaseMsgRC(rc, msg) AssertReleaseMsg(RT_SUCCESS_NP(rc), msg)
1750
1751/** @def AssertReleaseMsgRCReturn
1752 * Asserts a iprt status code successful.
1753 *
1754 * On failure a custom message is printed, a breakpoint is hit, and finally
1755 * returning from the function if the breakpoint is showhow ignored.
1756 *
1757 * @param rc iprt status code.
1758 * @param msg printf argument list (in parenthesis).
1759 * @param rcRet What is to be presented to return.
1760 * @remark rc is references multiple times.
1761 */
1762#define AssertReleaseMsgRCReturn(rc, msg, rcRet) AssertReleaseMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
1763
1764/** @def AssertReleaseMsgRCReturnVoid
1765 * Asserts a iprt status code successful.
1766 *
1767 * On failure a custom message is printed, a breakpoint is hit, and finally
1768 * returning from the function if the breakpoint is showhow ignored.
1769 *
1770 * @param rc iprt status code.
1771 * @param msg printf argument list (in parenthesis).
1772 * @remark rc is references multiple times.
1773 */
1774#define AssertReleaseMsgRCReturnVoid(rc, msg) AssertReleaseMsgReturnVoid(RT_SUCCESS_NP(rc), msg)
1775
1776/** @def AssertReleaseMsgRCBreakStmt
1777 * Asserts a iprt status code successful.
1778 *
1779 * On failure a custom message is printed, a breakpoint is hit, and finally
1780 * the brean statement is issued if the breakpoint is showhow ignored.
1781 *
1782 * @param rc iprt status code.
1783 * @param msg printf argument list (in parenthesis).
1784 * @param stmt Statement to execute before break in case of a failed assertion.
1785 * @remark rc is references multiple times.
1786 */
1787#define AssertReleaseMsgRCBreakStmt(rc, msg, stmt) AssertReleaseMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
1788
1789/** @def AssertReleaseMsgRCBreakVoid
1790 * Asserts a iprt status code successful.
1791 *
1792 * On failure a custom message is printed, a breakpoint is hit, and finally
1793 * breaking the current status if the breakpoint is showhow ignored.
1794 *
1795 * @param rc iprt status code.
1796 * @param msg printf argument list (in parenthesis).
1797 * @remark rc is references multiple times.
1798 * @todo Rename to AssertReleaseMsgRCBreak.
1799 */
1800#define AssertReleaseMsgRCBreakVoid(rc, msg) AssertReleaseMsgBreakVoid(RT_SUCCESS(rc), msg)
1801
1802/** @def AssertReleaseRCSuccess
1803 * Asserts that an iprt status code equals VINF_SUCCESS.
1804 *
1805 * On failure information about the error will be printed and a breakpoint hit.
1806 *
1807 * @param rc iprt status code.
1808 * @remark rc is references multiple times.
1809 */
1810#define AssertReleaseRCSuccess(rc) AssertReleaseMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1811
1812/** @def AssertReleaseRCSuccessReturn
1813 * Asserts that an iprt status code equals VINF_SUCCESS.
1814 *
1815 * On failure information about the error will be printed, a breakpoint hit
1816 * and finally returning from the function if the breakpoint is somehow ignored.
1817 *
1818 * @param rc iprt status code.
1819 * @param rcRet What is to be presented to return.
1820 * @remark rc is references multiple times.
1821 */
1822#define AssertReleaseRCSuccessReturn(rc, rcRet) AssertReleaseMsgReturn((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), rcRet)
1823
1824/** @def AssertReleaseRCSuccessReturnVoid
1825 * Asserts that an iprt status code equals VINF_SUCCESS.
1826 *
1827 * On failure information about the error will be printed, a breakpoint hit
1828 * and finally returning from the function if the breakpoint is somehow ignored.
1829 *
1830 * @param rc iprt status code.
1831 * @remark rc is references multiple times.
1832 */
1833#define AssertReleaseRCSuccessReturnVoid(rc) AssertReleaseMsgReturnVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1834
1835/** @def AssertReleaseRCSuccessBreakStmt
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 the break statement will be issued if the breakpoint is somehow ignored.
1840 *
1841 * @param rc iprt status code.
1842 * @param stmt Statement to execute before break in case of a failed assertion.
1843 * @remark rc is references multiple times.
1844 */
1845#define AssertReleaseRCSuccessBreakStmt(rc, stmt) AssertReleaseMsgBreakStmt((rc) == VINF_SUCCESS, ("%Vra\n", (rc)), stmt)
1846
1847/** @def AssertReleaseRCSuccessBreakVoid
1848 * Asserts that an iprt status code equals VINF_SUCCESS.
1849 *
1850 * On failure information about the error will be printed, a breakpoint hit
1851 * and finally breaking the current statement if the breakpoint is somehow ignored.
1852 *
1853 * @param rc iprt status code.
1854 * @remark rc is references multiple times.
1855 * @todo Rename to AssertReleaseRCSuccessBreak.
1856 */
1857#define AssertReleaseRCSuccessBreakVoid(rc) AssertReleaseMsgBreakVoid((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1858
1859
1860/** @def AssertFatalRC
1861 * Asserts a iprt status code successful.
1862 *
1863 * On failure information about the error will be printed and a breakpoint hit.
1864 *
1865 * @param rc iprt status code.
1866 * @remark rc is references multiple times.
1867 */
1868#define AssertFatalRC(rc) AssertFatalMsgRC(rc, ("%Vra\n", (rc)))
1869
1870/** @def AssertReleaseMsgRC
1871 * Asserts a iprt status code successful.
1872 *
1873 * On failure a custom message is printed and a breakpoint is hit.
1874 *
1875 * @param rc iprt status code.
1876 * @param msg printf argument list (in parenthesis).
1877 * @remark rc is references multiple times.
1878 */
1879#define AssertFatalMsgRC(rc, msg) AssertFatalMsg(RT_SUCCESS_NP(rc), msg)
1880
1881/** @def AssertFatalRCSuccess
1882 * Asserts that an iprt status code equals VINF_SUCCESS.
1883 *
1884 * On failure information about the error will be printed and a breakpoint hit.
1885 *
1886 * @param rc iprt status code.
1887 * @remark rc is references multiple times.
1888 */
1889#define AssertFatalRCSuccess(rc) AssertFatalMsg((rc) == VINF_SUCCESS, ("%Vra\n", (rc)))
1890
1891
1892/** @def AssertPtr
1893 * Asserts that a pointer is valid.
1894 *
1895 * @param pv The pointer.
1896 */
1897#define AssertPtr(pv) AssertMsg(VALID_PTR(pv), ("%p\n", (pv)))
1898
1899/** @def AssertPtrReturn
1900 * Asserts that a pointer is valid.
1901 *
1902 * @param pv The pointer.
1903 * @param rcRet What is to be presented to return.
1904 */
1905#define AssertPtrReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv), ("%p\n", (pv)), rcRet)
1906
1907/** @def AssertPtrReturnVoid
1908 * Asserts that a pointer is valid.
1909 *
1910 * @param pv The pointer.
1911 */
1912#define AssertPtrReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv), ("%p\n", (pv)))
1913
1914/** @def AssertPtrBreakStmt
1915 * Asserts that a pointer is valid.
1916 *
1917 * @param pv The pointer.
1918 * @param stmt Statement to execute before break in case of a failed assertion.
1919 */
1920#define AssertPtrBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv), ("%p\n", (pv)), stmt)
1921
1922/** @def AssertPtrBreakVoid
1923 * Asserts that a pointer is valid.
1924 *
1925 * @param pv The pointer.
1926 * @todo Rename to AssertPtrBreak.
1927 */
1928#define AssertPtrBreakVoid(pv) AssertMsgBreakVoid(VALID_PTR(pv), ("%p\n", (pv)))
1929
1930/** @def AssertPtrNull
1931 * Asserts that a pointer is valid or NULL.
1932 *
1933 * @param pv The pointer.
1934 */
1935#define AssertPtrNull(pv) AssertMsg(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
1936
1937/** @def AssertPtrNullReturn
1938 * Asserts that a pointer is valid or NULL.
1939 *
1940 * @param pv The pointer.
1941 * @param rcRet What is to be presented to return.
1942 */
1943#define AssertPtrNullReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), rcRet)
1944
1945/** @def AssertPtrNullReturnVoid
1946 * Asserts that a pointer is valid or NULL.
1947 *
1948 * @param pv The pointer.
1949 */
1950#define AssertPtrNullReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
1951
1952/** @def AssertPtrNullBreakStmt
1953 * Asserts that a pointer is valid or NULL.
1954 *
1955 * @param pv The pointer.
1956 * @param stmt Statement to execute before break in case of a failed assertion.
1957 */
1958#define AssertPtrNullBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), stmt)
1959
1960/** @def AssertPtrNullBreakVoid
1961 * Asserts that a pointer is valid or NULL.
1962 *
1963 * @param pv The pointer.
1964 * @todo Rename to AssertPtrNullBreak.
1965 */
1966#define AssertPtrNullBreakVoid(pv) AssertMsgBreakVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
1967
1968/** @def AssertGCPhys32
1969 * Asserts that the high dword of a physical address is zero
1970 *
1971 * @param GCPhys The address (RTGCPHYS).
1972 */
1973#define AssertGCPhys32(GCPhys) AssertMsg(VALID_PHYS32(GCPhys), ("%RGp\n", (RTGCPHYS)(GCPhys)))
1974
1975
1976/** @} */
1977
1978#endif
1979
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette