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