realtimenetprots/sipfw/SIP/Common/inc/SipAssert.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : SipAssert.h
       
    16 * Part of       : SIPCommon
       
    17 * Version       : SIP/3.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef __SIP_ASSERT__
       
    30 #define __SIP_ASSERT__
       
    31 
       
    32 #include <e32std.h>
       
    33 
       
    34 
       
    35 #if defined(_DEBUG)
       
    36 
       
    37 //Panic is used in debug builds, so the exact location where the assertion
       
    38 //failed is caught early in testing.
       
    39 #define __SIP_ASSERT_LEAVE(c, i) __ASSERT_ALWAYS(c, User::Panic(KNullDesC, i))
       
    40 
       
    41 #define __SIP_ASSERT_RETURN(c, i) __ASSERT_ALWAYS(c, User::Panic(KNullDesC, i))
       
    42 
       
    43 #define __SIP_ASSERT_RETURN_VALUE(c, i) __ASSERT_ALWAYS(c, User::Panic(KNullDesC, i))
       
    44 
       
    45 #else
       
    46 
       
    47 //For release builds, leave is used instead of panicking.
       
    48 //Panic is avoided to keep the SIP stack running.
       
    49 #define __SIP_ASSERT_LEAVE(c, i) __ASSERT_ALWAYS(c, User::Leave(i))
       
    50 
       
    51 //Where leaving isn't possible, __SIP_ASSERT_RETURN can be used in place of
       
    52 //__SIP_ASSERT_LEAVE
       
    53 #define __SIP_ASSERT_RETURN(c, i) if (!(c)) return
       
    54 
       
    55 #define __SIP_ASSERT_RETURN_VALUE(c, i) if (!(c)) return(i)
       
    56 
       
    57 #endif
       
    58 
       
    59 
       
    60 #endif