Preprocessor: Report missing includes during 'normal' preprocessing. Ticket: #2131

This commit is contained in:
Daniel Marjamaki 2011-10-25 18:16:03 +02:00
parent 2b11648a24
commit 40dcab0b6b
1 changed files with 5 additions and 0 deletions

View File

@ -1746,10 +1746,14 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str
// then no more #elif or #else can be true before the #endif is seen.
bool elseIsTrue = true;
unsigned int linenr = 0;
std::ostringstream ostr;
std::istringstream istr(code);
std::string line;
while (std::getline(istr,line)) {
++linenr;
if (line.compare(0,9,"#include ")==0) {
std::string filename(line.substr(9));
@ -1763,6 +1767,7 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str
std::ifstream fin;
if (!openHeader(filename, includePaths, headerType == UserHeader ? path : std::string(""), fin)) {
ostr << std::endl;
missingInclude(filePath, linenr, filename, headerType == UserHeader);
continue;
}