ENH: Improve context for errors in macros
We now properly report the source location of command arguments inside macros instead of using the macro invocation site. No information is lost because full call-stack information is already reported.
This commit is contained in:
parent
d524f3675e
commit
dbd88e00c7
|
@ -129,13 +129,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
|
||||||
newLFF.Name = this->Functions[c].Name;
|
newLFF.Name = this->Functions[c].Name;
|
||||||
newLFF.FilePath = this->Functions[c].FilePath;
|
newLFF.FilePath = this->Functions[c].FilePath;
|
||||||
newLFF.Line = this->Functions[c].Line;
|
newLFF.Line = this->Functions[c].Line;
|
||||||
const char* def = this->Makefile->GetDefinition
|
|
||||||
("CMAKE_MACRO_REPORT_DEFINITION_LOCATION");
|
|
||||||
bool macroReportLocation = false;
|
|
||||||
if(def && !cmSystemTools::IsOff(def))
|
|
||||||
{
|
|
||||||
macroReportLocation = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for each argument of the current function
|
// for each argument of the current function
|
||||||
for (std::vector<cmListFileArgument>::const_iterator k =
|
for (std::vector<cmListFileArgument>::const_iterator k =
|
||||||
|
@ -212,28 +205,8 @@ bool cmMacroHelperCommand::InvokeInitialPass
|
||||||
|
|
||||||
arg.Value = tmps;
|
arg.Value = tmps;
|
||||||
arg.Quoted = k->Quoted;
|
arg.Quoted = k->Quoted;
|
||||||
if(macroReportLocation)
|
arg.FilePath = k->FilePath;
|
||||||
{
|
arg.Line = k->Line;
|
||||||
// Report the location of the argument where the macro was
|
|
||||||
// defined.
|
|
||||||
arg.FilePath = k->FilePath;
|
|
||||||
arg.Line = k->Line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Report the location of the argument where the macro was
|
|
||||||
// invoked.
|
|
||||||
if (args.size())
|
|
||||||
{
|
|
||||||
arg.FilePath = args[0].FilePath;
|
|
||||||
arg.Line = args[0].Line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arg.FilePath = "Unknown";
|
|
||||||
arg.Line = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newLFF.Arguments.push_back(arg);
|
newLFF.Arguments.push_back(arg);
|
||||||
}
|
}
|
||||||
cmExecutionStatus status;
|
cmExecutionStatus status;
|
||||||
|
|
Loading…
Reference in New Issue