Skip to content

Trace: process else and elseif commands correctly

Braulio Valdivielso requested to merge brauliovaldivielso/cmake:fix-23191 into master

There have been two bugs reported about the else and elseif commands in the context of the tracing functionality and the json-v1 format (#23191 (closed) #22315 (closed)). In essence, the reported traces referred to the layer of the stacktrace immediately on top of the expected ones.

This MR fixes both issues. My solution adds a new parameter to the PrintCommandTrace function, commandMissingFromStack, that callers can specify if the command they want to report a trace for is not a regular part of the stack maintained in cmMakefile. This is only the case for else and elseif. The other bug is fixed by having the caller pass a cmListFileBacktrace, which helps in getting the right lines, file names... for the reported command.

Fixes: #23191 (closed) #22315 (closed)

Merge request reports