diff -r bdd2944b914b -r a0eee409ff14 apicompatanamdw/compatanalysercmd/headeranalyser/src/MacroAnalyser.cpp --- a/apicompatanamdw/compatanalysercmd/headeranalyser/src/MacroAnalyser.cpp Mon Sep 20 10:04:46 2010 +0100 +++ b/apicompatanamdw/compatanalysercmd/headeranalyser/src/MacroAnalyser.cpp Mon Sep 27 14:51:17 2010 +0530 @@ -86,7 +86,8 @@ removedbegin = iRemoved.find(basefilename); if (removedbegin != iRemoved.end()) { - map,string> > >::iterator cur = current.find(curfilename); + // serach the macro value elemnts with key value "key_val_CURRENT",defined for Current file + map,string> > >::iterator cur = current.find(KEY_VAL_CURRENT); if (cur == current.end()) // We need to check if there is a list with given filename // because they aren't created in situation where there isn't any macros { // specific to that file or the include guard for the file is duplicated. @@ -108,7 +109,7 @@ if(base->second.size() > 0) aMacroFiles.push_back(toLowerCaseWin(base->first)); if(cur->second.size() > 0) - aMacroFiles.push_back(toLowerCaseWin(cur->first)); + aMacroFiles.push_back(toLowerCaseWin(curfilename)); // After next loop we will have in list only those which has been either removed or changed list,string> >::iterator begin = cur->second.begin(); @@ -236,7 +237,7 @@ // MacroAnalyser::parseMacros // ---------------------------------------------------------------------------- // -map,string> > > MacroAnalyser::parseMacros(ifstream& aFile, vector& bundlefiles, map > > >* aRemoved, bool aAddToRemoved) +map,string> > > MacroAnalyser::parseMacros(ifstream& aFile, vector& bundlefiles, map > > >* aRemoved, bool isbaseline) { // ret, is the file and related set of macros returned by the function map,string> > > ret; @@ -251,7 +252,7 @@ // Read macrofiles as lines string cline; string levelname = ""; - bool isbundle = false; + bool isFileMatched = false; while((cline = getLine(aFile)) != KEmpty) { string line = cline; @@ -305,23 +306,31 @@ // found the levelname; filename correctedname += levelname.substr(start); levelname = toLowerCaseWin(correctedname); + isFileMatched = false; - vector >::iterator begin = files.begin(); - vector >::iterator end = files.end(); - - isbundle = false; - for(; begin != end; begin++) - { - if (begin->first == levelname) - { - isbundle = true; - levelname = begin->second; - break; - } - } + // For baseline, need to list only those macros,which are belonging to bundle files. + if (isbaseline == true) + { + vector >::iterator begin = files.begin(); + vector >::iterator end = files.end(); + for(; begin != end; begin++) + { + if (begin->first == levelname) + { + isFileMatched = true; + levelname = begin->second; + break; + } + } + } + else // current macro file, so search macros in the entire file + { + isFileMatched = true; + levelname = KEY_VAL_CURRENT; // set a generic key_val for all current macros + } } } - else if (isbundle == true && length > 8 && line.substr(0, 8) == "#define ") + else if (isFileMatched == true && length > 8 && line.substr(0, 8) == "#define ") { // we found preprocessor directive #define pair macro = FindMacro(line); // 'ret' contains the set of files and associated macros to be returned from function @@ -359,7 +368,7 @@ } // perform the same test as above on aRemoved data structure // this will be used for finding any duplicate macro definitions - if (aAddToRemoved == true) + if (isbaseline == true) { pair temp(macro.first,tempNo); map > > >::iterator found2 = aRemoved->find(levelname);