Preprocessor: Report missing includes during 'normal' preprocessing. Ticket: #2131
This commit is contained in:
parent
2b11648a24
commit
40dcab0b6b
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue