VirtualBox

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

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

AssertPtrBreakVoid -> AssertPtrBreak.

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