Bugfix: Apply --relative-paths also to preprocessor errors
Merged from LCppC
This commit is contained in:
parent
f836c7a546
commit
1a7595e29b
|
@ -574,7 +574,11 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
const ErrorMessage::FileLocation loc1(output.location.file(), output.location.line, output.location.col);
|
std::string file = Path::fromNativeSeparators(output.location.file());
|
||||||
|
if (mSettings.relativePaths)
|
||||||
|
file = Path::getRelativePath(file, mSettings.basePaths);
|
||||||
|
|
||||||
|
const ErrorMessage::FileLocation loc1(file, output.location.line, output.location.col);
|
||||||
std::list<ErrorMessage::FileLocation> callstack(1, loc1);
|
std::list<ErrorMessage::FileLocation> callstack(1, loc1);
|
||||||
|
|
||||||
ErrorMessage errmsg(callstack,
|
ErrorMessage errmsg(callstack,
|
||||||
|
|
|
@ -810,7 +810,11 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const
|
||||||
{
|
{
|
||||||
std::list<ErrorMessage::FileLocation> locationList;
|
std::list<ErrorMessage::FileLocation> locationList;
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
const ErrorMessage::FileLocation loc(filename, linenr, 0);
|
std::string file = Path::fromNativeSeparators(filename);
|
||||||
|
if (mSettings.relativePaths)
|
||||||
|
file = Path::getRelativePath(file, mSettings.basePaths);
|
||||||
|
|
||||||
|
const ErrorMessage::FileLocation loc(file, linenr, 0);
|
||||||
locationList.push_back(loc);
|
locationList.push_back(loc);
|
||||||
}
|
}
|
||||||
mErrorLogger->reportErr(ErrorMessage(locationList,
|
mErrorLogger->reportErr(ErrorMessage(locationList,
|
||||||
|
|
Loading…
Reference in New Issue