usbengines/usbotgwatcher/inc/debug.h
branchRCL_3
changeset 21 ff9df6630274
parent 20 a15c582fbf97
--- a/usbengines/usbotgwatcher/inc/debug.h	Fri Mar 12 15:48:40 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/debug.h	Mon Mar 15 12:44:42 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This material, including documentation and any related computer
 * programs, is protected by copyright controlled by Nokia. All
@@ -97,7 +97,7 @@
     TPtrC8 iFuncName;
     };
 // ===========================================================================
-#else //Real-time logging
+#else //LOG_TO_FILE not defined
 // ===========================================================================
 #include <e32debug.h>
 
@@ -127,20 +127,22 @@
     };
 #endif // LOG_TO_FILE
 
-#define LEAVE( exp )  {volatile TInt err = exp; \
-            LOG3( "LEAVE(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\
-            User::Leave( err );}
+#define LEAVE( exp )  {volatile TInt err_ = exp; \
+        LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
+        User::Leave( err_ );}
 
-#define LEAVEIFERROR( exp ) {volatile TInt err = exp; if(err < 0) LEAVE(err);}
+#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \
+        if(err__ < 0) LEAVE(err__);}
 
-#define PANIC( exp ) {volatile TInt err = exp; \
-            LOG3( "PANIC(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\
-            User::Panic( KUsbPanicModule, err );}
-
+#define PANIC( exp ) {volatile TInt err_ = exp; \
+        LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
+        User::Panic( KUsbPanicModule, err_ );} 
 
 #define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
 
-#else // _DEBUG   
+#define ASSERT_PANIC( exp, code ) {if(!(exp)) PANIC(code)}
+
+#else // _DEBUG not defined 
 // ===========================================================================
 
 #define LOG( s )
@@ -151,8 +153,9 @@
 #define LOG_FUNC_EXIT 
 #define LEAVE( exp ) User::Leave( exp );
 #define LEAVEIFERROR( exp ) User::LeaveIfError( exp );
-#define PANIC( err ) User::Panic( KUsbPanicModule, err );
+#define PANIC( err ) // in non-debug builds PANICs are silent
 #define LOG_FUNC
+#define ASSERT_PANIC( exp, code )
 // ===========================================================================
 #endif // _DEBUG
 // ===========================================================================