VirtualBox

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

Last change on this file since 8797 was 8615, checked in by vboxsync, 16 years ago

obsolete todo.

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