1) Fix for Bug 3027 - [GCCE] Unintended operator precedence in ambiguous expressions GCC_SURGE
authormikek
Sat, 19 Jun 2010 07:49:33 +0100
branchGCC_SURGE
changeset 167 b41fc9c39ca7
parent 166 d7c1885c0106
child 168 c46cf809d044
1) Fix for Bug 3027 - [GCCE] Unintended operator precedence in ambiguous expressions 2) Fix for Bug 3034 - [GCCE] FLASH_BUS macros are ambiguous w.r.t operator precedence
bsptemplate/asspandvariant/template_variant/inc/lffsdev.h
kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.cpp
kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.inl
kernel/eka/drivers/ecomm/d_comm.cpp
kernel/eka/drivers/pbus/mmc/stack.cpp
kernel/eka/drivers/trace/btracec.cpp
kernel/eka/drivers/usbcsc/d_usbcsc.cpp
kernel/eka/drivers/usbcsc/usbcsc_bil.cpp
kernel/eka/ewsrv/ky_tran.cpp
kernel/eka/include/page_alloc.h
kernel/eka/kernel/kdebug.cpp
kernel/eka/kernel/smonitor.cpp
kernel/eka/kernel/sprocess.cpp
kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp
userlibandfileserver/fileserver/sfat/sl_utl.cpp
userlibandfileserver/fileserver/sfat32/sl_utl.cpp
userlibandfileserver/fileserver/sfile/sf_thread.cpp
userlibandfileserver/fileserver/sfsrv/cl_fman.cpp
--- a/bsptemplate/asspandvariant/template_variant/inc/lffsdev.h	Fri Jun 18 18:06:39 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/inc/lffsdev.h	Sat Jun 19 07:49:33 2010 +0100
@@ -47,18 +47,18 @@
 
 #if FLASH_BUS_WIDTH == 32
 	#define TFLASHWORD TUint32
-	#define FLASH_BYTES_TO_WORDS(aNumBytes) (aNumBytes >> 2)
-	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) (aWordAddr << 2)
+	#define FLASH_BYTES_TO_WORDS(aNumBytes) ((aNumBytes) >> 2)
+	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) ((aWordAddr) << 2)
 	#define FLASH_ERASE_WORD_VALUE 0xFFFFFFFF
 #elif FLASH_BUS_WIDTH == 16
 	#define TFLASHWORD TUint16
-	#define FLASH_BYTES_TO_WORDS(aNumBytes) (aNumBytes >> 1)
-	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) (aWordAddr << 1)
+	#define FLASH_BYTES_TO_WORDS(aNumBytes) ((aNumBytes) >> 1)
+	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) ((aWordAddr) << 1)
 	#define FLASH_ERASE_WORD_VALUE 0xFFFF
 #else	// FLASH_BUS_WIDTH == 8
 	#define TFLASHWORD TUint8
-	#define FLASH_BYTES_TO_WORDS(aNumBytes) aNumBytes
-	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) aWordAddr
+	#define FLASH_BYTES_TO_WORDS(aNumBytes) (aNumBytes)
+	#define FLASH_ADDRESS_IN_BYTES(aWordAddr) (aWordAddr)
 	#define FLASH_ERASE_WORD_VALUE 0xFF
 #endif
 
--- a/kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -872,7 +872,7 @@
 				// 
 
 				// ARM ARM DDI0406A - section A8.6.26
-				if (inst32 & 0xFFF0FFFF == 0xE3C08F00)
+				if ((inst32 & 0xFFF0FFFF) == 0xE3C08F00)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.26 - BXJ is not supported");
 
@@ -885,7 +885,7 @@
 				// ARM ARM DDi046A - section B6.1.13 - SUBS PC,LR
 				//
 				// Encoding T1
-				if (inst32 & 0xFFFFFF00 == 0xF3DE8F00)
+				if ((inst32 & 0xFFFFFF00) == 0xF3DE8F00)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section B6.1.13 - SUBS PC,LR Encoding T1");
 
@@ -911,7 +911,7 @@
 				// ARM ARM DDI0406A - section A8.6.16 - B
 				//
 				// Branch Encoding T3
-				if (inst32 & 0xF800D000 == 0xF0008000)
+				if ((inst32 & 0xF800D000) == 0xF0008000)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.16 - B Encoding T3");
 
@@ -936,7 +936,7 @@
 				// ARM ARM DDI0406A - section A8.6.16 - B
 				//
 				// Branch Encoding T4
-				if (inst32 & 0xF800D000 == 0xF0009000)
+				if ((inst32 & 0xF800D000) == 0xF0009000)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.16 - B");
 
@@ -965,7 +965,7 @@
 				// ARM ARM DDI0406A - section A8.6.225 - TBB, TBH
 				//
 				// Table Branch Byte, Table Branch Halfword
-				if (inst32 & 0xFFF0FFE0 == 0xE8D0F000)
+				if ((inst32 & 0xFFF0FFE0) == 0xE8D0F000)
 						{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.225 TBB,TBH Encoding T1");
 
@@ -1006,7 +1006,7 @@
 				// ARM ARM DDI0406A - section A8.6.55 - LDMDB, LDMEA
 				//
 				// LDMDB Encoding T1
-				if (inst32 & 0xFFD02000 == 0xE9100000)
+				if ((inst32 & 0xFFD02000) == 0xE9100000)
 					{
 					LOG_MSG("ARM ARM DDI0406 - section A8.6.55 LDMDB Encoding T1");
 
@@ -1052,7 +1052,7 @@
 				// ARM ARM DDI0406A - section A8.6.121 POP
 				//
 				// POP.W Encoding T2
-				if (inst32 & 0xFFFF2000 == 0xE8BD0000)
+				if ((inst32 & 0xFFFF2000) == 0xE8BD0000)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.121 POP Encoding T2");
 
@@ -1088,7 +1088,7 @@
 					}
 
 				// POP Encoding T3
-				if (inst32 & 0xFFFF0FFFF == 0xF85D0B04)
+				if ((inst32 & 0xFFFF0FFFF) == 0xF85D0B04)
 					{
 					LOG_MSG("ARM ARM DDI0406A - section A8.6.121 POP Encoding T3");
 
--- a/kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.inl	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/debug/rmdebug/d_rmd_stepping.inl	Sat Jun 19 07:49:33 2010 +0100
@@ -238,7 +238,7 @@
 {
 //#define ARM_B_ADDR(x)			((x & 0x00800000) ? ((TUint32)(x) & 0x00FFFFFF | 0xFF000000) : (TUint32)(x) & 0x00FFFFFF)
 
-	TUint32 aVal = ((aInst & 0x00800000) ? ((TUint32)(aInst) & 0x00FFFFFF | 0xFF000000) : (TUint32)(aInst) & 0x00FFFFFF);
+	TUint32 aVal = ((aInst & 0x00800000) ? (((TUint32)(aInst) & 0x00FFFFFF) | 0xFF000000) : (TUint32)(aInst) & 0x00FFFFFF);
 
 	return aVal;
 }
--- a/kernel/eka/drivers/ecomm/d_comm.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/ecomm/d_comm.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -933,7 +933,7 @@
 			{
 			// Replace bad character
 			if (iConfig.iParityError==KConfigParityErrorReplaceChar)
-				c = c & ~(0xff|KReceiveIsrParityError) | iConfig.iParityErrorChar;
+				c = (c & ~(0xff|KReceiveIsrParityError)) | iConfig.iParityErrorChar;
 			// Ignore parity error
 			if (iConfig.iParityError==KConfigParityErrorIgnore)
 				c = c & ~KReceiveIsrParityError;
--- a/kernel/eka/drivers/pbus/mmc/stack.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/pbus/mmc/stack.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -2453,8 +2453,8 @@
 
 		DISABLEPREEMPTION
 
-		if( !iAbortReq &&
-			((iStackState & KMMCStackStateWaitingDFC) ||
+		if( ((!iAbortReq &&
+			((iStackState & KMMCStackStateWaitingDFC))) ||
 			 (iCompReq | iInitialise | iAttention)==0) ||
 			 ((iSessionP) && (iSessionP->iState & KMMCSessStateAllowDirectCommands)))
 			{
--- a/kernel/eka/drivers/trace/btracec.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/trace/btracec.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -213,7 +213,7 @@
 		if (--retries<0)
 			return KErrInUse;
 		// sleep every 8 tries to give the write a chance
-		if (retries&7==0)
+		if ((retries&7)==0)
 			User::AfterHighRes(1);
 		g0 = iGeneration;
 		__e32_memory_barrier();
--- a/kernel/eka/drivers/usbcsc/d_usbcsc.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/usbcsc/d_usbcsc.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -3523,7 +3523,7 @@
 		}
 
 	
-	if (iBuffer && (iBuffer->iStatusList.iState) || (!iRealEpNumber))
+	if ((iBuffer && (iBuffer->iStatusList.iState)) || (!iRealEpNumber))
 		{
 		if (iRequestCallbackInfo->iTransferDir==EControllerWrite)
 			iController->CancelWriteBuffer(iLdd, iRealEpNumber);
--- a/kernel/eka/drivers/usbcsc/usbcsc_bil.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/drivers/usbcsc/usbcsc_bil.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -160,7 +160,7 @@
 	TUint localTail = endpointHdr->iBilTail;
 	TUsbcScTransferHeader* currentTransfer = (TUsbcScTransferHeader*) (base + localTail);
 
-	if ((localTail == (TUint)endpointHdr->iHead) || (currentTransfer->iAltSettingSeq != (iAltSettingSeq+1)&0xFFFF))
+	if ((localTail == (TUint)endpointHdr->iHead) || (currentTransfer->iAltSettingSeq != ((iAltSettingSeq+1)&0xFFFF)))
 		// if alternate setting has not changed
 		return KErrNotReady;
 	else
--- a/kernel/eka/ewsrv/ky_tran.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/ewsrv/ky_tran.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -451,8 +451,8 @@
 	iDigits+=ch.DigitValue();
 	iErrorFlag=(TBool)(iErrorFlag
 					  || !ch.IsDigitGivenRadix(iRadix)
-					  || (iTermination==ETerminationByCtrlUp)
-						  && ((aModifiers&EModifierCtrl)==0));
+					  || ((iTermination==ETerminationByCtrlUp)
+						  && ((aModifiers&EModifierCtrl)==0)));
 	}
 //
 TBool TCtrlDigits::Terminated(TInt aModifiers) const
--- a/kernel/eka/include/page_alloc.h	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/include/page_alloc.h	Sat Jun 19 07:49:33 2010 +0100
@@ -18,7 +18,7 @@
 #ifndef __KERNEL_MODE__ 
 
 const int MAXSMALLPAGEBITS = 68<<3;
-#define MINPAGEPOWER	PAGESHIFT+2
+#define MINPAGEPOWER	((PAGESHIFT)+2)
 
 struct paged_bitmap
 {
--- a/kernel/eka/kernel/kdebug.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/kernel/kdebug.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -563,7 +563,7 @@
 		DChunk* chunk = (DChunk*)a1;
 
 		//The chunk will not neccesarily have an owning process.
-		interested = hdrPresent && ( !chunk->iOwningProcess && hdr->iFlags & TFilterHeader::EGlobalEvents ||
+		interested = hdrPresent && ( (!chunk->iOwningProcess && hdr->iFlags & TFilterHeader::EGlobalEvents) ||
 				(chunk->iOwningProcess && DEventHandler::InterestedIn(aType, *(chunk->iOwningProcess->iName))));
 
 		Change() |= KDebuggerChangeChunk;
--- a/kernel/eka/kernel/smonitor.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/kernel/smonitor.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -655,7 +655,7 @@
 	__KTRACE_OPT(KALWAYS,Kern::Printf("All monitors have completed.  Restarting..."));
 	//Ensure all characters make it to the serial port...
 	__KTRACE_OPT(KALWAYS,Kern::Printf("                                           "));
-	if(restartType&ESoftRestart == ESoftRestart)
+	if((restartType&ESoftRestart) == ESoftRestart)
 		Kern::Restart(0);
 	else //EHardRestart
 		Kern::Restart(0x80000000);
--- a/kernel/eka/kernel/sprocess.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/kernel/sprocess.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -115,7 +115,7 @@
 TInt DProcess::SetPaging(const TProcessCreateInfo& aInfo)
 	{// Default implementation that only verifies flags, this virtual method 
 	// is overridden in memory models that support paging.
-	if (aInfo.iFlags & TProcessCreateInfo::EDataPagingMask == 
+	if ((aInfo.iFlags & TProcessCreateInfo::EDataPagingMask) == 
 		TProcessCreateInfo::EDataPagingMask)
 		{
 		return KErrCorrupt;	
--- a/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -396,9 +396,9 @@
 	aZone->iFlags &= ~KRamZoneFlagMark;	// clear the mark as this zone is active
 
 	// Check if power state of zone needs to be changed
-	if (iZonePowerFunc && !(iZonePwrState & (((TUint64)1) << aZone - iZones)))
+	if (iZonePowerFunc && !(iZonePwrState & (((TUint64)1) << (aZone - iZones))))
 		{//zone no longer empty so call variant to power RAM zone up if necessary
-		iZonePwrState |= (((TUint64)1) << aZone - iZones);
+		iZonePwrState |= (((TUint64)1) << (aZone - iZones));
 
 		if (iZoneCallbackInitSent)
 			{
@@ -541,7 +541,7 @@
 	if (iZonePowerFunc && !(aZone->iFlags & KRamZoneFlagClaiming) &&
 		aZone->iFreePages == aZone->iPhysPages)
 		{// Zone is empty so call variant to power down RAM zone if desirable.
-		TUint64 pwrMask = ~(((TUint64)1) << aZone - iZones);
+		TUint64 pwrMask = ~(((TUint64)1) << (aZone - iZones));
 		iZonePwrState &= pwrMask;
 
 		// Don't invoke callback until Init callback sent.
@@ -1009,7 +1009,7 @@
 		for (; zone2 < lastZone; zone2++)
 			{
 			if (zone->iPref > zone2->iPref ||
-				zone->iPref == zone2->iPref && zone->iFreePages > zone2->iFreePages)
+				(zone->iPref == zone2->iPref && zone->iFreePages > zone2->iFreePages))
 				{
 				lowerZones++;
 				}
--- a/userlibandfileserver/fileserver/sfat/sl_utl.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat/sl_utl.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -203,7 +203,7 @@
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w0 << 8)  >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ( w0 >> 24));
 
-    chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + (w1) & 0xFF);
+    chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + (w1 & 0xFF));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w1 << 16) >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w1 << 8)  >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ( w1 >> 24));
--- a/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -150,7 +150,7 @@
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w0 << 8)  >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ( w0 >> 24));
 
-    chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + (w1) & 0xFF);
+    chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + (w1 & 0xFF));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w1 << 16) >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ((w1 << 8)  >> 24));
     chkSum = (TUint8)(((chkSum<<7) | (chkSum>>1)) + ( w1 >> 24));
--- a/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -379,7 +379,7 @@
 	TUint id=RThread().Id();
 	if(aIsLock)
 		t.iFSLock.Wait();
-	TBool b = t.iIsAvailable && (!t.iIsSync && t.iId==id || t.iIsSync);
+	TBool b = t.iIsAvailable && ((!t.iIsSync && t.iId==id) || t.iIsSync);
 	if(aIsLock)
 		t.iFSLock.Signal();
 	return(b);
--- a/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Fri Jun 18 18:06:39 2010 +0100
+++ b/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Sat Jun 19 07:49:33 2010 +0100
@@ -2480,7 +2480,7 @@
 	TInt r=KErrNotFound;
 	if (iAction == EInternalRmDir ||
 	    (iAction == EInternalCopyForMove && ((iMatchEntry & KMovingFilesMask) != KMovingFilesMask) && !iMovingContents && !iSrcFile.IsRoot()) ||
-	    iAction == EInternalRenameForMove && !iMovingContents && iNumberOfFilesProcessed)
+	    (iAction == EInternalRenameForMove && !iMovingContents && iNumberOfFilesProcessed))
 		{
 		r=iFs.RmDir(iSrcFile.FullName());
 		if ((r!=KErrNone && r!=KErrNotFound && iAction!=EInternalRenameForMove && r!=KErrInUse) || (iAction == EInternalRmDir && r == KErrInUse))