From 90c21ebeced83c0c06d914b1bbdd69c4db7f5231 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 23 Feb 2021 09:41:00 +0100 Subject: [PATCH] Don't encourage mindless "fixes". Offering to remove a requirement for a missing universal that is present is to offer a rule change the ruleset author should think about first. The requirement vector may have been intended to never be fulfilled. Prevent mindless "fixes" by not offering any automatic solution to a positive requirement for a missing universal. See osdn #41638 --- common/requirements.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/requirements.c b/common/requirements.c index 8b6f39c871..f67b2e3f30 100644 --- a/common/requirements.c +++ b/common/requirements.c @@ -3801,9 +3801,25 @@ req_vec_get_first_missing_univ(const struct requirement_vector *vec, /* Look for contradictions */ for (i = 0; i < requirement_vector_size(vec); i++) { struct requirement *preq = requirement_vector_get(vec, i); + if (universal_never_there(&preq->source)) { struct req_vec_problem *problem; + if (preq->present) { + /* The requirement vector can never be fulfilled. Removing the + * requirement makes it possible to fulfill it. This is a rule + * change and shouldn't be "fixed" without thinking. Don't offer any + * automatic solution to prevent mindless "fixes". */ + /* TRANS: ruledit warns a user about an unused requirement vector + * that never can be fulfilled because it asks for something that + * never will be there. */ + req_vec_problem_new(0, + N_("Requirement {%s} requires %s but it will never be" + " there."), + req_to_fstring(preq), universal_rule_name(&preq->source)); + continue; + } + problem = req_vec_problem_new(1, N_("Requirement {%s} mentions %s but it will never be there."), req_to_fstring(preq), universal_rule_name(&preq->source)); -- 2.20.1