@@ -45,16 +45,21 @@ bool ProjectGenerator::outputProjectDCE(const StaticList& includeDirs)
4545 findFiles (m_projectDir + " *.cpp" , searchFiles, recurse);
4646#endif
4747 // Ensure we can add extra items to the list without needing reallocs
48- searchFiles.reserve ((searchFiles.size () * 3 ) + 250 );
48+ searchFiles.reserve ((( searchFiles.size () + m_includesH. size ()) * 3 ) + 500 );
4949
5050 // Check for DCE constructs
5151 map<string, DCEParams> foundDCEUsage;
5252 set<string> nonDCEUsage;
5353 StaticList preProcFiles;
54- // Search through each included file
5554 for (auto itFile = searchFiles.begin (); itFile < searchFiles.end (); ++itFile) {
56- // Open the input file
5755 m_configHelper.makeFileGeneratorRelative (*itFile, *itFile);
56+ if (itFile->find (" ./" ) == 0 ) {
57+ *itFile = itFile->substr (2 );
58+ }
59+ }
60+ // Search through each included file
61+ for (auto itFile = searchFiles.cbegin (); itFile < searchFiles.cend (); ++itFile) {
62+ // Open the input file
5863 string file;
5964 if (!loadFromFile (*itFile, file)) {
6065 return false ;
@@ -96,7 +101,7 @@ bool ProjectGenerator::outputProjectDCE(const StaticList& includeDirs)
96101 if (!findFile (templateFile, found)) {
97102 templateFile = itFile->substr (0 , itFile->rfind (' /' ) + 1 ) + back;
98103 if (!findFile (templateFile, found)) {
99- templateFile = m_configHelper.m_solutionDirectory + ' / ' + back;
104+ templateFile = m_configHelper.m_solutionDirectory + back;
100105 if (!findFile (templateFile, found)) {
101106 // Fail only if this is a c file
102107 if (ext == extensions[0 ]) {
@@ -110,9 +115,10 @@ bool ProjectGenerator::outputProjectDCE(const StaticList& includeDirs)
110115 }
111116 }
112117 // Add the file to the list
113- if (templateFile.length () >= 3 &&
114- find (searchFiles.begin (), searchFiles.end (), templateFile) == searchFiles.end ()) {
115- m_configHelper.makeFileProjectRelative (templateFile, templateFile);
118+ if (templateFile.length () >= 3 ) {
119+ if (templateFile.find (" ./" ) == 0 ) {
120+ templateFile = templateFile.substr (2 );
121+ }
116122 if (find (searchFiles.begin (), searchFiles.end (), templateFile) == searchFiles.end ()) {
117123 searchFiles.push_back (templateFile);
118124 }
@@ -132,9 +138,7 @@ bool ProjectGenerator::outputProjectDCE(const StaticList& includeDirs)
132138 findFiles (m_projectDir + " *.c" , searchFiles, recurse);
133139 findFiles (m_projectDir + " *.cpp" , searchFiles, recurse);
134140 // Ensure we can add extra items to the list without needing reallocs
135- if (searchFiles.capacity () < searchFiles.size () + 250 ) {
136- searchFiles.reserve (searchFiles.size () + 250 );
137- }
141+ searchFiles.reserve (searchFiles.size () + 750 );
138142
139143 // Check all configurations are enabled early to avoid later lookups of unused functions
140144 for (auto i = foundDCEUsage.begin (); i != foundDCEUsage.end ();) {
0 commit comments