apicompatanamdw/compatanalysercmd/headeranalyser/src/Analyser.cpp
changeset 12 a0eee409ff14
parent 3 ebe3f8f03b59
equal deleted inserted replaced
11:bdd2944b914b 12:a0eee409ff14
   880 				{
   880 				{
   881 					currIncPaths.push_back(iter2->first);
   881 					currIncPaths.push_back(iter2->first);
   882 				}
   882 				}
   883 			}
   883 			}
   884 			// END -- Support for multiple header directories
   884 			// END -- Support for multiple header directories
   885 			
       
   886 			string forcedHeader;
   885 			string forcedHeader;
       
   886 			string baseForcedHeader;
       
   887 			string curForcedHeader;
   887 			char* base = new char[KMaxDirLength+1];
   888 			char* base = new char[KMaxDirLength+1];
   888 			getcwd(base, KMaxDirLength);
   889 			getcwd(base, KMaxDirLength);
   889 
   890 
   890 			vector< stringpair > tmpfiles;	
   891 			vector< stringpair > tmpfiles;	
   891 			vector< stringpair > invalid;
   892 			vector< stringpair > invalid;
   940 					{                       
   941 					{                       
   941 						// Find all additional includes that are needed in compilation of this header:   
   942 						// Find all additional includes that are needed in compilation of this header:   
   942 						const vector<string>& bIncs = iBasePlatformData->IncludesForHeader(baseHdr);                    
   943 						const vector<string>& bIncs = iBasePlatformData->IncludesForHeader(baseHdr);                    
   943 						forcedHeader.clear();
   944 						forcedHeader.clear();
   944 						forcedHeader = baseHdr->CachedForcedInclude();
   945 						forcedHeader = baseHdr->CachedForcedInclude();
       
   946 						// If the component contains all SHAi headers, then no need to include the deafult forced header.
       
   947 						if (forcedHeader == FORCED_SHAI_HDR)
       
   948 							baseForcedHeader = forcedHeader;
   945 						// Find all include paths that are needed in compilation of this header:
   949 						// Find all include paths that are needed in compilation of this header:
   946 						const vector<string>& bPaths = iBasePlatformData->IncludePathsForHeader(baseHdr);                    
   950 						const vector<string>& bPaths = iBasePlatformData->IncludePathsForHeader(baseHdr);                    
   947 
   951 
   948 						// Add include paths for baseline platform headers:   
   952 						// Add include paths for baseline platform headers:   
   949 						// START -- Support for multiple header directories                                     
   953 						// START -- Support for multiple header directories                                     
  1025 
  1029 
  1026 						// Find additional includes and include paths for the current platform's header:
  1030 						// Find additional includes and include paths for the current platform's header:
  1027 						const vector<string>& cIncs = iProductPlatformData->IncludesForHeader(currHeader, baseHdr);                        
  1031 						const vector<string>& cIncs = iProductPlatformData->IncludesForHeader(currHeader, baseHdr);                        
  1028 						forcedHeader.clear();
  1032 						forcedHeader.clear();
  1029 						forcedHeader =currHeader->CachedForcedInclude(); 
  1033 						forcedHeader =currHeader->CachedForcedInclude(); 
       
  1034 						// If the component contains all SHAi headers, then no need to include the deafult forced header.
       
  1035 						if (forcedHeader == FORCED_SHAI_HDR)
       
  1036 							curForcedHeader = forcedHeader;
       
  1037 
  1030 						const vector<string>& cPaths =iProductPlatformData->IncludePathsForHeader(currHeader);                        
  1038 						const vector<string>& cPaths =iProductPlatformData->IncludePathsForHeader(currHeader);                        
  1031 
  1039 
  1032 						// Add include paths to the list, if it does not exist there yet:
  1040 						// Add include paths to the list, if it does not exist there yet:
  1033 						for( vector<string>::const_iterator i = cPaths.begin(); i != cPaths.end(); ++i )
  1041 						for( vector<string>::const_iterator i = cPaths.begin(); i != cPaths.end(); ++i )
  1034 						{
  1042 						{
  1126 
  1134 
  1127 			// Set temp directories for parsers
  1135 			// Set temp directories for parsers
  1128 			parser->setTemp(iParams.getParameter(TEMPDIR));
  1136 			parser->setTemp(iParams.getParameter(TEMPDIR));
  1129 			parser2->setTemp(iParams.getParameter(TEMPDIR));
  1137 			parser2->setTemp(iParams.getParameter(TEMPDIR));
  1130 
  1138 
  1131 			// Set forced headers 
  1139 			// If this bundle is for SHAi headers, then ignore iForcedHeaders 
  1132 			parser->setForcedHeaders(iForcedBaselineHeaders);
  1140 			//to solve Kernel Macro related compilation issues.
  1133 			parser2->setForcedHeaders(iForcedCurrentHeaders);
  1141 			if(baseForcedHeader.size() == 0 )
       
  1142 			{
       
  1143 				parser->setForcedHeaders(iForcedBaselineHeaders);			
       
  1144 			}
       
  1145 			if(curForcedHeader.size() == 0 )
       
  1146 			{
       
  1147 				parser2->setForcedHeaders(iForcedCurrentHeaders);			
       
  1148 			}
  1134 			
  1149 			
  1135 			if (createThread)
  1150 			if (createThread)
  1136 			{		
  1151 			{		
  1137 				//if the number of threads in this group has reached pre-defined max count, destroy all the threads in this group before creating one.
  1152 				//if the number of threads in this group has reached pre-defined max count, destroy all the threads in this group before creating one.
  1138 				//boost::thread_group object does not destroy a thread when it goes to completion. if the threads are not destroyed lot of memory will be eaten up unneccessarily
  1153 				//boost::thread_group object does not destroy a thread when it goes to completion. if the threads are not destroyed lot of memory will be eaten up unneccessarily
  2593 				string bString = includes.at(out).first.substr(bLoc+1,string::npos);
  2608 				string bString = includes.at(out).first.substr(bLoc+1,string::npos);
  2594 				bool includedHeaderPresent = false;
  2609 				bool includedHeaderPresent = false;
  2595 
  2610 
  2596 				for(int j = 0; j < (int)cIncludes.size(); j++) 
  2611 				for(int j = 0; j < (int)cIncludes.size(); j++) 
  2597 				{
  2612 				{
  2598 					bool fileMatched = false;
  2613 					bool fileMatched = false;					
  2599 					chdr= curSystemheaders.begin();
  2614 					if(bString == cIncludes.at(j))
  2600 					for(;chdr != curSystemheaders.end(); chdr++)
       
  2601 					{
  2615 					{
  2602 						pair<string,string> curHeader = *chdr;
  2616 						includedHeaderPresent = true;
  2603 						string curFile = curHeader.first + DIR_SEPARATOR + cIncludes.at(j);
  2617 						chdr= curSystemheaders.begin();
  2604 						int loc = (int)curFile.find_last_of(DIR_SEPARATOR);
  2618 						for(;chdr != curSystemheaders.end(); chdr++)
  2605 						string curTemp = curFile.substr(loc+1 ,string::npos);
       
  2606 						if(bString == curTemp)
       
  2607 						{
  2619 						{
  2608 							includedHeaderPresent = true;
  2620 							pair<string,string> curHeader = *chdr;						
       
  2621 							string curFile = curHeader.first + DIR_SEPARATOR + cIncludes.at(j);							
  2609 							if(BBCFileUtils::FileExists(curFile) ) 
  2622 							if(BBCFileUtils::FileExists(curFile) ) 
  2610 							{
  2623 							{
  2611 								fileMatched = true; // current file found in curr dir
  2624 								fileMatched = true; // current file found in curr dir
  2612 								includes.at(out).second = curFile;
  2625 								includes.at(out).second = curFile;
  2613 								break;
  2626 								break;
  2614 							}							
  2627 							}
  2615 						}
  2628 						}
  2616 					}
  2629 						if ( fileMatched == false )
  2617 
  2630 						{
  2618 					if ( fileMatched = false )
  2631 							// file does not exists in curdir
  2619 					{
  2632 							report.addIssue(baseResource.RHFileName, includes.at(out).first, EIssueIdentityFile, 
  2620 						// file does not exists in curdir
  2633 								EIssueTypeRemoval,ESeverityBBCBreak,ESeveritySCNULL, "", 0, "",curResource.RHFileName,"");
  2621 						report.addIssue(baseResource.RHFileName, includes.at(out).first, EIssueIdentityFile, 
  2634 						}
  2622 							EIssueTypeRemoval,ESeverityBBCBreak,ESeveritySCNULL, "", 0, "",curResource.RHFileName,"");
       
  2623 						break;
  2635 						break;
  2624 					}
  2636 					}
  2625 				}
  2637 				}
  2626 				if(includedHeaderPresent == false)
  2638 				if(includedHeaderPresent == false)
  2627 				{
  2639 				{