kerneltest/e32test/system/t_atomic_common.cpp
branchRCL_3
changeset 256 c1f20ce4abcf
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/system/t_atomic_common.cpp	Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/e32test/system/t_atomic_common.cpp	Tue Aug 31 16:34:26 2010 +0300
@@ -39,6 +39,35 @@
 	DEBUGPRINT("Line %d: " #x "=%02x %02x %02x %02x  %02x %02x %02x %02x", __LINE__, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);	\
 	}
 
+#ifdef __WINS__
+#pragma warning( disable : 4127 )   // disable warning warning C4127: conditional expression is constant
+#endif
+template<typename T> void DebugPrintVar(T x, char *name, TInt line)
+	{
+	const TUint8 *p = (const TUint8 *)&x;
+	const TInt size = sizeof(T);
+	if (size < 2)
+		{
+		DEBUGPRINT("Line %d: %s =%02x", line, name, p[0]);
+		}
+	else if (size < 4)
+		{
+		DEBUGPRINT("Line %d: %s =%02x %02x", line, name, p[0], p[1]);
+		}
+	else if (size < 8)
+		{
+		DEBUGPRINT("Line %d: %s =%02x %02x %02x %02x", line, name, p[0], p[1], p[2], p[3]);
+		}
+	else
+		{
+		DEBUGPRINT("Line %d: %s =%02x %02x %02x %02x  %02x %02x %02x %02x", line, name, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
+		}
+	}
+#ifdef __WINS__
+#pragma warning( default : 4127 )   // disable warning warning C4127: conditional expression is constant
+#endif
+
+
 extern "C" {
 
 // Simulated versions of atomic functions without the atomicity
@@ -281,9 +310,10 @@
 
 #define	DEBUGPRINTxyrc()	\
 		DEBUGPRINTVAR(x);	\
-		DEBUGPRINTVAR(y);	\
-		DEBUGPRINTVAR(r);	\
-		DEBUGPRINTVAR(c)
+		DebugPrintVar(y, "y", __LINE__);	\
+		DebugPrintVar(r, "r", __LINE__);	\
+		DebugPrintVar(c, "c", __LINE__)
+
 
 template<class T> TInt DoLoadTest(TInt aIndex, TAny* aPtr, T aInitialValue)
 	{
@@ -396,10 +426,10 @@
 		{
 		DEBUGPRINT("r=%d",r);
 		DEBUGPRINTVAR(x);
-		DEBUGPRINTVAR(ex);
+		DebugPrintVar(ex, "ex", __LINE__);
 		DEBUGPRINT("c=%d",c);
-		DEBUGPRINTVAR(y);
-		DEBUGPRINTVAR(ey);
+		DebugPrintVar(y, "y", __LINE__);
+		DebugPrintVar(ey, "ey", __LINE__);
 		}
 	return line;
 	}