assert.h revision 53e519c1a9834ae23167b590f209a335f4d21d38
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * IPRT - Assertions.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * available from http://www.virtualbox.org. This file is free software;
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * you can redistribute it and/or modify it under the terms of the GNU
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * General Public License (GPL) as published by the Free Software
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * The contents of this file may alternatively be used under the terms
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * of the Common Development and Distribution License Version 1.0
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * VirtualBox OSE distribution, in which case the provisions of the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * CDDL are applicable instead of those of the GPL.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * You may elect to license modified versions of this file under the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * terms and conditions of either the GPL or the CDDL or both.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * additional information or have any questions.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync/** @defgroup grp_rt_assert Assert - Assertions
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @ingroup grp_rt
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Assertions are generally used to check preconditions and other
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * assumptions. Sometimes it is also used to catch odd errors or errors
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * that one would like to inspect in the debugger. They should not be
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * used for errors that happen frequently.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * IPRT provides a host of assertion macros, so many that it can be a bit
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * overwhelming at first. Don't despair, there is a system (surprise).
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * First there are four families of assertions:
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - Assert - The normal strict build only assertions.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - AssertLogRel - Calls LogRel() in non-strict builds, otherwise like Assert.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - AssertRelease - Triggers in all builds.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - AssertFatal - Triggers in all builds and cannot be continued.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Then there are variations wrt to argument list and behavior on failure:
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - Msg - Custom RTStrPrintf-like message with the assertion message.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - Return - Return the specific rc on failure.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - ReturnVoid - Return (void) on failure.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - Break - Break (out of switch/loop) on failure.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - Stmt - Execute the specified statement(s) on failure.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - RC - Assert RT_SUCCESS.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * - RCSuccess - Assert VINF_SUCCESS.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * In addition there is a very special family AssertCompile that can be
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * used for some limited compile-time checking, like structure sizes and member
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * alignment. This family doesn't have the same variations.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @remarks As you might have noticed, the macros don't follow the
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * coding guidelines wrt to macros supposedly being all uppercase
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * and underscored. For various reasons they don't, and nobody
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * has complained yet. Wonder why... :-)
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @remarks Each project has its own specific guidelines on how to use
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * assertions, so the above is just trying to give you the general idea
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * from the IPRT point of view.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * The 1st part of an assert message.
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * @param pszExpr Expression. Can be NULL.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @param uLine Location line number.
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * @param pszFile Location file name.
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * @param pszFunction Location function name.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsyncRTDECL(void) RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * Weak version of RTAssertMsg1
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @copydoc RTAssertMsg1
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * @todo rename to AssertMsg1Weak
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsyncRTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * The 2nd (optional) part of an assert message.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param pszFormat Printf like format string.
fea595114d685c0f865a710172df95896f08d47bvboxsync * @param va Arguments to that string.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsyncRTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va);
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * The 2nd (optional) part of an assert message.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @param pszFormat Printf like format string.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param ... Arguments to that string.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsyncRTDECL(void) RTAssertMsg2(const char *pszFormat, ...);
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** Weak version of RTAssertMsg2
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @copydoc RTAssertMsg2
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @todo rename to AssertMsg2Weak
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsyncRTDECL(void) AssertMsg2(const char *pszFormat, ...);
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Panics the system as the result of a fail assertion.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync#endif /* IN_RING0 */
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Overridable function that decides whether assertions executes the panic
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * (breakpoint) or not.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * The generic implementation will return true.
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * @returns true if the breakpoint should be hit, false if it should be ignored.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @remark The RTDECL() makes this a bit difficult to override on Windows. So,
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * you'll have to use RTASSERT_HAVE_SHOULD_PANIC or
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * RTASSERT_HAVE_SHOULD_PANIC_PRIVATE there to control the kind of
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * prototype.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync#if !defined(RTASSERT_HAVE_SHOULD_PANIC) && !defined(RTASSERT_HAVE_SHOULD_PANIC_PRIVATE)
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Controls whether the assertions should be quiet or noisy (default).
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @returns The old setting.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param fQuiet The new setting.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Are assertions quiet or noisy?
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @returns True if they are quiet, false if noisy.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Makes the assertions panic (default) or not.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @returns The old setting.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param fPanic The new setting.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Can assertion panic.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @returns True if they can, false if not.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @name Globals for crash analysis
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @remarks This is the full potential set, it
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** The last assert message, 1st part. */
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** The last assert message, 2nd part. */
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** The last assert message, expression. */
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsyncextern RTDATADECL(const char * volatile) g_pszRTAssertExpr;
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** The last assert message, file name. */
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsyncextern RTDATADECL(const char * volatile) g_pszRTAssertFile;
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync/** The last assert message, line number. */
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsyncextern RTDATADECL(uint32_t volatile) g_u32RTAssertLine;
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync/** The last assert message, function name. */
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsyncextern RTDATADECL(const char * volatile) g_pszRTAssertFunction;
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @def RTAssertDebugBreak()
ab93606043a9881487aa83be04191d2f4ea24071vboxsync * Debugger breakpoint instruction.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @remarks In the gnu world we add a nop instruction after the int3 to
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * force gdb to remain at the int3 source line.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @remarks This macro does not depend on RT_STRICT.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync# define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3\n\tnop"); } while (0)
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync# define RTAssertDebugBreak() do { __asm__ __volatile__ ("int3; jmp 1f; 1:"); } while (0)
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync# define RTAssertDebugBreak() do { __debugbreak(); } while (0)
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @name Compile time assertions.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * These assertions are used to check structure sizes, member/size alignments
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * and similar compile time expressions.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * RTASSERTTYPE is the type the AssertCompile() macro redefines.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * It has no other function and shouldn't be used.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Visual C++ uses this.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * RTASSERTVAR is the type the AssertCompile() macro redefines.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * It has no other function and shouldn't be used.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * GCC uses this.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @def AssertCompile
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Asserts that a compile-time expression is true. If it's not break the build.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param expr Expression which should be true.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync# define AssertCompile(expr) extern int RTASSERTVAR[1] __attribute__((unused)), RTASSERTVAR[(expr) ? 1 : 0] __attribute__((unused))
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync# define AssertCompile(expr) typedef int RTASSERTTYPE[(expr) ? 1 : 0]
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @def AssertCompileSize
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Asserts a size at compile.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @param type The type.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param size The expected type size.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @def AssertCompileSizeAlignment
fea595114d685c0f865a710172df95896f08d47bvboxsync * Asserts a size alignment at compile.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param type The type.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param align The size alignment to assert.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync/** @def AssertCompileMemberSize
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Asserts a member offset alignment at compile.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param type The type.
fea595114d685c0f865a710172df95896f08d47bvboxsync * @param member The member.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param size The member size to assert.
fea595114d685c0f865a710172df95896f08d47bvboxsync#define AssertCompileMemberSize(type, member, size) \
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync AssertCompile(RT_SIZEOFMEMB(type, member) == (size))
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync/** @def AssertCompileMemberSizeAlignment
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * Asserts a member size alignment at compile.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @param type The type.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param member The member.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync * @param align The member size alignment to assert.
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync#define AssertCompileMemberSizeAlignment(type, member, align) \
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync AssertCompile(!(RT_SIZEOFMEMB(type, member) & ((align) - 1)))
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync/** @def AssertCompileMemberAlignment
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * Asserts a member offset alignment at compile.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param type The type.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param member The member.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param align The member offset alignment to assert.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync# define AssertCompileMemberAlignment(type, member, align) \
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync AssertCompile(!(__builtin_offsetof(type, member) & ((align) - 1)))
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync# define AssertCompileMemberAlignment(type, member, align) \
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync# define AssertCompileMemberAlignment(type, member, align) \
1f1986470af9f0bb750dd859b142dc2e952deb20vboxsync AssertCompile(!(RT_OFFSETOF(type, member) & ((align) - 1)))
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync/** @def AssertCompileMemberOffset
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * Asserts a offset of a structure member at compile.
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * @param type The type.
9837b5326a44772e824a15f2d5d937ddfd627d54vboxsync * @param member The member.
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * @param off The expected offset.
#if defined(IN_RING0) \
#ifdef RT_STRICT
# define AssertBreakpoint() do { } while (0)
#ifdef RT_STRICT
# define RTAssertPanic() do { } while (0)
#ifdef RT_STRICT
RTAssertPanic(); \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
RTAssertPanic(); \
return (rc); \
return (rc); \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
return (rc); \
stmt; \
return (rc); \
#ifdef RT_STRICT
RTAssertPanic(); \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
RTAssertPanic(); \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
return (rc); \
return (rc); \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
stmt; \
return (rc); \
stmt; \
return (rc); \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
# define AssertFailed() \
RTAssertPanic(); \
# define AssertFailed() do { } while (0)
#ifdef RT_STRICT
RTAssertPanic(); \
return (rc); \
return (rc); \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
return (rc); \
stmt; \
return (rc); \
#ifdef RT_STRICT
# define AssertFailedReturnVoid() \
RTAssertPanic(); \
# define AssertFailedReturnVoid() \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
# define AssertFailedBreak() \
RTAssertPanic(); \
# define AssertFailedBreak() \
#ifdef RT_STRICT
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
# define AssertMsgFailed(a) \
AssertMsg2 a; \
RTAssertPanic(); \
# define AssertMsgFailed(a) do { } while (0)
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
return (rc); \
return (rc); \
#ifdef RT_STRICT
# define AssertMsgFailedReturnVoid(a) \
AssertMsg2 a; \
RTAssertPanic(); \
# define AssertMsgFailedReturnVoid(a) \
#ifdef RT_STRICT
# define AssertMsgFailedBreak(a) \
AssertMsg2 a; \
RTAssertPanic(); \
# define AssertMsgFailedBreak(a) \
#ifdef RT_STRICT
AssertMsg2 a; \
RTAssertPanic(); \
stmt; \
stmt; \
#ifdef RT_STRICT
#ifdef RT_STRICT
RTAssertPanic(); \
RTAssertPanic(); \
return (rc); \
RTAssertPanic(); \
RTAssertPanic(); \
RTAssertPanic(); \
stmt; \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
return (rc); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
stmt; \
#define AssertLogRelFailed() \
RTAssertPanic(); \
RTAssertPanic(); \
return (rc); \
#define AssertLogRelFailedReturnVoid() \
RTAssertPanic(); \
#define AssertLogRelFailedBreak() \
RTAssertPanic(); \
RTAssertPanic(); \
stmt; \
#define AssertLogRelMsgFailed(a) \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
return (rc); \
#define AssertLogRelMsgFailedReturnVoid(a) \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
#define AssertLogRelMsgFailedBreak(a) \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
RTAssertLogRelMsg2(a); \
RTAssertPanic(); \
stmt; \
RTAssertReleasePanic(); \
RTAssertReleasePanic(); \
return (rc); \
RTAssertReleasePanic(); \
RTAssertReleasePanic(); \
RTAssertReleasePanic(); \
stmt; \
AssertMsg2 a; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
return (rc); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
stmt; \
#define AssertReleaseFailed() \
RTAssertReleasePanic(); \
RTAssertReleasePanic(); \
return (rc); \
#define AssertReleaseFailedReturnVoid() \
RTAssertReleasePanic(); \
#define AssertReleaseFailedBreak() \
RTAssertReleasePanic(); \
RTAssertReleasePanic(); \
stmt; \
#define AssertReleaseMsgFailed(a) \
AssertMsg2 a; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
return (rc); \
#define AssertReleaseMsgFailedReturnVoid(a) \
AssertMsg2 a; \
RTAssertReleasePanic(); \
#define AssertReleaseMsgFailedBreak(a) \
AssertMsg2 a; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
stmt; \
RTAssertReleasePanic(); \
AssertMsg2 a; \
RTAssertReleasePanic(); \
#define AssertFatalFailed() \
RTAssertReleasePanic(); \
#define AssertFatalMsgFailed(a) \
AssertMsg2 a; \
RTAssertReleasePanic(); \
* Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
#define AssertRCSuccessReturn(rc, rcRet) AssertMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
* Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and return if it isn't.
* Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
* Asserts that an iprt status code equals VINF_SUCCESS, bitch (RT_STRICT mode only) and break if it isn't.
#define AssertRCSuccessBreakStmt(rc, stmt) AssertMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt)
#define AssertLogRelMsgRCReturn(rc, msg, rcRet) AssertLogRelMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
#define AssertLogRelMsgRCBreakStmt(rc, msg, stmt) AssertLogRelMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
#define AssertLogRelRCSuccessReturn(rc, rcRet) AssertLogRelMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
#define AssertLogRelRCSuccessReturnVoid(rc) AssertLogRelMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
#define AssertLogRelRCSuccessBreakStmt(rc, stmt) AssertLogRelMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt)
#define AssertReleaseMsgRCReturn(rc, msg, rcRet) AssertReleaseMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet)
#define AssertReleaseMsgRCBreakStmt(rc, msg, stmt) AssertReleaseMsgBreakStmt(RT_SUCCESS_NP(rc), msg, stmt)
#define AssertReleaseRCSuccessReturn(rc, rcRet) AssertReleaseMsgReturn((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), rcRet)
#define AssertReleaseRCSuccessReturnVoid(rc) AssertReleaseMsgReturnVoid((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
#define AssertReleaseRCSuccessBreak(rc) AssertReleaseMsgBreak((rc) == VINF_SUCCESS, ("%Rra\n", (rc)))
#define AssertReleaseRCSuccessBreakStmt(rc, stmt) AssertReleaseMsgBreakStmt((rc) == VINF_SUCCESS, ("%Rra\n", (rc)), stmt)
#define AssertPtrNullReturn(pv, rcRet) AssertMsgReturn(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), rcRet)
#define AssertPtrNullReturnVoid(pv) AssertMsgReturnVoid(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)))
#define AssertPtrNullBreakStmt(pv, stmt) AssertMsgBreakStmt(VALID_PTR(pv) || (pv) == NULL, ("%p\n", (pv)), stmt)