From 40dcab0b6bebb0f9812c5dce36a23177fc891dbd Mon Sep 17 00:00:00 2001 From: Daniel Marjamaki Date: Tue, 25 Oct 2011 18:16:03 +0200 Subject: [PATCH] Preprocessor: Report missing includes during 'normal' preprocessing. Ticket: #2131 --- lib/preprocessor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index a03816c72..8280e96e1 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -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; }