apicompatanamdw/compatanalysercmd/headeranalyser/src/Analyser.cpp
changeset 12 a0eee409ff14
parent 3 ebe3f8f03b59
--- a/apicompatanamdw/compatanalysercmd/headeranalyser/src/Analyser.cpp	Mon Sep 20 10:04:46 2010 +0100
+++ b/apicompatanamdw/compatanalysercmd/headeranalyser/src/Analyser.cpp	Mon Sep 27 14:51:17 2010 +0530
@@ -882,8 +882,9 @@
 				}
 			}
 			// END -- Support for multiple header directories
-			
 			string forcedHeader;
+			string baseForcedHeader;
+			string curForcedHeader;
 			char* base = new char[KMaxDirLength+1];
 			getcwd(base, KMaxDirLength);
 
@@ -942,6 +943,9 @@
 						const vector<string>& bIncs = iBasePlatformData->IncludesForHeader(baseHdr);                    
 						forcedHeader.clear();
 						forcedHeader = baseHdr->CachedForcedInclude();
+						// If the component contains all SHAi headers, then no need to include the deafult forced header.
+						if (forcedHeader == FORCED_SHAI_HDR)
+							baseForcedHeader = forcedHeader;
 						// Find all include paths that are needed in compilation of this header:
 						const vector<string>& bPaths = iBasePlatformData->IncludePathsForHeader(baseHdr);                    
 
@@ -1027,6 +1031,10 @@
 						const vector<string>& cIncs = iProductPlatformData->IncludesForHeader(currHeader, baseHdr);                        
 						forcedHeader.clear();
 						forcedHeader =currHeader->CachedForcedInclude(); 
+						// If the component contains all SHAi headers, then no need to include the deafult forced header.
+						if (forcedHeader == FORCED_SHAI_HDR)
+							curForcedHeader = forcedHeader;
+
 						const vector<string>& cPaths =iProductPlatformData->IncludePathsForHeader(currHeader);                        
 
 						// Add include paths to the list, if it does not exist there yet:
@@ -1128,9 +1136,16 @@
 			parser->setTemp(iParams.getParameter(TEMPDIR));
 			parser2->setTemp(iParams.getParameter(TEMPDIR));
 
-			// Set forced headers 
-			parser->setForcedHeaders(iForcedBaselineHeaders);
-			parser2->setForcedHeaders(iForcedCurrentHeaders);
+			// If this bundle is for SHAi headers, then ignore iForcedHeaders 
+			//to solve Kernel Macro related compilation issues.
+			if(baseForcedHeader.size() == 0 )
+			{
+				parser->setForcedHeaders(iForcedBaselineHeaders);			
+			}
+			if(curForcedHeader.size() == 0 )
+			{
+				parser2->setForcedHeaders(iForcedCurrentHeaders);			
+			}
 			
 			if (createThread)
 			{		
@@ -2595,31 +2610,28 @@
 
 				for(int j = 0; j < (int)cIncludes.size(); j++) 
 				{
-					bool fileMatched = false;
-					chdr= curSystemheaders.begin();
-					for(;chdr != curSystemheaders.end(); chdr++)
+					bool fileMatched = false;					
+					if(bString == cIncludes.at(j))
 					{
-						pair<string,string> curHeader = *chdr;
-						string curFile = curHeader.first + DIR_SEPARATOR + cIncludes.at(j);
-						int loc = (int)curFile.find_last_of(DIR_SEPARATOR);
-						string curTemp = curFile.substr(loc+1 ,string::npos);
-						if(bString == curTemp)
+						includedHeaderPresent = true;
+						chdr= curSystemheaders.begin();
+						for(;chdr != curSystemheaders.end(); chdr++)
 						{
-							includedHeaderPresent = true;
+							pair<string,string> curHeader = *chdr;						
+							string curFile = curHeader.first + DIR_SEPARATOR + cIncludes.at(j);							
 							if(BBCFileUtils::FileExists(curFile) ) 
 							{
 								fileMatched = true; // current file found in curr dir
 								includes.at(out).second = curFile;
 								break;
-							}							
+							}
 						}
-					}
-
-					if ( fileMatched = false )
-					{
-						// file does not exists in curdir
-						report.addIssue(baseResource.RHFileName, includes.at(out).first, EIssueIdentityFile, 
-							EIssueTypeRemoval,ESeverityBBCBreak,ESeveritySCNULL, "", 0, "",curResource.RHFileName,"");
+						if ( fileMatched == false )
+						{
+							// file does not exists in curdir
+							report.addIssue(baseResource.RHFileName, includes.at(out).first, EIssueIdentityFile, 
+								EIssueTypeRemoval,ESeverityBBCBreak,ESeveritySCNULL, "", 0, "",curResource.RHFileName,"");
+						}
 						break;
 					}
 				}