| 2805 | } |
| 2806 | |
| 2807 | static target_state |
| 2808 | execute_impl (action a, target& t) |
| 2809 | { |
| 2810 | context& ctx (t.ctx); |
| 2811 | |
| 2812 | target::opstate& s (t[a]); |
| 2813 | |
| 2814 | assert (s.task_count.load (memory_order_consume) == t.ctx.count_busy () |
| 2815 | && s.state == target_state::unknown); |
| 2816 | |
| 2817 | target_state ts; |
| 2818 | try |
| 2819 | { |
| 2820 | // Handle target backlinking to forwarded configurations. |
| 2821 | // |
| 2822 | // Note that this function will never be called if the recipe is noop |
| 2823 | // which is ok since such targets are probably not interesting for |
| 2824 | // backlinking. |
| 2825 | // |
| 2826 | // Note also that for group members (both ad hoc and non) backlinking is |
| 2827 | // handled when updating/cleaning the group. |
| 2828 | // |
| 2829 | backlinks bls; |
| 2830 | optional<backlink_mode> blm; |
| 2831 | |
| 2832 | // Note that we may have a group but it may not be built so we also |
| 2833 | // checked that it's matched (and thus will be executed). Likewise, |
| 2834 | // the group may not be backlinked as a whole, but the member might. |
| 2835 | // |
| 2836 | // The matched() test is not perfect (the group may end up being matched |
| 2837 | // in order to be resolved but not executed) but it's good enough for |
| 2838 | // now. |
| 2839 | // |
| 2840 | // Note: matched so the group must be already resolved. |
| 2841 | // |
| 2842 | if (t.group == nullptr || |
| 2843 | !t.group->matched (a) || |
| 2844 | !backlink_test (a, *t.group)) |
| 2845 | { |
| 2846 | blm = backlink_test (a, t); |
| 2847 | |
| 2848 | if (blm) |
| 2849 | { |
| 2850 | if (a == perform_update_id) |
| 2851 | { |
| 2852 | bls = backlink_update_pre (a, t, *blm); |
| 2853 | if (bls.empty ()) |
| 2854 | blm = nullopt; |
| 2855 | } |
| 2856 | else |
| 2857 | backlink_clean_pre (a, t, *blm); |
| 2858 | } |
| 2859 | } |
| 2860 | |
| 2861 | // Note: see similar code in set_rule_trace() for match. |
| 2862 | // |
| 2863 | if (ctx.trace_execute != nullptr && trace_target (t, *ctx.trace_execute)) |
| 2864 | { |
no test coverage detected