Skip to content

Ninja: Avoid empty phony edges for target ordering

Brad King requested to merge brad.king/cmake:ninja-issue-17942 into master

Since !430 (merged) we unconditionally generate a phony edge for target ordering. It is needed in case a later target depends on it. However, if the phony edge has no inputs then ninja -d explain prints:

ninja explain: output ... of phony edge with no inputs doesn't exist

Furthermore the phony edge's output is considered dirty and can cause dependents to be incorrectly considered dirty. Avoid this by always generating at least one input to the target ordering phony edges. If we have no real dependencies just use a path that always exists.

While at it, fix two other bugs that together with this one produce the strange behavior described in #17942 (closed).

Fixes: #17942 (closed)

Edited by Brad King

Merge request reports