natfw/natfwstunturnclient/inc/stunassert.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_STUNASSERT_H
       
    22 #define C_STUNASSERT_H
       
    23 
       
    24 #include <e32std.h>
       
    25 
       
    26 #if defined( _DEBUG ) && !defined( TEST_EUNIT )
       
    27 
       
    28 //Panic is used in debug builds, so the exact location where the assertion
       
    29 //failed is caught early in testing.
       
    30 #define __STUN_PANIC( i )    User::Panic( KNullDesC, ( i ) )
       
    31 
       
    32 #define __STUN_ASSERT_L( c, i ) \
       
    33 __ASSERT_ALWAYS( c, __STUN_PANIC( i ) )
       
    34 
       
    35 #define __STUN_ASSERT_RETURN( c, i ) \
       
    36 __ASSERT_ALWAYS( c, __STUN_PANIC( i ) )
       
    37 
       
    38 #define __STUN_ASSERT_RETURN_VALUE( c, i ) \
       
    39 __ASSERT_ALWAYS( c, __STUN_PANIC( i ) )
       
    40 
       
    41 #define __STUN_FAILURE_L( i )        __STUN_PANIC( i )
       
    42 #define __STUN_FAILURE_RETURN( i )     __STUN_PANIC( i )
       
    43 
       
    44 #else
       
    45 
       
    46 //For release builds, leave is used instead of panic.
       
    47 #define __STUN_ASSERT_L( c, i )         __ASSERT_ALWAYS( c, User::Leave( i ) )
       
    48 #define __STUN_ASSERT_RETURN( c, i )         if ( !( c ) ) return
       
    49 #define __STUN_ASSERT_RETURN_VALUE( c, i )     if ( !( c ) ) return ( i )
       
    50 
       
    51 #define __STUN_FAILURE_L( i )        User::Leave( i )
       
    52 #define __STUN_FAILURE_RETURN( i ) return
       
    53 
       
    54 #endif
       
    55 
       
    56 
       
    57 #endif // C_STUNASSERT_H